Skip to content

Commit 2b83fac

Browse files
authored
Generate tests summary (#5710)
1 parent b581bb6 commit 2b83fac

3 files changed

Lines changed: 58 additions & 3 deletions

File tree

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# Copied from https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.23/README.md#support-fork-repositories-and-dependabot-branches
2+
# Warning: changes to this workflow will NOT be picked up until they land in the main branch!
3+
# See https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_run
4+
5+
name: Publish test results
6+
7+
on:
8+
workflow_run:
9+
workflows: [Tests]
10+
types: [completed]
11+
12+
jobs:
13+
publish-test-results:
14+
name: Publish test results
15+
runs-on: ubuntu-latest
16+
if: github.event.workflow_run.conclusion != 'skipped'
17+
18+
# Needed to post comments on the PR
19+
permissions:
20+
checks: write
21+
pull-requests: write
22+
23+
steps:
24+
- name: Download and extract artifacts
25+
env:
26+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
27+
run: |
28+
mkdir artifacts && cd artifacts
29+
30+
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
31+
32+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
33+
do
34+
IFS=$'\t' read name url <<< "$artifact"
35+
gh api $url > "$name.zip"
36+
unzip -d "$name" "$name.zip"
37+
done
38+
39+
- name: Publish Unit Test Results
40+
uses: EnricoMi/publish-unit-test-result-action@v1
41+
with:
42+
commit: ${{ github.event.workflow_run.head_sha }}
43+
event_file: artifacts/Event File/event.json
44+
event_name: ${{ github.event.workflow_run.event }}
45+
files: artifacts/**/*.xml
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
name: Debug passwordless `ssh localhost`
22

3-
on: []
4-
# on: [pull_request] # Uncomment to enable
3+
on: [push, pull_request]
54

65
jobs:
76
test:

.github/workflows/tests.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ jobs:
130130
- name: Coverage
131131
uses: codecov/codecov-action@v1
132132

133-
- name: Upload test artifacts
133+
- name: Upload test results
134134
# ensure this runs even if pytest fails
135135
if: >
136136
always() &&
@@ -149,3 +149,14 @@ jobs:
149149
name: ${{ env.TEST_ID }}_cluster_dumps
150150
path: test_cluster_dump
151151
if-no-files-found: ignore
152+
153+
# Publish an artifact for the event; used by publish-test-results.yaml
154+
event_file:
155+
name: "Event File"
156+
runs-on: ubuntu-latest
157+
steps:
158+
- name: Upload
159+
uses: actions/upload-artifact@v2
160+
with:
161+
name: Event File
162+
path: ${{ github.event_path }}

0 commit comments

Comments
 (0)