-
Notifications
You must be signed in to change notification settings - Fork 535
75 lines (72 loc) · 2.13 KB
/
vrt.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
name: vrt
on:
pull_request:
types:
- labeled
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
update-snapshots:
if: contains(github.event.pull_request.labels.*.name, 'update snapshots')
runs-on: ubuntu-latest
steps:
- name: Save Pull Request info
run: |
mkdir PR
echo $NUMBER > ./PR/number
env:
NUMBER: ${{ github.event.number }}
- uses: actions/upload-artifact@v3
with:
name: pull-request
path: ./PR
retention-days: 1
upload-snapshots:
needs: update-snapshots
runs-on: ubuntu-latest-8-cores
strategy:
fail-fast: true
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- run: npm i -g npm@^10.5.1
- name: Install dependencies
run: npm ci
- name: Build storybook
run: npx storybook build
working-directory: packages/react
- name: Run storybook
id: storybook
run: |
npx serve -l 6006 packages/react/storybook-static &
pid=$!
echo "pid=$pid" >> $GITHUB_OUTPUT
sleep 5
- name: Run VRT
uses: docker://mcr.microsoft.com/playwright:v1.43.0-jammy
env:
STORYBOOK_URL: 'http://172.17.0.1:6006'
with:
args: npx playwright test --grep @vrt --update-snapshots --shard="${{ matrix.shard }}/${{ strategy.job-total }}"
- name: Stop storybook
if: ${{ always() }}
run: kill ${{ steps.storybook.outputs.pid }}
- name: Create snapshots.zip
run: |
if [[ ! -z $(git ls-files --others --exclude-standard --modified) ]]; then
git ls-files --others --exclude-standard --modified | zip snapshots -@
fi
- name: Upload snapshots
uses: actions/upload-artifact@v3
with:
name: snapshots-${{ matrix.shard }}
path: snapshots.zip
retention-days: 1
if-no-files-found: ignore