Skip to content

Commit

Permalink
Collect all coverage data at once (#3537)
Browse files Browse the repository at this point in the history
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 <petern@amazon.com>
Signed-off-by: Peter Nied <peternied@hotmail.com>
  • Loading branch information
peternied authored Oct 26, 2023
1 parent 60c9a86 commit 9c25cfe
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/actions/run-bwc-suite/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
63 changes: 47 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
15 changes: 15 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9c25cfe

Please sign in to comment.