Skip to content

Commit 3224925

Browse files
authored
Re-worked PR/CI build support (#18)
* Removed use of test publication until use with tighter permissions is sorted out. * Re-worked build support to allow publication of test runs for forked repos. For full details see: https://github.com/EnricoMi/publish-unit-test-result-action?tab=readme-ov-file#support-fork-repositories-and-dependabot-branches --------- Co-authored-by: smaillet <25911635+smaillet@users.noreply.github.com>
1 parent 80238ac commit 3224925

File tree

2 files changed

+60
-5
lines changed

2 files changed

+60
-5
lines changed

.github/workflows/pr-build.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ on:
2323
- '**.dic'
2424

2525
jobs:
26+
# see: https://github.com/EnricoMi/publish-unit-test-result-action?tab=readme-ov-file#support-fork-repositories-and-dependabot-branches
27+
event_file:
28+
name: "Event File"
29+
runs-on: windows-latest
30+
steps:
31+
- name: Upload event file
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: Event File
35+
path: ${{ github.event_path }}
36+
2637
build_target:
2738
runs-on: windows-latest
2839
steps:
@@ -38,14 +49,15 @@ jobs:
3849
- name: Run Tests
3950
run: ./Invoke-Tests.ps1
4051

41-
- name: Publish Test Results
42-
uses: EnricoMi/publish-unit-test-result-action/windows@v2
43-
if: ${{ github.event_name == 'push' }}
52+
- name: Upload Test Results
53+
uses: actions/upload-artifact@v4
4454
with:
45-
files: BuildOutput/Test-Results/*.trx
55+
name: Test Results
56+
path: BuildOutput/Test-Results/*.trx
4657

4758
- name: Upload NuGET Packages
4859
uses: actions/upload-artifact@v4
4960
with:
50-
name: Nuget Packages
61+
name: NuGet Packages
5162
path: ./BuildOutput/NuGet
63+

.github/workflows/test-results.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["CI-Build"]
6+
types:
7+
- completed
8+
permissions: {}
9+
10+
jobs:
11+
test-results:
12+
name: Test Results
13+
runs-on: ubuntu-latest
14+
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'
15+
16+
permissions:
17+
checks: write
18+
19+
# needed unless run with comment_mode: off
20+
pull-requests: write
21+
22+
# only needed for private repository
23+
#contents: read
24+
# only needed for private repository
25+
#issues: read
26+
27+
# required by download step to access artifacts API
28+
actions: read
29+
30+
steps:
31+
- name: Download and Extract Artifacts
32+
uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d
33+
with:
34+
run_id: ${{ github.event.workflow_run.id }}
35+
path: artifacts
36+
37+
- name: Publish Test Results
38+
uses: EnricoMi/publish-unit-test-result-action@v2
39+
with:
40+
commit: ${{ github.event.workflow_run.head_sha }}
41+
event_file: artifacts/Event File/event.json
42+
event_name: ${{ github.event.workflow_run.event }}
43+
files: "artifacts/**/*.xml"

0 commit comments

Comments
 (0)