-
Notifications
You must be signed in to change notification settings - Fork 41
36 lines (34 loc) · 898 Bytes
/
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
---
name: Node.js CI
on:
push:
branches: [master]
pull_request:
branches: [master]
workflow_dispatch:
jobs:
build:
name: Node.js CI
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x, 16.x, 18.x, 20.x]
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Cache node_modules
id: cache-node-modules
uses: actions/cache@v4.2.0
with:
path: node_modules
key: node-modules-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }}
- name: npm Install
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm ci
- name: Run tests
run: npm test