-
Notifications
You must be signed in to change notification settings - Fork 0
180 lines (174 loc) · 5.16 KB
/
main.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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
name: CI
on:
push:
branches:
- "**"
pull_request:
branches:
- "**"
jobs:
build:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm install -g npm@latest
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
- name: Build for production
run: npm run build
- name: Upload build
uses: actions/upload-artifact@v2
with:
name: dist
path: ./dist
unit_tests:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm install -g npm@latest
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm ci
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true
- name: Run unit tests
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
command: npm test unit
e2e_tests_ubuntu:
needs: build
runs-on: ubuntu-18.04
strategy:
matrix:
browser: [chromium, firefox]
device: [desktop, mobile]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm install -g npm@latest
- uses: microsoft/playwright-github-action@v1
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm ci
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Run e2e tests ${{ matrix.browser }} ${{ matrix.device }}
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
# command: npm test e2e
command: npm test e2e -- -u
env:
BROWSER: ${{ matrix.browser }}
DEVICE: ${{ matrix.device }}
TEST_WITH_DIST: true
- name: Upload Screenshots
uses: actions/upload-artifact@v2
with:
name: ci_linux-${{ matrix.browser }}-${{ matrix.device }}
path: ./test/e2e/__image_snapshots__/ci_linux
e2e_tests_macos:
needs: build
runs-on: macOS-10.15
strategy:
matrix:
browser: [webkit]
device: [desktop, mobile]
steps:
- uses: actions/checkout@v2
- name: Setup Node.js environment
uses: actions/setup-node@v2
with:
node-version: 14.x
- run: npm install -g npm@latest
- uses: microsoft/playwright-github-action@v1
- uses: actions/cache@v2
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-
- run: npm ci
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Run e2e tests ${{ matrix.browser }} ${{ matrix.device }}
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
# command: npm test e2e
command: npm test e2e -- -u
env:
BROWSER: ${{ matrix.browser }}
DEVICE: ${{ matrix.device }}
TEST_WITH_DIST: true
- name: Upload Screenshots
uses: actions/upload-artifact@v2
with:
name: ci_darwin-${{ matrix.browser }}-${{ matrix.device }}
path: ./test/e2e/__image_snapshots__/ci_darwin
# deploy:
# if: github.event_name == 'push' && github.ref == 'refs/heads/main'
# needs: [build, unit_tests, e2e_tests_ubuntu, e2e_tests_macos]
# runs-on: ubuntu-18.04
# steps:
# - name: Download build
# uses: actions/download-artifact@v2
# with:
# name: dist
# path: dist
# - name: Deploy to Netlify
# uses: netlify/actions/cli@master
# with:
# args: deploy --prod --dir=dist
# env:
# NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
# NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
deploy_preview:
if: github.event_name == 'pull_request'
needs: build
runs-on: ubuntu-18.04
steps:
- name: Download build
uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Deploy preview to Netlify
uses: netlify/actions/cli@master
with:
args: deploy --dir=dist
env:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}