-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
171 lines (168 loc) · 5.44 KB
/
tests.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
name: '🧪'
on:
push:
branches: [master]
paths-ignore: [CHANGELOG.md]
pull_request:
branches: [master]
paths-ignore: [CHANGELOG.md]
jobs:
prime-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
uses: ./.github/actions/cached-install
with:
node-version: 20.x
install-system-deps: false
- name: Build fabric.js
uses: ./.github/actions/build-fabric-cached
node-coverage:
needs: [prime-build]
runs-on: ubuntu-latest
name: Node 20.x ${{ matrix.suite }} tests
strategy:
fail-fast: false
matrix:
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# supported Node.js release schedule: https://nodejs.org/en/about/releases/
suite: [unit, visual]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
install-system-deps: false
- name: Build fabric.js
uses: ./.github/actions/build-fabric-cached
- name: Run ${{ matrix.suite }} tests with coverage
if: matrix.suite == 'unit'
run: npm run test:coverage && sleep 5
- name: Run ${{ matrix.suite }} tests with coverage
if: matrix.suite == 'visual'
run: npm run test:visual:coverage
- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.suite }}
path: .nyc_output/*.json
browser:
needs: [prime-build]
name: ${{ matrix.target }} ${{ matrix.suite }} tests
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
target: [chrome, firefox]
suite: [unit, visual]
fail-fast: false
steps:
- name: Unit tests on browser ${{ matrix.target }}
uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: ${{ matrix.node-version }}
- name: Build fabric.js
uses: ./.github/actions/build-fabric-cached
- name: Run ${{ matrix.target }} ${{ matrix.suite }} headless test
run: xvfb-run npm run test -- -c ${{ matrix.target }} -s ${{ matrix.suite }}
node:
needs: [prime-build]
runs-on: ubuntu-latest
name: Node ${{ matrix.node-version }} ${{ matrix.suite }} tests
strategy:
fail-fast: false
matrix:
# For more information see:
# https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# supported Node.js release schedule: https://nodejs.org/en/about/releases/
node-version: ['18.x']
suite: [unit, visual]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: ${{ matrix.node-version }}
install-system-deps: 'false'
- name: Build fabric.js
uses: ./.github/actions/build-fabric-cached
- name: Run ${{ matrix.suite }} tests
run: npm run test -- -c node -s ${{ matrix.suite }}
jest:
name: Jest tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
install-system-deps: false
- name: Run Jest unit test
run: npm run test:jest:coverage
- name: Upload test coverage
uses: actions/upload-artifact@v4
with:
name: coverage-jest
path: .nyc_output/*.json
e2e:
needs: [prime-build]
name: Playwright tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
- name: Build fabric.js
uses: ./.github/actions/build-fabric-cached
# Playwright suggests against caching the browser install
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Run Playwright tests
run: xvfb-run npm run test:e2e
- name: Upload Test Output
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-report
path: ./e2e/test-report/
- name: Upload Test Coverage
uses: actions/upload-artifact@v4
with:
name: coverage-e2e
path: ./e2e/test-results/**/coverage.json
coverage:
needs: [node-coverage, e2e]
name: Coverage reporting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 20.x
install-system-deps: false
- uses: actions/download-artifact@v4
with:
name: coverage-unit
path: .nyc_output
- uses: actions/download-artifact@v4
with:
name: coverage-visual
path: .nyc_output
- uses: actions/download-artifact@v4
with:
name: coverage-e2e
path: .nyc_output
- uses: actions/download-artifact@v4
with:
name: coverage-jest
path: .nyc_output
- run: ls -l .nyc_output
- run: npm run coverage:report
- uses: romeovs/lcov-reporter-action@v0.4.0
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
delete-old-comments: true