You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@gobblin.apache.org by le...@apache.org on 2021/06/23 02:19:46 UTC

[gobblin] branch master updated: [GOBBLIN-1477] Add code coverage, security checks and fix bug with static tests for Github Actions (#3316)

This is an automated email from the ASF dual-hosted git repository.

lesun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/gobblin.git


The following commit(s) were added to refs/heads/master by this push:
     new b87b12b  [GOBBLIN-1477] Add code coverage, security checks and fix bug with static tests for Github Actions (#3316)
b87b12b is described below

commit b87b12ba7d7c3e925d36dedc395b4819847473b6
Author: William Lo <lo...@gmail.com>
AuthorDate: Tue Jun 22 19:19:36 2021 -0700

    [GOBBLIN-1477] Add code coverage, security checks and fix bug with static tests for Github Actions (#3316)
    
    * Add code coverage, security fix, concurrency improvements, and fix bug that disabled static checks
    
    * Add additional gradle args for code cov
---
 .github/workflows/build_and_test.yaml          | 45 ++++++++++++--------------
 gradle/scripts/jacoco-coveralls-support.gradle |  2 +-
 2 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/.github/workflows/build_and_test.yaml b/.github/workflows/build_and_test.yaml
index 1edecf7..9da9b1e 100644
--- a/.github/workflows/build_and_test.yaml
+++ b/.github/workflows/build_and_test.yaml
@@ -28,6 +28,10 @@ on:
   release:
     types: [published, edited]
 
+concurrency:
+  group: ci-${{ github.event.pull_request.number || github.ref }}
+  cancel-in-progress: true
+
 jobs:
   build:
     name: Build repository
@@ -35,6 +39,8 @@ jobs:
     steps:
       - name: Check out the repo
         uses: actions/checkout@v2
+        with:
+          persist-credentials: false
       - name: Set up JDK 1.8
         uses: actions/setup-java@v1
         with:
@@ -56,30 +62,6 @@ jobs:
         run: |
           ./gradlew --no-daemon clean build -x test -x javadoc -x findbugsMain -x findbugsTest -x checkstyleMain -x checkstyleJmh -x checkstyleTest -Dorg.gradle.parallel=true
 
-  test_coverage:
-    runs-on: ubuntu-latest
-    name: Generate test coverage
-    needs: build
-    steps:
-      - name: Check out the repo
-        uses: actions/checkout@v2
-      - name: Set up JDK 1.8
-        uses: actions/setup-java@v1
-        with:
-          java-version: 1.8
-      - name: Cache Gradle Dependencies
-        uses: actions/cache@v2
-        with:
-          path: |
-            ~/.gradle/caches
-            ~/.gradle/wrapper
-          # Only rebuild cache if build.gradle is changed
-          key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
-          restore-keys: ${{ runner.os }}-gradle
-      - name: Generate code coverage
-        run: |
-          ./gradlew -PskipTestGroup=disabledOnCI -Dorg.gradle.parallel=false -DjacocoBuild=1 $GOBBLIN_GRADLE_OPTS jacocoTestCoverage
-
   static_checks:
     name: Run static checks
     runs-on: ubuntu-latest
@@ -103,7 +85,7 @@ jobs:
           restore-keys: ${{ runner.os }}-gradle
       - name: Run CheckStyle and FindBugs
         run: |
-          ./gradlew --no-daemon -x javadoc findbugsMain checkstyleMain checkstyleTest checkstyleJmh
+          ./gradlew --no-daemon javadoc findbugsMain checkstyleMain checkstyleTest checkstyleJmh
 
   run_tests:
     timeout-minutes: 120
@@ -129,6 +111,8 @@ jobs:
     steps:
       - name: Check out the repo
         uses: actions/checkout@v2
+        with:
+          persist-credentials: false
       - name: Set up JDK 1.8
         uses: actions/setup-java@v1
         with:
@@ -169,3 +153,14 @@ jobs:
             fi
             sleep 30
           done
+          ./gradlew -PskipTestGroup=disabledOnCI $GOBBLIN_GRADLE_OPTS -DjacocoBuild=1 jacocoTestReport
+      - name: Collect Jacoco Coverage Reports
+        run: |
+          JACOCO_REPORTS=$(find . -name "jacoco*.xml" -exec printf ',{}' \; | cut -c2- )
+          echo "jacoco_reports=$JACOCO_REPORTS" >> $GITHUB_ENV
+      - name: Upload coverage to Codecov
+        uses: codecov/codecov-action@v1
+        with:
+          files: ${{ env.jacoco_reports }}
+          fail_ci_if_error: true
+          verbose: true
diff --git a/gradle/scripts/jacoco-coveralls-support.gradle b/gradle/scripts/jacoco-coveralls-support.gradle
index a1d622c..c795b70 100644
--- a/gradle/scripts/jacoco-coveralls-support.gradle
+++ b/gradle/scripts/jacoco-coveralls-support.gradle
@@ -21,7 +21,7 @@
 
 apply plugin: 'jacoco'
 
-ext.jacocoVersion = '0.8.1'
+ext.jacocoVersion = '0.8.2'
 
 jacoco {
   toolVersion = jacocoVersion