-
Notifications
You must be signed in to change notification settings - Fork 12
72 lines (61 loc) · 2.43 KB
/
regressions.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
name: Visual Regression Tests
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: Install Dependencies
run: |
npm install -g backstopjs --unsafe-perm=true --allow-root
npm ci
./node_modules/.bin/lerna bootstrap
- name: Run Tests
run: |
nohup npm run larva > /dev/null 2>&1 &
sleep 5
npm run backstop -- test
env:
CI: true
- name: Archive Backstop results
uses: actions/upload-artifact@v2
if: always()
with:
name: backstop-results
path: backstop_data
- id: find-pull-request
uses: jwalton/gh-find-current-pr@v1
if: always()
with:
state: open
- name: Comment Regression test results on PR
uses: peter-evans/create-or-update-comment@v2
if: failure()
with:
token: ${{secrets.GITHUB_TOKEN}}
repository: ${{ github.repository }}
issue-number: ${{ steps.find-pull-request.outputs.pr }}
comment-author: 'github-actions[bot]'
body: |
### 🚨 Backstop Visual Regression Tests Failed: [View the results for ${{ github.sha }}](https://github.com/penske-media-corp/pmc-larva/actions/runs/${{ github.run_id }}).
<details>
<summary><strong>How to view and update regression tests</strong></summary>
1. <a href="https://github.com/penske-media-corp/pmc-larva/actions/runs/${{ github.run_id }}">View the failing build</a>.
2. Look under the section titled "Artifacts".
3. Download the `backstop-results` artifact.
4. On your local machine, open backstop-results/html-report/index.html in a browser to view the screenshot comparison.
#### 💍 When the results contain changes you want to retain
<p>
<a href="https://github.com/penske-media-corp/pmc-larva/actions/workflows/approval.yml">Run the Update Visual Regression Tests</a> workflow on this feature branch.
This will create a new branch with reference screenshots.
Then you will need to open a pull request to this branch to update it.
</p>
</details>