-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
177 lines (174 loc) · 5.7 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
172
173
174
175
176
177
name: '🧪'
on:
push:
branches: [master]
paths-ignore: [CHANGELOG.md]
pull_request:
branches: [master]
paths-ignore: [CHANGELOG.md]
jobs:
prime-build:
runs-on: ubuntu-24.04
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-24.04
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: Verify coverage files
run: ls -l ./.nyc_output/*.json
- name: Upload test coverage ${{ matrix.suite }}
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.suite }}
path: ./.nyc_output/*.json
include-hidden-files: true
browser:
needs: [prime-build]
name: ${{ matrix.target }} ${{ matrix.suite }} tests
runs-on: ubuntu-24.04
strategy:
matrix:
node-version: [20]
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-24.04
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, 22]
suite: [unit, visual]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: ${{ matrix.node-version }}
install-system-deps: ${{ matrix.node-version >= 22 }}
- 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-24.04
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
include-hidden-files: true
e2e:
needs: [prime-build]
name: Playwright tests
runs-on: ubuntu-24.04
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/
include-hidden-files: true
- name: Upload Test Coverage
uses: actions/upload-artifact@v4
with:
name: coverage-e2e
path: ./e2e/test-results/**/coverage.json
include-hidden-files: true
coverage:
needs: [node-coverage, e2e]
name: Coverage reporting
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/cached-install
with:
node-version: 18.x
install-system-deps: false
- uses: actions/download-artifact@v4
with:
name: coverage-e2e
path: ./.nyc_output
- uses: actions/download-artifact@v4
with:
name: coverage-jest
path: ./.nyc_output
- uses: actions/download-artifact@v4
with:
name: coverage-unit
path: ./.nyc_output
- uses: actions/download-artifact@v4
with:
name: coverage-visual
path: ./.nyc_output
- run: ls -l ./.nyc_output
- run: npm run coverage:report
- uses: romeovs/[email protected]
if: github.event_name == 'pull_request' || github.event_name == 'pull_request_target'
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
delete-old-comments: true