Skip to content
This repository was archived by the owner on Jul 8, 2022. It is now read-only.

Commit 5439485

Browse files
committed
added cache job to ci
1 parent 9bb33ea commit 5439485

2 files changed

Lines changed: 41 additions & 23 deletions

File tree

.github/workflows/node.js.yml

Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,43 @@
44
name: Node.js CI
55

66
on:
7-
push:
8-
branches: [ master ]
9-
pull_request:
10-
branches: [ master ]
7+
push:
8+
branches: [master]
9+
pull_request:
10+
branches: [master]
1111

1212
jobs:
13-
build:
14-
15-
runs-on: ubuntu-latest
16-
17-
strategy:
18-
matrix:
19-
node-version: [14.x]
20-
21-
steps:
22-
- uses: actions/checkout@v2
23-
- name: Use Node.js ${{ matrix.node-version }}
24-
uses: actions/setup-node@v2
25-
with:
26-
node-version: ${{ matrix.node-version }}
27-
cache: 'npm'
28-
- run: npm install
29-
- run: npm run build --if-present
30-
- run: npm test
13+
build:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
matrix:
18+
node-version: [14.x]
19+
20+
steps:
21+
- uses: actions/checkout@v2
22+
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v2
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: "npm"
28+
29+
- name: cache node modules
30+
uses: actions/cache@v2
31+
env:
32+
cache-name: cache-node-modules
33+
with:
34+
path: ~/.npm
35+
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
36+
restore-keys: |
37+
${{ runner.os }}-build-${{ env.cache-name }}-
38+
${{ runner.os }}-build-
39+
${{ runner.os }}-
40+
41+
- name: Install Dependencies
42+
run: npm install
43+
- name: Build
44+
run: npm run build --if-present
45+
- name: Test
46+
run: npm test

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"dev": "NODE_ENV=development nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/server.ts",
99
"prebuild": "rm -rf dist/ && prettier --write src/",
1010
"build": "tsc",
11-
"test": "NODE_ENV=test jest --forceExit --coverage --verbose"
11+
"test": "NODE_ENV=test jest --forceExit --coverage --verbose",
12+
"publish": "git push heroku master",
13+
"log": "heroku log -t"
1214
},
1315
"devDependencies": {
1416
"@types/axios": "^0.14.0",

0 commit comments

Comments
 (0)