-
Notifications
You must be signed in to change notification settings - Fork 3.2k
276 lines (256 loc) · 9.95 KB
/
Copy pathcheck_visual_tests.yml
File metadata and controls
276 lines (256 loc) · 9.95 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
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
name: 'Check: Visual Tests (vtest)'
on:
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }} ${{ github.event_name }} ${{ github.ref }}
cancel-in-progress: true
jobs:
setup:
name: "Setup VTests workflow"
runs-on: ubuntu-slim
outputs:
do_run: ${{ steps.output_data.outputs.do_run }}
reference_ref: ${{ steps.output_data.outputs.reference_ref }}
artifact_name: ${{ steps.output_data.outputs.artifact_name }}
steps:
- name: Clone repository
uses: actions/checkout@v7
with:
submodules: recursive
sparse-checkout: buildscripts/ci/tools/make_build_number.sh
- name: "Configure workflow"
run: |
bash ./buildscripts/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
- name: Get reference commit for PR
if: github.event_name == 'pull_request'
env:
pull_request_title: ${{ github.event.pull_request.title }}
REFERENCE_REF: ${{ github.event.pull_request.base.ref }}
run: |
if [ -z "$REFERENCE_REF" ]; then DO_RUN='false'; else DO_RUN='true'; fi
echo "REFERENCE_REF=$REFERENCE_REF" >> $GITHUB_ENV
echo "DO_RUN=$DO_RUN" >> $GITHUB_ENV
echo "PR_INFO= ${{ github.event.pull_request.number }} ${pull_request_title}" >> $GITHUB_ENV
- name: Get reference commit for push commit
if: github.event_name == 'push'
run: |
REFERENCE_REF=${{ github.event.before }}
if [[ -z "$REFERENCE_REF" || "$REFERENCE_REF" == 0000000000000000000000000000000000000000 ]]; then
DO_RUN='false'
else
DO_RUN='true'
fi
echo "REFERENCE_REF=$REFERENCE_REF" >> $GITHUB_ENV
echo "DO_RUN=$DO_RUN" >> $GITHUB_ENV
echo "PR_INFO=" >> $GITHUB_ENV
- id: output_data
name: Output workflow data
run: |
echo "do_run=${DO_RUN}" | tee -a $GITHUB_OUTPUT
echo "reference_ref=${REFERENCE_REF}" | tee -a $GITHUB_OUTPUT
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"VTests Comparison ${BUILD_NUMBER}${PR_INFO}")"
echo "artifact_name=$UPLOAD_ARTIFACT_NAME" | tee -a $GITHUB_OUTPUT
build_current:
name: "Build current"
runs-on: ubuntu-24.04
needs: setup
if: needs.setup.outputs.do_run == 'true'
steps:
- name: Clone repository
uses: actions/checkout@v7
with:
submodules: recursive
- parallel:
- name: Restore ccache files
id: restore-ccache
uses: actions/cache/restore@v6
with:
path: ${{ github.workspace }}/.ccache
key: ${{runner.os}}-${{runner.arch}}-vtests-current-ccache-
restore-keys: |
${{runner.os}}-${{runner.arch}}-vtests-current-ccache-
${{runner.os}}-${{runner.arch}}-vtests-reference-ccache-
- name: Setup ccache
run: |
sudo apt-get install -y ccache
bash ./buildscripts/ci/tools/setup_ccache_config.sh
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 6.10.2
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
modules: 'qt5compat qtnetworkauth qtshadertools qtwebsockets'
cache: true
- name: Setup environment
run: |
bash ./buildscripts/ci/linux/setup.sh
- name: Build and Pack
run: |
bash ./buildscripts/ci/vtests/build_and_pack.sh
- name: Show ccache stats
run: |
ccache -sv
- name: Upload
uses: actions/upload-artifact@v7
with:
name: current_build
path: ./build.artifacts/
- name: Prepare ccache files for saving
id: prepare-save-ccache
if: always()
run: |
ccache --recompress 10
echo "CCACHE_TIMESTAMP=$(date -u +"%F-%T")" | tee -a $GITHUB_OUTPUT
- name: Save ccache files
if: always()
uses: actions/cache/save@v6
with:
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}${{ steps.prepare-save-ccache.outputs.CCACHE_TIMESTAMP }}
path: ${{ github.workspace }}/.ccache
build_reference:
name: "Build reference"
runs-on: ubuntu-24.04
needs: setup
if: needs.setup.outputs.do_run == 'true'
steps:
- name: Clone repository and checkout reference commit
uses: actions/checkout@v7
with:
ref: ${{ needs.setup.outputs.reference_ref }}
submodules: recursive
- parallel:
- name: Restore ccache files
id: restore-ccache
uses: actions/cache/restore@v6
with:
path: ${{ github.workspace }}/.ccache
key: ${{runner.os}}-${{runner.arch}}-vtests-reference-ccache-
restore-keys: |
${{runner.os}}-${{runner.arch}}-vtests-reference-ccache-
${{runner.os}}-${{runner.arch}}-vtests-current-ccache-
- name: Setup ccache
run: |
sudo apt-get install -y ccache
bash ./buildscripts/ci/tools/setup_ccache_config.sh
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 6.10.2
host: 'linux'
target: 'desktop'
arch: 'linux_gcc_64'
modules: 'qt5compat qtnetworkauth qtshadertools qtwebsockets'
cache: true
- name: Setup environment
run: |
bash ./buildscripts/ci/linux/setup.sh
- name: Build and Pack
run: |
bash ./buildscripts/ci/vtests/build_and_pack.sh
- name: Show ccache stats
run: |
ccache -sv
- name: Upload
uses: actions/upload-artifact@v7
with:
name: reference_build
path: ./build.artifacts/
- name: Prepare ccache files for saving
id: prepare-save-ccache
if: always()
run: |
ccache --recompress 10
echo "CCACHE_TIMESTAMP=$(date -u +"%F-%T")" | tee -a $GITHUB_OUTPUT
- name: Save ccache files
if: always()
uses: actions/cache/save@v6
with:
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}${{ steps.prepare-save-ccache.outputs.CCACHE_TIMESTAMP }}
path: ${{ github.workspace }}/.ccache
generate_and_compare:
name: "Generate and Compare"
runs-on: ubuntu-24.04
needs: [setup, build_current, build_reference]
if: needs.setup.outputs.do_run == 'true'
steps:
- name: Clone repository
uses: actions/checkout@v7
with:
submodules: recursive
- parallel:
- name: Setup environment
run: |
sudo apt-get install libegl1 imagemagick -y
echo "ASAN_OPTIONS=detect_leaks=0" >> $GITHUB_ENV
echo "QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV
echo "MU_QT_QPA_PLATFORM=offscreen" >> $GITHUB_ENV
- name: Download reference
uses: actions/download-artifact@v8
with:
name: reference_build
path: ./vtests_reference
- name: Download current
uses: actions/download-artifact@v8
with:
name: current_build
path: ./vtests_current
- parallel:
- name: Generate reference PNGs
run: |
./buildscripts/ci/vtests/generate_pngs.sh ./vtests_reference
- name: Generate current PNGs
run: |
./buildscripts/ci/vtests/generate_pngs.sh ./vtests_current
- name: Compare PNGs
run: |
echo "VTEST_DIFF_FOUND=false" >> $GITHUB_ENV
./vtest/vtest-compare-pngs.sh --ci 1 -c vtests_current/pngs -r vtests_reference/pngs -o ./comparison
- name: Compare PNGs small
run: |
./vtest/vtest-compare-pngs.sh --ci 1 -c ./vtests_current/pngs_small -r ./vtests_reference/pngs_small -o ./comparison/small
- name: Compare PNGs gp
run: |
./vtest/vtest-compare-pngs.sh --ci 1 -c ./vtests_current/pngs_gp_small -r ./vtests_reference/pngs_gp_small -o ./comparison/gp
- name: Upload comparison
if: env.VTEST_DIFF_FOUND == 'true'
uses: actions/upload-artifact@v7
with:
name: ${{ needs.setup.outputs.artifact_name }}
path: ./comparison
#- name: Generate ref drawdata
# run: |
# chmod +x ./musescore_reference/app/bin/mscore4portable
# xvfb-run ./vtest/gen-ref-data.sh -m ./musescore_reference/app/bin/mscore4portable
#- name: DrawData VTest
# run: |
# chmod +x ./musescore_current/app/bin/mscore4portable
# xvfb-run ./vtest/vtest.sh -m ./musescore_current/app/bin/mscore4portable
# - name: Skip failure signal if PR is labeled 'vtests'
# if: github.event_name == 'pull_request' && contains( env.VTEST_DIFF_FOUND, 'true') && contains(github.event.pull_request.labels.*.name, 'vtests')
# run: |
# echo "This PR appears to change some of the visual tests."
# echo "Please carefully review the new visual test results in the uploaded artifact that can be found here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# echo "Failure signal skipped because 'vtests' label is applied to the PR"
# export VTEST_DIFF_FOUND=false
# echo "VTEST_DIFF_FOUND=$VTEST_DIFF_FOUND" >> $GITHUB_ENV
- name: Emit failure signal for PR if differences are found
if: github.event_name == 'pull_request' && contains( env.VTEST_DIFF_FOUND, 'true')
run: |
echo "This PR appears to change some of the visual tests."
echo "Please carefully review the new visual test results in the uploaded artifact that can be found here: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
exit 1
- name: Comment push commit
if: github.event_name == 'push' && contains( env.VTEST_DIFF_FOUND, 'true')
uses: peter-evans/commit-comment@v4.0.0
with:
body: |
This is an automatic message. This commit appears to change some of the visual tests.
Please carefully review the new visual test results in the uploaded artifact that can be found
[here][1]
[1]: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
token: ${{ secrets.GITHUB_TOKEN }}