Skip to content

Commit

Permalink
Update JUnit test reports on PR merged on main (hyperledger#7141)
Browse files Browse the repository at this point in the history
Signed-off-by: Fabio Di Fabio <fabio.difabio@consensys.net>
Signed-off-by: Justin Florentine <justin+github@florentine.us>
  • Loading branch information
fab-10 authored and jflo committed Jun 10, 2024
1 parent 9cd2218 commit eef81e2
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 3 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/acceptance-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,24 @@ jobs:
run: ./gradlew acceptanceTestNotPrivacy --test-dry-run -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: Extract current test list
run: mkdir tmp; find . -type f -name TEST-*.xml | xargs -I{} bash -c "xmlstarlet sel -t -v '/testsuite/@name' '{}'; echo ' acceptanceTestNotPrivacy'" | tee tmp/currentTests.list
- name: get acceptance test reports
- name: Get acceptance test reports (Support transition) # can be removed after PR is merged
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
with:
branch: main
name_is_regexp: true
name: 'acceptance-node-\d*\d-test-results'
name: 'acceptance-node-\d+-test-results'
path: tmp/junit-xml-reports-downloaded
if_no_artifact_found: true
- name: Get acceptance test reports
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
with:
branch: main
workflow: update-test-reports.yml
name: acceptance-test-results
path: tmp/junit-xml-reports-downloaded
if_no_artifact_found: ignore
- name: Split tests
run: .github/workflows/splitTestsByTime.sh tmp/junit-xml-reports-downloaded "tmp/junit-xml-reports-downloaded/acceptance-node-.*-test-results" "TEST-" ${{env.total-runners}} ${{ matrix.runner_index }} > testList.txt
- name: format gradle args
Expand Down
12 changes: 11 additions & 1 deletion .github/workflows/pre-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,14 +104,24 @@ jobs:
run: ./gradlew test --test-dry-run -Dorg.gradle.parallel=true -Dorg.gradle.caching=true
- name: Extract current test list
run: mkdir tmp; find . -type f -name TEST-*.xml | xargs -I{} bash -c "xmlstarlet sel -t -v '/testsuite/@name' '{}'; echo '{}' | sed 's#\./\(.*\)/build/test-results/.*# \1#'" | tee tmp/currentTests.list
- name: get unit test reports
- name: Get unit test reports (Support transition) # can be removed after PR is merged
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
with:
branch: main
name_is_regexp: true
name: 'unit-.*-test-results'
path: tmp/junit-xml-reports-downloaded
if_no_artifact_found: true
- name: Get unit test reports
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
continue-on-error: true
with:
branch: main
workflow: update-test-reports.yml
name: unit-test-results
path: tmp/junit-xml-reports-downloaded
if_no_artifact_found: ignore
- name: Split tests
run: .github/workflows/splitTestsByTime.sh tmp/junit-xml-reports-downloaded "tmp/junit-xml-reports-downloaded/unit-.*-test-results" "build/test-results" ${{env.total-runners}} ${{ matrix.runner_index }} > testList.txt
- name: Upload Timing
Expand Down
51 changes: 51 additions & 0 deletions .github/workflows/update-test-reports.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: update-test-reports

on:
push:
branches:
- main

jobs:
syncTestReports:
if: github.repository == 'hyperledger/besu'
runs-on: ubuntu-22.04
steps:
- name: Get latest merge PR number
id: latest_merged_pr_number
run: echo "PULL_REQUEST_NUMBER=$(gh pr list --repo hyperledger/besu --base main --state merged --limit 1 --json number | jq '.[].number')" >> "$GITHUB_OUTPUT"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get unit test reports from latest merged PR
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
with:
workflow: pre-review.yml
workflow_conclusion: success
pr: ${{ env.LATEST_MERGED_PR_NUMBER }}
name_is_regexp: true
name: 'unit-\d+-test-results'
path: unit-test-results
if_no_artifact_found: fail
env:
LATEST_MERGED_PR_NUMBER: ${{ steps.latest_merged_pr_number.outputs.PULL_REQUEST_NUMBER }}
- name: Upload unit test results
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: unit-test-results
path: 'unit-test-results/**/test-results/**/TEST-*.xml'
- name: Get acceptance test reports from latest merged PR
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
with:
workflow: acceptance-tests.yml
workflow_conclusion: success
pr: ${{ env.LATEST_MERGED_PR_NUMBER }}
name_is_regexp: true
name: 'acceptance-node-\d+-test-results'
path: acceptance-test-results
if_no_artifact_found: fail
env:
LATEST_MERGED_PR_NUMBER: ${{ steps.latest_merged_pr_number.outputs.PULL_REQUEST_NUMBER }}
- name: Upload acceptance test results
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3
with:
name: acceptance-test-results
path: 'acceptance-test-results/**/test-results/**/TEST-*.xml'

0 comments on commit eef81e2

Please sign in to comment.