-
Notifications
You must be signed in to change notification settings - Fork 10
156 lines (130 loc) · 4.28 KB
/
ci.yml
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: CI Job to Generate JUnit Reports with Diff and Allure Reports
on:
push:
branches:
- main
pull_request_target:
branches:
- main
permissions:
contents: write # Grant write permissions for contents
checks: write # Grant write permissions for checks, only effective on push
pull-requests: write # Explicitly grant write permissions for pull requests
jobs:
generate-reports:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install python packages
run: |
pip install ansi2html
pip install hyperon
pip install junit2html
- name: Make Install Script Executable
run: chmod +x INSTALL.sh
- name: Run Install Script to install Mettalog
run: |
. ./INSTALL.sh --easy
echo $PATH >> $GITHUB_PATH
- name: Make Test Script Executable
run: chmod +x scripts/run_commit_tests.sh
- name: Run Test Script to Generate Input File
continue-on-error: true
run: |
TIMESTAMP=$(date +"%Y-%m-%dT%H:%M:%S")
./scripts/run_commit_tests.sh -t $TIMESTAMP
echo "TIMESTAMP=$(echo $TIMESTAMP)" >> $GITHUB_ENV
env:
TERM: xterm-256color
- name: Run JUnit Report Generation Script
continue-on-error: true
run: |
python scripts/into_junit.py /tmp/SHARED.UNITS $TIMESTAMP > junit.xml
- name: Convert JUnit XML to Standard HTML Report
continue-on-error: true
run: |
junit2html junit.xml junit-standard-report.html
- name: Convert JUnit XML to Matrix HTML Report
continue-on-error: true
run: |
junit2html --report-matrix junit-matrix-report.html junit.xml
- name: Upload JUnit XML Report
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: junit-report
path: junit.xml
- name: Upload Standard HTML Report
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: junit-standard-html-report
path: junit-standard-report.html
- name: Upload Matrix HTML Report
continue-on-error: true
uses: actions/upload-artifact@v4
with:
name: junit-matrix-html-report
path: junit-matrix-report.html
- name: Display JUnit Test Results
if: github.event_name == 'push' # Only run this step on pushes to main
uses: dorny/test-reporter@v1
with:
name: 'JUnit Results'
path: 'junit.xml'
reporter: 'java-junit'
fail-on-error: false
- name: Provide Report Links
run: |
echo "JUnit reports are available as artifacts."
- name: Generate environment.properties
run: |
python scripts/generate_allure_environment.py ${{ github.sha }} ${{ github.ref_name }} > environment.properties
- name: Upload environment.properties
uses: actions/upload-artifact@v4
with:
name: environment
path: environment.properties
- name: Get Allure history
uses: actions/checkout@v4
with:
ref: test-results
path: test-results
- name: Download JUnit XML Results
uses: actions/download-artifact@v4
with:
name: junit-report
path: build/allure-results
- name: Include environment properties
uses: actions/download-artifact@v4
with:
name: environment
path: build/allure-results
- name: Generate Allure Report
uses: simple-elf/allure-report-action@master
if: always()
id: allure-report
with:
allure_results: build/allure-results
gh_pages: test-results
allure_report: allure-report
allure_history: allure-history
keep_reports: 20
- name: Deploy report to Github Pages
if: always()
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_branch: test-results
publish_dir: allure-history
- name: Auto-Approve the Pull Request
if: github.event_name == 'pull_request_target'
uses: hmarr/auto-approve-action@v4
with:
github-token: ${{ secrets.GITHUB_TOKEN }}