-
Notifications
You must be signed in to change notification settings - Fork 1.2k
129 lines (111 loc) · 3.76 KB
/
ci-a11y-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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
name: Accessibility and Visual Regression Tests
on:
push:
branches:
- main
- next
paths:
- 'polaris-react/src/**'
- 'polaris-react/playground/**'
- 'polaris-react/.storybook/**'
- 'polaris-tokens/src/**'
pull_request:
paths:
- 'polaris-react/src/**'
- 'polaris-react/playground/**'
- 'polaris-react/.storybook/**'
- 'polaris-tokens/src/**'
jobs:
accessibility_test:
name: 'Accessibility test'
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
- name: Free up space on GitHub image
run: |
# Based on the official advice:
# https://github.com/actions/virtual-environments/issues/2840#issuecomment-790492173
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.5
- name: Setup Node from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Restore cache
uses: actions/cache@v3
with:
path: |
**/.turbo
node_modules/.cache/turbo
polaris-react/build-internal/cache
key: ${{ runner.os }}-accessibility-test-v2-${{ github.sha }}
restore-keys: |
${{ runner.os }}-accessibility-test-v2-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build --filter=@shopify/polaris
- name: Build Storybook
run: pnpm --filter=@shopify/polaris run storybook:build --quiet
- name: Run accessibility test
run: node ./polaris-react/scripts/accessibility-check.js
env:
STORYBOOK_DISABLE_DOCS: 1
visual_regression_test:
name: 'Visual regression test'
runs-on: ubuntu-latest
steps:
- name: Checkout branch
uses: actions/checkout@v3
with:
fetch-depth: 0 # Chromatic git history to track changes
- name: Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8.15.5
- name: Setup Node from .nvmrc
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: pnpm
- name: Restore cache
uses: actions/cache@v3
with:
path: |
**/.turbo
node_modules/.cache/turbo
polaris-react/build-internal/cache
key: ${{ runner.os }}-visual-regression-test-v2-${{ github.sha }}
restore-keys: |
${{ runner.os }}-visual-regression-test-v2-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm build --filter=@shopify/polaris
- name: Build Storybook
run: pnpm --filter=@shopify/polaris run storybook:build --quiet
env:
STORYBOOK_GITHUB_SHA: ${{ github.sha }}
STORYBOOK_GITHUB_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
STORYBOOK_GITHUB_PR: ${{ github.event.number }}
- name: Run Chromatic tests
uses: chromaui/action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
projectToken: ${{ secrets.CHROMATIC_PROJECT_TOKEN }}
autoAcceptChanges: 'main'
storybookBuildDir: 'polaris-react/build-internal/storybook/static'
exitZeroOnChanges: true
exitOnceUploaded: true
env:
STORYBOOK_GITHUB_SHA: ${{ github.sha }}
STORYBOOK_GITHUB_REPO_URL: ${{ github.server_url }}/${{ github.repository }}
STORYBOOK_GITHUB_PR: ${{ github.event.number }}