From 9c25cfed9d5a2f4a4d269179147631d4344f9bee Mon Sep 17 00:00:00 2001 From: Peter Nied Date: Thu, 26 Oct 2023 14:20:17 -0400 Subject: [PATCH] Collect all coverage data at once (#3537) Collect all coverage data at once - should reduce throttling by GitHub APIs when coverage data is proceeded. Will only report code coverage once all the other tests have finished running ensuring accurate reporting. Also speed up normal test flows by changing how artifacts are uploaded, the `actions/upload-artifacts` action was taking 2-3 mins to copy files, now its down to a couple of seconds. Signed-off-by: Peter Nied Signed-off-by: Peter Nied --- .github/actions/run-bwc-suite/action.yaml | 2 +- .github/workflows/ci.yml | 63 +++++++++++++++++------ .github/workflows/integration-tests.yml | 2 +- build.gradle | 15 ++++++ 4 files changed, 64 insertions(+), 18 deletions(-) diff --git a/.github/actions/run-bwc-suite/action.yaml b/.github/actions/run-bwc-suite/action.yaml index 6e6a17fb3f..ad87f7316c 100644 --- a/.github/actions/run-bwc-suite/action.yaml +++ b/.github/actions/run-bwc-suite/action.yaml @@ -50,7 +50,7 @@ runs: -Dbwc.version.next=${{ steps.build-next.outputs.built-version }} -i build-root-directory: bwc-test - - uses: actions/upload-artifact@v3 + - uses: alehechka/upload-tartifact@v2 if: always() with: name: ${{ inputs.report-artifact-name }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73d1f12f4c..3f08695275 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -60,27 +60,50 @@ jobs: arguments: | ${{ matrix.gradle_task }} -Dbuild.snapshot=false - - name: Coverage - uses: Wandalen/wretry.action@v1.3.0 - with: - attempt_limit: 3 - attempt_delay: 2000 - action: codecov/codecov-action@v3 - with: | - token: ${{ secrets.CODECOV_TOKEN }} - fail_ci_if_error: false - files: ./build/reports/jacoco/test/jacocoTestReport.xml - - - uses: actions/upload-artifact@v3 + - uses: alehechka/upload-tartifact@v2 if: always() with: - name: ${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports + name: ${{ matrix.platform }}-JDK${{ matrix.jdk }}-${{ matrix.gradle_task }}-reports path: | ./build/reports/ - - name: check archive for debugging - if: always() - run: echo "Check the artifact ${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports for detailed test results" + report-coverage: + needs: + - "test" + - "integration-tests" + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + path: downloaded-artifacts + + - name: Display structure of downloaded files + run: ls -R + working-directory: downloaded-artifacts + + - name: Extract downloaded artifacts + run: | + for archive in ./*/artifact.tar; do + (cd "$(dirname "$archive")" && tar -xvf artifact.tar) + done + working-directory: downloaded-artifacts + + - name: Display structure of downloaded files + run: ls -R + working-directory: downloaded-artifacts + + - name: Upload Coverage with retry + uses: Wandalen/wretry.action@v1.3.0 + with: + attempt_limit: 5 + attempt_delay: 2000 + action: codecov/codecov-action@v3 + with: | + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true + directory: downloaded-artifacts + verbose: true + integration-tests: name: integration-tests @@ -108,6 +131,14 @@ jobs: arguments: | integrationTest -Dbuild.snapshot=false + - uses: alehechka/upload-tartifact@v2 + if: always() + with: + name: integration-${{ matrix.platform }}-JDK${{ matrix.jdk }}-reports + path: | + ./build/reports/ + + resource-tests: env: CI_ENVIRONMENT: resource-test diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index eb11d0e478..d514cef017 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -24,7 +24,7 @@ jobs: - run: OPENDISTRO_SECURITY_TEST_OPENSSL_OPT=true ./gradlew test - - uses: actions/upload-artifact@v3 + - uses: alehechka/upload-tartifact@v2 if: always() with: name: ${{ matrix.jdk }}-${{ matrix.test-run }}-reports diff --git a/build.gradle b/build.gradle index 2b2358d9cf..9855a3de86 100644 --- a/build.gradle +++ b/build.gradle @@ -541,6 +541,21 @@ task integrationTest(type: Test) { classpath = sourceSets.integrationTest.runtimeClasspath //run the integrationTest task after the test task shouldRunAfter test + jacoco { + excludes = [ + "com.sun.jndi.dns.*", + "com.sun.security.sasl.gsskerb.*", + "java.sql.*", + "javax.script.*", + "org.jcp.xml.dsig.internal.dom.*", + "sun.nio.cs.ext.*", + "sun.security.ec.*", + "sun.security.jgss.*", + "sun.security.pkcs11.*", + "sun.security.smartcardio.*", + "sun.util.resources.provider.*" + ] + } } //run the integrationTest task before the check task