-
Notifications
You must be signed in to change notification settings - Fork 19
87 lines (85 loc) · 2.49 KB
/
cicd.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
76
77
78
79
80
81
82
83
84
85
86
87
name: CI/CD
on:
push:
paths-ignore:
- package.json
jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Install dependencies
run: yarn install --prefer-offline
- name: Build
run: yarn build
- name: Check definition files
run: yarn check-definition-files
- name: Lint
run: yarn lint
- name: Test
run: yarn test
visual-test:
name: visual-test (${{ matrix.shard }}/${{ strategy.job-total }})
strategy:
matrix:
shard: [1, 2, 3, 4]
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v1.29.0-focal
options: --user 1001
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Install dependencies
run: yarn install --prefer-offline
- name: Build storybook
run: yarn storybook:build:test
- name: Run Playwright tests
run: yarn start-server-and-test 'npx http-server ./storybook-static -p 6006' 6006 'npx playwright test --shard=${{ matrix.shard }}/${{ strategy.job-total }}'
- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
deploy:
needs: validate
if: startsWith(github.ref, 'refs/heads/feature/') || github.ref == 'refs/heads/v4'
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '16'
cache: 'yarn'
- name: Install dependencies
run: yarn install --prefer-offline
- name: Deploy to Chromatic
id: chromatic
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
buildScriptName: storybook:build
- name: Publish as comment
uses: mshick/add-pr-comment@v2
with:
message: |
Storybook Preview: ${{steps.chromatic.outputs.storybookUrl}}