-
-
Notifications
You must be signed in to change notification settings - Fork 143
71 lines (57 loc) · 1.85 KB
/
node.js.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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs
# https://github.com/actions/starter-workflows/blob/main/ci/node.js.yml
name: Node.js CI
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version:
- current
- 22.x
- 20.x
- 18.x
- 16.x
- 14.x
steps:
- uses: actions/checkout@v4
- id: setup-node
name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- id: node-v
name: Output Node.js version
run: echo "version=$(node -v)" >> $GITHUB_OUTPUT
- id: node-version
name: Parse Node.js version
uses: apexskier/github-semver-parse@v1
with:
version: ${{ steps.node-v.outputs.version }}
- env:
N_MAJOR: ${{steps.node-version.outputs.major}}
N_MINOR: ${{steps.node-version.outputs.minor}}
run: echo "node - $N_MAJOR $N_MINOR"
- id: npm-v
name: Output npm version
run: echo "version=$(npm -v)" >> $GITHUB_OUTPUT
- id: npm-version
name: Parse npm version
uses: apexskier/github-semver-parse@v1
with:
version: ${{ steps.npm-v.outputs.version }}
- env:
N_MAJOR: ${{steps.npm-version.outputs.major}}
N_MINOR: ${{steps.npm-version.outputs.minor}}
run: echo "npm - $N_MAJOR $N_MINOR"
- run: npm ci
if: matrix.node-version >= '16'
- run: npm install
if: matrix.node-version < '16'
- run: npm test