.gitlab-ci.yml 1.45 KB
Newer Older
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 31 32
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
  - awk -F"," '{ instructions += $4 + $5; covered += $5 } END { print covered, "/", instructions, " instructions covered"; print int(100*covered/instructions), "% covered" }' target/site/jacoco-ut/jacoco.csv
  - |
33
    # Report coverage when: BRANCH=master JOB=verify:jdk8
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
    if [[ "${CI_JOB_NAME}" == "verify:jdk8" && "${CI_BUILD_REF_NAME}" == "master" ]]
    then
      echo "Sending jacoco coverage report to codecov.io"
      curl -s https://codecov.io/bash | bash -s
    fi
  coverage: /([0-9]{1,3}) % covered/
  after_script:
  # Never cache the snapshot build.
  - rm -rf .m2/repository/net/morimekta/utils/io-util/*-SNAPSHOT/

verify:jdk8:
  <<: *verify
  image: maven:3.5-jdk-8-alpine

verify:jdk11:
  <<: *verify
  image: maven:3.5-jdk-11-slim