-
Notifications
You must be signed in to change notification settings - Fork 1
56 lines (45 loc) · 1.51 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
name: Test
on:
workflow_call:
inputs:
node-version:
description: Node.js version
required: false
default: '["14", "16", "18"]'
type: string
os:
description: OS name
required: false
default: '["ubuntu-latest"]'
type: string
jobs:
test:
name: Test on Node.js ${{ matrix.node-version }} and ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
# NOTE: The `strategy` property is not fully supported, so it uses `fromJson()`.
# For details, see https://github.community/t/reusable-workflow-with-strategy-matrix/205676/2
node-version: ${{ fromJson(inputs.node-version) }}
os: ${{ fromJson(inputs.os) }}
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
# HACK: See https://github.com/npm/cli/issues/4341
- name: Workaround for npm installation failure on Node.js 14 and Windows
if: ${{ startsWith(matrix.node-version, '14') && startsWith(matrix.os, 'windows') }}
run: npm install --global npm@8.3
- name: Install latest npm
run: npm install --global npm@latest && npm --version
- name: Install dependencies
run: npm ci
- name: Test
run: npm test --ignore-scripts