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

Commit

Permalink
added cache job to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
celeroncoder committed Sep 19, 2021
1 parent 9bb33ea commit 5439485
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
60 changes: 38 additions & 22 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,43 @@
name: Node.js CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm install
- run: npm run build --if-present
- run: npm test
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: "npm"

- name: cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build --if-present
- name: Test
run: npm test
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
"dev": "NODE_ENV=development nodemon --watch 'src/**/*.ts' --exec 'ts-node' src/server.ts",
"prebuild": "rm -rf dist/ && prettier --write src/",
"build": "tsc",
"test": "NODE_ENV=test jest --forceExit --coverage --verbose"
"test": "NODE_ENV=test jest --forceExit --coverage --verbose",
"publish": "git push heroku master",
"log": "heroku log -t"
},
"devDependencies": {
"@types/axios": "^0.14.0",
Expand Down

0 comments on commit 5439485

Please sign in to comment.