-
Notifications
You must be signed in to change notification settings - Fork 2
45 lines (42 loc) · 1.33 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
name: test
on:
- push
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: test
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
strategy:
fail-fast: false
matrix:
node:
- 18
- 20
- 22
- lts/*
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4.1.0
with:
node-version: ${{ matrix.node }}
- id: npm-cache
run: echo "dir=$(npm config get cache)" | tee -a "$GITHUB_OUTPUT"
- id: npm-cache-restore
uses: actions/cache/restore@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: npm-${{ hashFiles('package-lock.json') }}
restore-keys: |
npm-
- run: npm ci
- run: npm test
- uses: actions/cache/save@6849a6489940f00c2f30c0fb92c6274307ccb58a # v4.1.2
if: github.ref_name == 'main'
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ steps.npm-cache-restore.outputs.cache-primary-key }}