-
Notifications
You must be signed in to change notification settings - Fork 12
70 lines (61 loc) · 2.04 KB
/
backstop-regression-testing.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
name: Backstop.js regression testing
on:
pull_request:
permissions: # https://github.com/EnricoMi/publish-unit-test-result-action/issues/161#issuecomment-905921434
contents: read
issues: write
pull-requests: write
checks: write
jobs:
backstop:
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
ref:
- ${{ github.base_ref }}
- ${{ github.head_ref }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ matrix.ref }}
- name: Compute variables
# See https://docs.github.com/en/actions/reference/workflow-commands-for-github-actions#environment-files
run: |
exec >> $GITHUB_ENV
if [ "$current_ref" = "$base_ref" ]; then
echo backstop_verb=reference
else
echo backstop_verb=test
fi
env:
current_ref: ${{ matrix.ref }}
base_ref: ${{ github.base_ref }}
- uses: actions/setup-node@v3
with:
cache: yarn
node-version: 16
# Work around https://github.com/yarnpkg/yarn/issues/4890
- name: Install dependencies
run: yarn --frozen-lockfile --network-timeout 1000000
- if: ${{ env.backstop_verb == 'test' }}
name: Download baseline Backstop results from previous run
uses: actions/download-artifact@v2
with:
name: backstop-report
path: tests/backstop
- name: Run Backstop
run: |
yarn start &
for retry in $(seq 1 6); do if ! curl --silent -o /dev/null http://localhost:3000/ ; then sleep 10; fi; done
node scripts/make_backstop_json.js
npx backstop ${{ env.backstop_verb }} --config=build/backstop.json || true
- uses: actions/upload-artifact@v2
with:
name: backstop-report
path: tests/backstop
- if: ${{ env.backstop_verb == 'test' }}
uses: EnricoMi/publish-unit-test-result-action@v1
with:
fail_on: nothing
files: tests/backstop/ci_report/xunit.xml