Added caching to workflow. #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run Unit Tests | ||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
branches: [main] | ||
jobs: | ||
unit-test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
name: Checkout repository 🫠 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
- uses: actions/cache@v3 | ||
id: npm-cache | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm ci | ||
- run: npm test | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup Node | ||
uses: actions/setup-node@v3 | ||
- uses: actions/cache@v3 | ||
id: npm-cache | ||
with: | ||
path: ~/.npm | ||
key: npm-${{ hashFiles('**/package-lock.json') }} | ||
- run: npm ci | ||
- run: npm run build |