-
Notifications
You must be signed in to change notification settings - Fork 6
43 lines (34 loc) · 989 Bytes
/
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
name: Test
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
react-version: [16, 17, 18, 19]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# Add caching
- uses: actions/cache@v3
id: npm-cache
with:
path: node_modules
key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-${{ matrix.node-version }}-
# Only run npm ci if cache missed
- if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci
# Override React versions
- run: npm install --no-save react@^${{ matrix.react-version }} react-is@^${{ matrix.react-version }}
- run: npm test