Skip to content

Commit e854921

Browse files
committed
ci: Implement secure test result reporting via GitHub Actions
Establishes a split-workflow CI pipeline to safely run tests and report results, complying with security best practices for public repositories. Changes: * Build Workflow: - Updated the Ant build command to enable coverage (`-Dcoverage=true`). - Added a "Stage Test Results" step to aggregate XML reports from all sub-projects (client, server, donkey, etc.) while preserving directory structure. - Added an "Event File" job to capture PR metadata for secure downstream processing. * Reporting Workflow: - Created `upload_test_results.yaml` triggered by `workflow_run`. - Implemented the privileged report publishing step separately from the unprivileged build step. - configured `EnricoMi/publish-unit-test-result-action` to ingest the aggregated XML reports. Security: * Uses the `workflow_run` pattern to allow safe PR commenting from forks without exposing write tokens to the build environment. Signed-off-by: Tony Germano <tony@germano.name>
1 parent f506683 commit e854921

2 files changed

Lines changed: 66 additions & 2 deletions

File tree

.github/workflows/build.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build OpenIntegrationEngine
1+
name: Build Open Integration Engine
22

33
on:
44
push:
@@ -9,6 +9,16 @@ on:
99
- main
1010

1111
jobs:
12+
event_file:
13+
name: "Event File"
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Upload
17+
uses: actions/upload-artifact@v4
18+
with:
19+
name: Event File
20+
path: ${{ github.event_path }}
21+
1222
build:
1323
runs-on: ubuntu-latest
1424

@@ -30,7 +40,7 @@ jobs:
3040
- name: Build OIE (unsigned)
3141
if: github.ref != 'refs/heads/main'
3242
working-directory: server
33-
run: ant -f mirth-build.xml -DdisableSigning=true
43+
run: ant -f mirth-build.xml -DdisableSigning=true -Dcoverage=true
3444

3545
- name: Package distribution
3646
run: tar czf openintegrationengine.tar.gz -C server/ setup --transform 's|^setup|openintegrationengine/|'
@@ -40,3 +50,19 @@ jobs:
4050
with:
4151
name: oie-build
4252
path: openintegrationengine.tar.gz
53+
54+
- name: Stage Test Results
55+
if: (!cancelled())
56+
run: |
57+
mkdir -p aggregate-test-results
58+
# Copy the directory structures
59+
cp -r --parents */build/test-results aggregate-test-results/
60+
61+
- name: Upload Test Results
62+
if: (!cancelled())
63+
uses: actions/upload-artifact@v4
64+
with:
65+
name: Test Results
66+
path: |
67+
aggregate-test-results/**/*.xml
68+
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Test Results
2+
3+
on:
4+
workflow_run:
5+
workflows: ["Build Open Integration Engine"]
6+
types:
7+
- completed
8+
9+
permissions: {}
10+
11+
jobs:
12+
test-results:
13+
name: Test Results
14+
runs-on: ubuntu-latest
15+
if: github.event.workflow_run.conclusion == 'success' || github.event.workflow_run.conclusion == 'failure'
16+
17+
permissions:
18+
checks: write
19+
# needed unless run with comment_mode: off
20+
pull-requests: write
21+
# required by download step to access artifacts API
22+
actions: read
23+
24+
steps:
25+
- name: Download and Extract Artifacts
26+
uses: actions/download-artifact@v4
27+
with:
28+
run-id: ${{ github.event.workflow_run.id }}
29+
github-token: ${{ secrets.GITHUB_TOKEN }}
30+
path: artifacts
31+
32+
- name: Publish Test Results
33+
uses: EnricoMi/publish-unit-test-result-action@v2
34+
with:
35+
commit: ${{ github.event.workflow_run.head_sha }}
36+
event_file: artifacts/Event File/event.json
37+
event_name: ${{ github.event.workflow_run.event }}
38+
files: "artifacts/Test Results/**/*.xml"

0 commit comments

Comments
 (0)