Skip to content

Commit 33aa9f0

Browse files
committed
ci: Collect JUNIT style test results for E2E tests and post them to PRs
While we already used gotestsum and the publish-unit-test action for our unit tests, we still relied on parsing the whole log output manually for E2E tests. Now E2E tests collect the same junit style files and are results are parsed and commented on PRs.
1 parent 2d3d629 commit 33aa9f0

File tree

3 files changed

+74
-4
lines changed

3 files changed

+74
-4
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Test Results
2+
3+
# This workflow runs after the CI 'Build and Test' workflow has completed,
4+
# to collect test results in JUnit format and post a comment on test test status to a PR.
5+
# This split setup is required to correctly work on forks and dependabot PRs, as described here:
6+
# https://github.com/EnricoMi/publish-unit-test-result-action/blob/v1.20/README.md#support-fork-repositories-and-dependabot-branches
7+
8+
on:
9+
workflow_run:
10+
workflows: [ "E2E Test" ]
11+
types:
12+
- completed
13+
14+
env:
15+
ARTIFACT_PATH: "artifacts"
16+
17+
jobs:
18+
e2e-test-results:
19+
name: End-to-end Test Results
20+
runs-on: ubuntu-latest
21+
permissions:
22+
actions: read
23+
contents: read
24+
issues: read
25+
checks: write
26+
pull-requests: write
27+
if: github.event.workflow_run.conclusion != 'skipped'
28+
29+
steps:
30+
- name: Get Artifacts of Build Action
31+
env:
32+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
33+
run: |
34+
mkdir -p ${{ env.ARTIFACT_PATH }} && cd ${{ env.ARTIFACT_PATH }}
35+
36+
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
37+
38+
gh api "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
39+
do
40+
IFS=$'\t' read name url <<< "$artifact"
41+
gh api $url > "$name.zip"
42+
unzip -d "$name" "$name.zip"
43+
done
44+
45+
- name: Publish E2E Test Results
46+
uses: EnricoMi/publish-unit-test-result-action@d93dbc08d265e4653da0c0af544bee2a851d3e38 #v2.10.0
47+
with:
48+
check_name: "E2E Test Results"
49+
commit: ${{ github.event.workflow_run.head_sha }}
50+
event_file: ${{ env.ARTIFACT_PATH }}/event_file/event.json
51+
event_name: ${{ github.event.workflow_run.event }}
52+
files: ${{ env.ARTIFACT_PATH }}/**/*.xml

.github/workflows/collect-unit-test-results.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
- name: Publish Unit Test Results
4646
uses: EnricoMi/publish-unit-test-result-action@d93dbc08d265e4653da0c0af544bee2a851d3e38 #v2.10.0
4747
with:
48+
check_name: "Unit Test Results"
4849
commit: ${{ github.event.workflow_run.head_sha }}
4950
event_file: ${{ env.ARTIFACT_PATH }}/event_file/event.json
5051
event_name: ${{ github.event.workflow_run.event }}

.github/workflows/end-to-end-test.yml

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ jobs:
5555

5656
- name: 🌎 Integration test
5757
if: github.repository == env.BASE_REPO && (github.event.action != 'labeled' || github.event.label.name == env.E2E_TEST_LABEL)
58-
run: make integration-test
58+
run: make integration-test testopts="--junitfile test-result-integration.xml"
5959
env:
6060
MONACO_FEAT_GRAPH_DEPLOY: "true" # TODO remove when graph based deployments are activated by default
6161
MONACO_FEAT_GRAPH_DEPLOY_PARALLEL: "true" # TODO remove when graph based deployments are activated by default
@@ -72,7 +72,7 @@ jobs:
7272

7373
- name: 🧓 Integration test (legacy)
7474
if: github.repository == env.BASE_REPO && (github.event.action != 'labeled' || github.event.label.name == env.E2E_TEST_LABEL)
75-
run: make integration-test-v1
75+
run: make integration-test-v1 testopts="--junitfile test-result-integration-legacy.xml"
7676
env:
7777
MONACO_FEAT_GRAPH_DEPLOY: "true" # TODO remove when graph based deployments are activated by default
7878
MONACO_FEAT_GRAPH_DEPLOY_PARALLEL: "true" # TODO remove when graph based deployments are activated by default
@@ -88,7 +88,7 @@ jobs:
8888

8989
- name: 📥/📤 Download/Restore test
9090
if: github.repository == env.BASE_REPO && (github.event.action != 'labeled' || github.event.label.name == env.E2E_TEST_LABEL)
91-
run: make download-restore-test
91+
run: make download-restore-test testopts="--junitfile test-result-integration-download-restore.xml"
9292
env:
9393
MONACO_FEAT_GRAPH_DEPLOY: "true" # TODO remove when graph based deployments are activated by default
9494
MONACO_FEAT_GRAPH_DEPLOY_PARALLEL: "true" # TODO remove when graph based deployments are activated by default
@@ -104,7 +104,7 @@ jobs:
104104

105105
- name: 🌙 Nightly Tests
106106
if: github.repository == env.BASE_REPO && github.event_name == 'schedule'
107-
run: make nightly-test
107+
run: make nightly-test testopts="--junitfile test-result-integration-nightly.xml"
108108
env:
109109
MONACO_FEAT_GRAPH_DEPLOY: "true" # TODO remove when graph based deployments are activated by default
110110
MONACO_FEAT_GRAPH_DEPLOY_PARALLEL: "true" # TODO remove when graph based deployments are activated by default
@@ -133,3 +133,20 @@ jobs:
133133
OAUTH_CLIENT_ID: ${{ secrets.OAUTH_CLIENT_ID }}
134134
OAUTH_CLIENT_SECRET: ${{ secrets.OAUTH_CLIENT_SECRET }}
135135
OAUTH_TOKEN_ENDPOINT: ${{ secrets.OAUTH_TOKEN_ENDPOINT }}
136+
137+
- name: ⬆️ Upload Test Results
138+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3
139+
if: always()
140+
with:
141+
name: Test Results
142+
path: test-result-*.xml
143+
144+
upload_event:
145+
name: "Upload Event File"
146+
runs-on: ubuntu-latest
147+
steps:
148+
- name: Upload
149+
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3
150+
with:
151+
name: event_file
152+
path: ${{ github.event_path }}

0 commit comments

Comments
 (0)