-
Notifications
You must be signed in to change notification settings - Fork 1
100 lines (89 loc) · 4.04 KB
/
merged_reports.yml
File metadata and controls
100 lines (89 loc) · 4.04 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Merge All Reports
on:
workflow_dispatch:
inputs:
android_run_id:
description: 'Android Run ID'
required: true
type: string
ios_run_id:
description: 'iOS Run ID'
required: true
type: string
manual_run_id:
description: 'manual Run ID'
required: true
type: string
jobs:
merge-and-report:
runs-on: ubuntu-latest
env:
ANDROID_RUN_ID: ${{ inputs.android_run_id }}
ANDROID_ARTIFACT: android-serenity-json
IOS_RUN_ID: ${{ inputs.ios_run_id }}
IOS_ARTIFACT: ios-serenity-json
MANUAL_RUN_ID: ${{ inputs.manual_run_id }}
MANUAL_ARTIFACT: manual-serenity-json
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download Android Serenity JSON
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/$ANDROID_RUN_ID/artifacts > android_artifacts.json
ARTIFACT_ID=$(jq -r --arg NAME "$ANDROID_ARTIFACT" '.artifacts[] | select(.name==$NAME) | .id' android_artifacts.json)
[ -z "$ARTIFACT_ID" ] && echo "Android JSON artifact not found!" && exit 1
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" \
-o android_json.zip \
https://api.github.com/repos/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID/zip
unzip android_json.zip -d android-json
- name: Download iOS Serenity JSON
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/$IOS_RUN_ID/artifacts > ios_artifacts.json
ARTIFACT_ID=$(jq -r --arg NAME "$IOS_ARTIFACT" '.artifacts[] | select(.name==$NAME) | .id' ios_artifacts.json)
[ -z "$ARTIFACT_ID" ] && echo "iOS JSON artifact not found!" && exit 1
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" \
-o ios_json.zip \
https://api.github.com/repos/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID/zip
unzip ios_json.zip -d ios-json
- name: Download manual Serenity JSON
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
https://api.github.com/repos/${{ github.repository }}/actions/runs/$MANUAL_RUN_ID/artifacts > manual_artifacts.json
ARTIFACT_ID=$(jq -r --arg NAME "$MANUAL_ARTIFACT" '.artifacts[] | select(.name==$NAME) | .id' manual_artifacts.json)
[ -z "$ARTIFACT_ID" ] && echo "manual JSON artifact not found!" && exit 1
curl -L -H "Authorization: Bearer $GITHUB_TOKEN" \
-o manual_json.zip \
https://api.github.com/repos/${{ github.repository }}/actions/artifacts/$ARTIFACT_ID/zip
unzip manual_json.zip -d manual-json
- name: Merge Serenity JSONs
run: |
mkdir merged-json
find android-json -type f -name '*.json' -exec cp {} merged-json/ \;
find ios-json -type f -name '*.json' -exec cp {} merged-json/ \;
find manual-json -type f -name '*.json' -exec cp {} merged-json/ \;
- name: List merged-json content
run: |
ls -l merged-json
head -n 20 merged-json/*.json || true
- name: Generate Merged Serenity HTML Report
run: mvn serenity:aggregate -Dserenity.sourceDirectory=merged-json -Dserenity.outputDirectory=merged-html-report
- name: Replace Serenity Core CSS
if: always()
run: |
REPORT_DIR="merged-html-report"
echo "Replacing core.css using custom-style.css..."
mkdir -p "$REPORT_DIR/css"
cp src/test/resources/custom-style.css "$REPORT_DIR/css/core.css"
- name: Upload Merged HTML Serenity Report
uses: actions/upload-artifact@v4
with:
name: serenity-report
path: merged-html-report