This repository has been archived by the owner on Dec 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
49 lines (47 loc) · 1.66 KB
/
publish_reports.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Publish reports
on:
workflow_run:
workflows: ["Build And Test"]
types:
- completed
jobs:
publish:
name: Publish Test Report
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/[email protected]
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@v1
with:
github_token: ${{secrets.GITHUB_TOKEN}}
report_paths: '${{github.workspace}}/*test-reports/**/TEST-*.xml'
commit: ${{github.event.workflow_run.head_sha}}