diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 2e4003f731..fd7cda241c 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -1,6 +1,12 @@ name: CI -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master jobs: build: @@ -8,7 +14,7 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - java: [1.8, 11] + java: [8, 11] jenkins-version: [2.60.3, 2.176.3] os: [ubuntu-latest, windows-latest] include: @@ -19,11 +25,34 @@ jobs: jenkins-version: '2.60.3' steps: + - uses: actions/checkout@v1 + - name: Set up JDK ${{ matrix.java }} uses: actions/setup-java@v1 with: java-version: ${{ matrix.java }} + + - name: Cache dependencies + uses: actions/cache@v1 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven + - name: Build with Maven + run: mvn -Pjacoco clean verify -B -V --no-transfer-progress ${{ matrix.flags }} + + - name: Report coverage + shell: bash + env: + CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | - mvn install -B -V --no-transfer-progress ${{ matrix.flags }} + if [ "$CODACY_PROJECT_TOKEN" != "" ] && [ "$CODECOV_TOKEN" != "" ]; then + bash <(curl -s https://codecov.io/bash) -f "*jacoco.xml" + bash <(curl -Ls https://coverage.codacy.com/get.sh) report -l Java -r integrations/target/site/jacoco-aggregate/jacoco.xml + else + echo "No secrets provided for coverage report" + fi diff --git a/.travis.yml b/.travis.yml index a997af6731..2d4d65ccc9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: java -dist: xenial +dist: bionic if: | repo != jenkinsci/configuration-as-code-plugin OR \ @@ -10,41 +10,22 @@ if: | services: - docker -before_cache: - - rm -rf $HOME/.m2/repository/io/jenkins/configuration-as-code* - cache: directories: - $HOME/.m2 -env: - global: - - JAVA_LEVEL=8 - -matrix: - include: - - jdk: openjdk11 - env: - - MVN_FLAG='-Djenkins.version=2.176.3 -Daccess-modifier-checker.failOnError=true' - - jdk: openjdk8 - env: - - MVN_FLAG='-Djenkins.version=2.176.3 -Daccess-modifier-checker.failOnError=true' - - jdk: openjdk8 +jdk: openjdk11 -install: - - mvn clean install -DskipTests=true -Dmaven.javadoc.skip=true -B -V $MVN_FLAG -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn +install: skip script: - | - mvn -Penable-jacoco clean install jacoco:report -B \ - -Djava.level=$JAVA_LEVEL \ - $MVN_FLAG -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + mvn -Pjacoco clean verify -B -V \ + -Djenkins.version=2.176.3 -Daccess-modifier-checker.failOnError=true \ + --no-transfer-progress after_success: - - export LATEST_VERSION="$(curl -Ls https://api.bintray.com/packages/codacy/Binaries/codacy-coverage-reporter/versions/_latest | jq -r .name)" - - curl -Ls -o codacy-coverage-reporter "https://dl.bintray.com/codacy/Binaries/$LATEST_VERSION/codacy-coverage-reporter-linux" - - chmod +x codacy-coverage-reporter - - ./codacy-coverage-reporter report -l Java -r plugin/target/site/jacoco/jacoco.xml + - bash <(curl -s https://codecov.io/bash) -f "*jacoco.xml" notifications: email: false diff --git a/codecov.yml b/codecov.yml new file mode 100644 index 0000000000..fb209bc9f2 --- /dev/null +++ b/codecov.yml @@ -0,0 +1,2 @@ +comment: + layout: "header, diff, tree, changes" diff --git a/integrations/pom.xml b/integrations/pom.xml index eae4f371bb..fc897f331a 100644 --- a/integrations/pom.xml +++ b/integrations/pom.xml @@ -677,4 +677,27 @@ + + + + jacoco + + + + org.jacoco + jacoco-maven-plugin + + + report-aggregate + verify + + report-aggregate + + + + + + + + diff --git a/pom.xml b/pom.xml index 2a98a8c3da..8dbfe1891b 100644 --- a/pom.xml +++ b/pom.xml @@ -15,8 +15,8 @@ snakeyaml plugin - integrations test-harness + integrations @@ -99,4 +99,30 @@ + + + jacoco + + + + org.jacoco + jacoco-maven-plugin + + + + prepare-agent + + + + + + **/Messages.class + + + + + + + +