forked from cloudscape-design/chart-components
-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (66 loc) · 1.91 KB
/
visual-regression.yml
File metadata and controls
70 lines (66 loc) · 1.91 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
name: Visual Regressions
on:
pull_request:
branches:
- main
push:
branches:
- main
merge_group:
permissions:
contents: read
actions: write
env:
VISUAL_REGRESSION_SNAPSHOT_DIRECTORY: "__image_snapshots__"
jobs:
test:
name: Run Tests
runs-on: ubuntu-latest
permissions:
contents: read
if: github.event.ref != 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- name: "Get reference run id"
run: |
echo "RUN_ID=`gh run --repo $GITHUB_REPOSITORY --branch main list --workflow "Visual Regressions" --json databaseId --jq .[0].databaseId`" >> $GITHUB_ENV
echo "Reference snapshots created in run ${RUN_ID}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v4
with:
name: visual-regression-snapshots
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ env.RUN_ID }}
path: ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}
- run: npm install
- run: npm run build
- run: npm run test:visual
- uses: actions/upload-artifact@v4
if: always()
with:
name: visual-regression-snapshots-results
path: ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}
update:
name: Update Snapshots
runs-on: ubuntu-latest
permissions:
contents: write
if: github.event.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
- run: npm install
- run: npm run build
- run: npm run test:visual:update
- uses: actions/upload-artifact@v4
with:
name: visual-regression-snapshots
path: ${{ env.VISUAL_REGRESSION_SNAPSHOT_DIRECTORY }}