Skip to content

Commit

Permalink
Update Test report
Browse files Browse the repository at this point in the history
Signed-off-by: Stephane Bouchet <[email protected]>
  • Loading branch information
sbouchet committed Oct 11, 2023
1 parent fc10ac3 commit daa629d
Showing 1 changed file with 19 additions and 34 deletions.
53 changes: 19 additions & 34 deletions .github/workflows/publish_reports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,25 @@ jobs:
publish:
name: Publish Test Report
runs-on: ubuntu-latest
permissions:
checks: write

# only needed unless run with comment_mode: off
pull-requests: write

# only needed for private repository
contents: read

# only needed for private repository
issues: read
if: always()
steps:
- name: Download artifacts
uses: actions/github-script@v3.1.0
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
script: |
var artifacts = await github.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: ${{github.event.workflow_run.id}},
});
for (var artifact of artifacts.data.artifacts) {
if (artifact.name.endsWith('test-reports')) {
var zipfile = await github.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: artifact.id,
archive_format: 'zip',
});
var fs = require('fs');
var path = require('path');
var pathFile = path.format({
root: '${{github.workspace}}/',
name: artifact.name,
ext: '.zip'
});
fs.writeFileSync(pathFile, Buffer.from(zipfile.data));
}
}
- name: Unzip artifacts
run: |
find . -name '*.zip' -exec sh -c 'unzip -d "${1%.*}" "$1"' _ {} \;
- name: Publish aggregated tests reports
uses: scacap/action-surefire-report@4cbb611f23a9b5a030c73c2b32190a80983956ed #v1
path: artifacts

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@ca89ad036b5fcd524c1017287fb01b5139908408 #v2.11.0
with:
github_token: ${{secrets.GITHUB_TOKEN}}
report_paths: '${{github.workspace}}/*test-reports/**/TEST-*.xml'
commit: ${{github.event.workflow_run.head_sha}}
files: "artifacts/**/*.xml"

0 comments on commit daa629d

Please sign in to comment.