.gitlab-ci.yml 2.06 KB
Newer Older
Stein Eldar Johnsen's avatar
Stein Eldar Johnsen committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
variables:
  MAVEN_OPTS: "-Dhttps.protocols=TLSv1.2 -Dmaven.repo.local=.m2/repository -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=WARN -Djava.awt.headless=true"
  MAVEN_CLI_OPTS: "-B -fae --settings .m2/settings.xml"
  MAVEN_NO_TESTS: "-DskipTests=true"

stages:
- testing
- release
- post-release

cache:
  key: "$CI_PROJECT_NAME"
  paths:
  - .m2/repository

.verify: &verify
  stage: testing
  except:
    variables:
    - $CI_COMMIT_MESSAGE =~ /\[silent-ignore\]/
    - $CI_COMMIT_MESSAGE =~ /\[maven-release-plugin\]/
  before_script:
  - mkdir -p .m2/repository
  - |
    cat <<EOF > .m2/settings.xml
    <settings>
    </settings>
    EOF
  script:
  - mvn ${MAVEN_CLI_OPTS} verify
31 32
  - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { OFMT = "%.2f"; print covered, "/", instructions, " instructions covered"; print 100*covered/instructions, "% covered" }' target/site/jacoco-ut/jacoco.csv
  coverage: /([0-9]{1,3}[.][0-9][0-9]) % covered/
Stein Eldar Johnsen's avatar
Stein Eldar Johnsen committed
33 34
  after_script:
  # Never cache the snapshot build.
35
  - rm -rf .m2/repository/net/morimekta/utils/testing-util/*-SNAPSHOT/ || /bin/true
36 37 38 39
  artifacts:
    reports:
      junit:
      - target/surefire-reports/TEST-*.xml
Stein Eldar Johnsen's avatar
Stein Eldar Johnsen committed
40 41 42

verify:jdk8:
  <<: *verify
43
  image: maven:3.6-jdk-8-alpine
Stein Eldar Johnsen's avatar
Stein Eldar Johnsen committed
44 45 46

verify:jdk11:
  <<: *verify
47
  image: maven:3.6-jdk-11-slim
48 49 50 51 52
  artifacts:
    expire_in: 5 minutes
    paths:
    - target/site/**/*

53 54 55 56
verify:jdk14:
  <<: *verify
  image: maven:3.6-jdk-14

57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76
pages:
  image: ruby:2.5
  cache:
    key: "vendor-$CI_PROJECT_NAME"
    paths:
    - docs/vendor/
  stage: post-release
  before_script:
  - cd docs
  - bundle install --path vendor
  only:
  - master
  except:
    variables:
      - $CI_COMMIT_MESSAGE =~ /\[silent-ignore\]/
      - $CI_COMMIT_MESSAGE =~ /\[maven-release-plugin\]/
  script:
  - bundle exec jekyll build -d public
  - mv public ..
  - mv ../target/site/jacoco-ut ../public/
77
  - curl --request POST --form "token=$CI_JOB_TOKEN" --form ref=master https://gitlab.com/api/v4/projects/8291815/trigger/pipeline
78 79 80 81
  artifacts:
    paths:
      - public
  dependencies:
82
  - verify:jdk11