Skip to content

Commit a9bcb88

Browse files
committed
ci(actions): update workflow
1 parent 7d3097d commit a9bcb88

File tree

1 file changed

+39
-7
lines changed

1 file changed

+39
-7
lines changed

.github/workflows/nodejs.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
1+
12
name: nodejs
23

34
on:
45
push:
5-
pull_request:
6+
paths:
7+
- '**/**'
8+
- '!**/docs/**'
9+
10+
11+
env:
12+
CI: true
13+
FORCE_COLOR: 2
14+
615

716
jobs:
8-
build:
9-
runs-on: ubuntu-latest
17+
run:
18+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
19+
runs-on: ${{ matrix.os }}
1020

1121
strategy:
22+
fail-fast: false
1223
matrix:
13-
node-version: ["10", "12", "14"]
24+
node: ["10.x", "12.x", "14.x"]
25+
os: ["ubuntu-latest"]
1426

1527
steps:
16-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v2.3.4
1729
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v1
30+
uses: actions/setup-node@v2.1.4
1931
with:
2032
node-version: ${{ matrix.node-version }}
21-
- run: npm install
33+
34+
35+
- name: Get npm cache directory
36+
id: npm-cache-dir
37+
run: |
38+
echo "::set-output name=dir::$(npm config get cache)"
39+
- uses: actions/cache@v2
40+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
41+
with:
42+
path: ${{ steps.npm-cache-dir.outputs.dir }}
43+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-node-
46+
47+
48+
- name: npm install, build, and test
49+
run: |
50+
npm install
51+
npm run ci
52+
env:
53+
CI: true

0 commit comments

Comments
 (0)