forked from musescore/MuseScore
-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (107 loc) · 4.42 KB
/
check_visual_tests.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
name: 'Check: Visual Tests (vtests)'
on:
pull_request:
branches:
- 3.x
jobs:
run_vtests:
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Retrieve base commit for PR
if: github.event_name == 'pull_request'
run: |
export BASEREF=${{ github.event.pull_request.base.sha }}
if [ -z "$BASEREF" ]; then export found=0; else export found=1; fi
echo "BASEREF=$BASEREF" >> $GITHUB_ENV
echo "found=$found" >> $GITHUB_ENV
- name: Retrieve base commit for push commit
if: github.event_name == 'push'
run: |
export BASEREF=$( git show -s --pretty=%P ${{ github.sha }} | head -c 10 )
if [ -z "$BASEREF" ]; then export found=0; else export found=1; fi
echo "BASEREF=$BASEREF" >> $GITHUB_ENV
echo "found=$found" >> $GITHUB_ENV
- name: Setup the environment
if: contains( env.found, '1')
run: |
sudo bash ./build/ci/linux/setup.sh
- name: Build
if: contains( env.found, '1')
run: |
source ./../musescore_environment.sh
make installdebug CPUS=2 PREFIX="$HOME/software" COVERAGE=ON
- name: Build reference branch
if: contains( env.found, '1')
run: |
source ./../musescore_environment.sh
mkdir -p "$HOME/softwarebase"
git checkout $BASEREF
make clean
make installdebug CPUS=2 PREFIX="$HOME/softwarebase" COVERAGE=ON 2>/dev/null
- name: Run reference vtests
if: contains( env.found, '1')
run: |
source ./../musescore_environment.sh
cd vtest
export VTEST_MSCORE="$HOME/softwarebase/bin/mscore"
export VTEST_BROWSER=ls
export VTEST_DIR=$(pwd)
xvfb-run ./gen
- name: Run vtests
if: contains( env.found, '1')
run: |
source ./../musescore_environment.sh
git checkout -
cd vtest
mkdir -p compare
find ./html -name "*-1.png" -exec mv '{}' ./compare \;
rm -rf html 2>/dev/null
export VTEST_MSCORE="$HOME/software/bin/mscore"
export VTEST_BROWSER=ls
export VTEST_DIR=$(pwd)
xvfb-run ./gen
- name: Compare vtests
if: contains( env.found, '1')
run: |
source ./../musescore_environment.sh
cd vtest
export VTEST_DIR=$(pwd)
./gen_compare
- name: Upload artifact
if: contains( env.found, '1') && contains( env.VTEST_DIFF_FOUND, 'true')
uses: actions/upload-artifact@v4
with:
name: compare
path: ./vtest/compare
- name: Skip failure signal if PR is labeled 'vtests'
if: github.event_name == 'pull_request' && contains( env.found, '1') && 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.found, '1') && 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.found, '1') && contains( env.VTEST_DIFF_FOUND, 'true')
uses: peter-evans/[email protected]
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 }}