88 paths-ignore : [CHANGELOG.md]
99
1010jobs :
11+ prime-build :
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v3
15+ - name : Install dependencies
16+ uses : ./.github/actions/cached-install
17+ with :
18+ node-version : 18.x
19+ install-system-deps : true
20+ - name : Build fabric.js
21+ uses : ./.github/actions/build-fabric-cached
22+ node-coverage :
23+ needs : [prime-build]
24+ runs-on : ubuntu-latest
25+ name : Node 18.x ${{ matrix.suite }} tests
26+ strategy :
27+ fail-fast : false
28+ matrix :
29+ # For more information see:
30+ # https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
31+ # supported Node.js release schedule: https://nodejs.org/en/about/releases/
32+ suite : [unit, visual]
33+ steps :
34+ - uses : actions/checkout@v3
35+ - uses : ./.github/actions/cached-install
36+ with :
37+ node-version : 18.x
38+ install-system-deps : true
39+ - name : Build fabric.js
40+ uses : ./.github/actions/build-fabric-cached
41+ - name : Run ${{ matrix.suite }} tests with coverage
42+ if : matrix.suite == 'unit'
43+ run : npm run test:coverage
44+ - name : Run ${{ matrix.suite }} tests with coverage
45+ if : matrix.suite == 'visual'
46+ run : npm run test:visual:coverage
47+ - name : Upload test coverage
48+ uses : actions/upload-artifact@v3
49+ with :
50+ name : coverage-${{ matrix.suite }}
51+ path : .nyc_output/*.json
1152 browser :
53+ needs : [prime-build]
1254 name : ${{ matrix.target }} ${{ matrix.suite }} tests
1355 runs-on : ubuntu-latest
1456 strategy :
@@ -18,18 +60,19 @@ jobs:
1860 suite : [unit, visual]
1961 fail-fast : false
2062 steps :
21- - uses : actions/checkout@v2
22- - name : Unit tests on Chrome
23- uses : actions/setup-node@v1
63+ - name : Unit tests on browser ${{ matrix.target }}
64+ uses : actions/checkout@v3
65+ - uses : ./.github/ actions/cached-install
2466 with :
2567 node-version : ${{ matrix.node-version }}
26- - run : npm ci
27- - run : npm run build -- -f
68+ - name : Build fabric.js
69+ uses : ./.github/actions/ build-fabric-cached
2870 - name : Run ${{ matrix.target }} ${{ matrix.suite }} headless test
29- uses : GabrielBB/xvfb-action @v1
71+ uses : coactions/setup-xvfb @v1
3072 with :
3173 run : npm run test -- -c ${{ matrix.target }} -s ${{ matrix.suite }}
3274 node :
75+ needs : [prime-build]
3376 runs-on : ubuntu-latest
3477 name : Node ${{ matrix.node-version }} ${{ matrix.suite }} tests
3578 strategy :
@@ -38,32 +81,56 @@ jobs:
3881 # For more information see:
3982 # https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
4083 # supported Node.js release schedule: https://nodejs.org/en/about/releases/
41- node-version : [14.x, 16.x, 18 .x]
84+ node-version : [14.x, 16.x, 20 .x]
4285 suite : [unit, visual]
4386 steps :
44- - uses : actions/checkout@v2
45- - name : Install node-canvas
46- run : sudo apt-get install libgif-dev libpng-dev libpango1.0-dev libjpeg8-dev librsvg2-dev libcairo2-dev
47- - name : Use Node.js ${{ matrix.node-version }}
48- uses : actions/setup-node@v1
87+ - uses : actions/checkout@v3
88+ - uses : ./.github/actions/cached-install
4989 with :
5090 node-version : ${{ matrix.node-version }}
51- - run : npm ci
52- - name : Build
53- run : npm run build -- -f
91+ install-system-deps : true
92+ - name : Build fabric.js
93+ uses : ./.github/actions/ build-fabric-cached
5494 - name : Run ${{ matrix.suite }} tests
5595 run : npm run test -- -c node -s ${{ matrix.suite }}
5696 jest :
5797 name : Jest tests
5898 runs-on : ubuntu-latest
5999 steps :
60- - uses : actions/checkout@v2
61- - name : Install node-canvas
62- run : sudo apt-get install libgif-dev libpng-dev libpango1.0-dev libjpeg8-dev librsvg2-dev libcairo2-dev
63- - name : Use Node.js v18
64- uses : actions/setup-node@v1
100+ - uses : actions/checkout@v3
101+ - uses : ./.github/actions/cached-install
65102 with :
66- node-version : 18
67- - run : npm ci
103+ node-version : 18.x
104+ install-system-deps : true
68105 - name : Run Jest unit test
69- run : npm run test:jest
106+ run : npm run test:jest:coverage
107+ - name : Upload test coverage
108+ uses : actions/upload-artifact@v3
109+ with :
110+ name : coverage-jest
111+ path : .nyc_output/*.json
112+ coverage :
113+ needs : [node-coverage]
114+ name : Coverage reporting
115+ runs-on : ubuntu-latest
116+ steps :
117+ - uses : actions/checkout@v3
118+ - uses : ./.github/actions/cached-install
119+ with :
120+ node-version : 18.x
121+ install-system-deps : false
122+ - uses : actions/download-artifact@v3
123+ with :
124+ name : coverage-unit
125+ path : .nyc_output
126+ - uses : actions/download-artifact@v3
127+ with :
128+ name : coverage-visual
129+ path : .nyc_output
130+ - run : ls -l .nyc_output
131+ - run : npm run coverage:report
132+ -
uses :
ShaMan123/[email protected] 133+ with :
134+ github-token : ${{ secrets.GITHUB_TOKEN }}
135+ delete-old-comments : true
136+ update-comment : true
0 commit comments