-
Notifications
You must be signed in to change notification settings - Fork 27
57 lines (47 loc) · 1.56 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
name: Jest unit tests
on:
pull_request:
types: [opened, synchronize]
concurrency:
group: jest-${{ github.ref }}
cancel-in-progress: true
jobs:
jest:
runs-on: ubuntu-latest
env:
CI: true
steps:
- name: Checkout
uses: actions/checkout@4
- name: Remove version from package-lock.json
run: jq 'del(.version, .packages[""].version)' package-lock.json > normalized-package-lock.json
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
cache-dependency-path: normalized-package-lock.json
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('package-lock.json') }}
- name: Run npm install
if: steps.cache-node-modules.outputs.cache-hit != 'true'
uses: nick-fields/retry@3f757583fb1b1f940bc8ef4bf4734c8dc02a5847
with:
timeout_minutes: 30
max_attempts: 3
command: npm ci
- name: Get number of CPU cores
id: cpu-cores
uses: SimenB/github-actions-cpu-cores@31e91de0f8654375a21e8e83078be625380e2b18
- name: Cache Jest cache
id: cache-jest-cache
uses: actions/cache@v4
with:
path: .jest-cache
key: ${{ runner.os }}-jest
- name: Run Jest tests
run: NODE_OPTIONS="$NODE_OPTIONS --experimental-vm-modules" npx jest --silent --max-workers ${{ steps.cpu-cores.outputs.count }}