This repository has been archived by the owner on Nov 8, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (75 loc) · 2.21 KB
/
test.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
name: Test
on:
schedule:
- cron: "0 0 1 * *"
push:
branches:
- main
pull_request:
workflow_call:
jobs:
test:
name: Test
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
node-version:
- 14
- 16
- 18
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
- name: Setup up node modules cache
id: node-modules-cache
uses: actions/cache@v3
with:
path: '**/node_modules'
restore-keys: |
node-modules-cache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.node-version }}-
node-modules-cache-${{ runner.os }}-${{ runner.arch }}-
key: node-modules-cache-${{ runner.os }}-${{ runner.arch }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
cache: npm
node-version: ${{ matrix.node-version }}
- name: Install dependencies
if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }}
run: npm i --no-fund
- name: Check code styles
run: npm run lint
- name: Build CommonJS
run: npm run build
- name: Build ECMAScript
run: npm run build:esm
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@v1
- name: Test the project
run: npm run test:ci -- --maxWorkers ${{ steps.cpu-cores.outputs.count }}
- name: Upload coverage to CodeCov
uses: codecov/codecov-action@v3
if: ${{ github.event_name != 'schedule'}}
env:
OS: ${{ runner.os }}
ARCH: ${{ runner.arch }}
NODE_VERSION: ${{ matrix.node-version }}
REF: ${{ github.ref_name }}
with:
env_vars: OS,ARCH,NODE_VERSION,REF
fail_ci_if_error: true
test-summary:
name: Test Summary
needs:
- test
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Check test matrix status
if : ${{ needs.test.result != 'success' }}
run : exit 1