@@ -9,24 +9,14 @@ concurrency:
9
9
cancel-in-progress : true
10
10
11
11
jobs :
12
- update :
12
+ update-snapshots-runner :
13
13
if : ${{ github.event.label.name == 'update snapshots' }}
14
- name : ' Update snapshots'
15
- runs-on :
16
- labels : ubuntu-latest-16-cores
14
+ runs-on : ubuntu-latest
15
+ strategy :
16
+ matrix :
17
+ shard : [1, 2, 3, 4]
17
18
steps :
18
- - name : Generate token
19
- id : generate_token
20
- uses : actions/create-github-app-token@v1
21
- with :
22
- app-id : ${{ secrets.VRT_APP_ID }}
23
- private-key : ${{ secrets.VRT_PRIVATE_KEY }}
24
- - name : Checkout repository
25
- uses : actions/checkout@v4
26
- with :
27
- repository : ${{ github.event.pull_request.head.repo.full_name }}
28
- ref : ${{ github.head_ref }}
29
- token : ${{ steps.generate_token.outputs.token }}
19
+ - uses : actions/checkout@v4
30
20
- name : Set up Node
31
21
uses : actions/setup-node@v4
32
22
with :
52
42
sleep 5
53
43
working-directory : docs/storybook
54
44
- name : Run Visual Regression Tests
55
- run : npx playwright test --update-snapshots
45
+ run : npx playwright test --update-snapshots --shard="${{ matrix.shard }}/${{ strategy.job-total }}"
56
46
- name : Stop storybook
57
47
run : kill ${{ steps.storybook.outputs.pid }}
48
+ - name : Create snapshots.zip
49
+ run : |
50
+ if [[ ! -z $(git ls-files --others --exclude-standard --modified) ]]; then
51
+ git ls-files --others --exclude-standard --modified | zip snapshots -@
52
+ fi
53
+ - name : Upload snapshots
54
+ uses : actions/upload-artifact@v4
55
+ with :
56
+ name : snapshots-${{ matrix.shard }}
57
+ path : snapshots.zip
58
+ retention-days : 1
59
+ if-no-files-found : ignore
60
+
61
+ update :
62
+ name : ' Update snapshots'
63
+ needs : update-snapshots-runner
64
+ runs-on : ubuntu-latest
65
+ steps :
66
+ - name : Generate token
67
+ id : generate_token
68
+ uses : actions/create-github-app-token@v1
69
+ with :
70
+ app-id : ${{ secrets.VRT_APP_ID }}
71
+ private-key : ${{ secrets.VRT_PRIVATE_KEY }}
72
+ - name : Checkout repository
73
+ uses : actions/checkout@v4
74
+ with :
75
+ repository : ${{ github.event.pull_request.head.repo.full_name }}
76
+ ref : ${{ github.head_ref }}
77
+ token : ${{ steps.generate_token.outputs.token }}
78
+ - uses : actions/download-artifact@v4
79
+ with :
80
+ path : snapshots
81
+ pattern : snapshots-*
82
+ - run : |
83
+ for snapshots in snapshots/*/*.zip; do
84
+ unzip -o "$snapshots" -d .
85
+ done
86
+ rm -rf snapshots
58
87
- uses : stefanzweifel/git-auto-commit-action@v5
59
88
with :
60
89
commit_message : github-actions[bot] Regenerated snapshots
0 commit comments