-
Notifications
You must be signed in to change notification settings - Fork 14
31 lines (31 loc) · 1.1 KB
/
units-tests.yaml
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
name: unit testing
on:
push:
pull_request:
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
# Checks out code from Github.
- name: Checkout repo
uses: actions/checkout@v3
# Restore cache if available.
- name: Restore cached dependencies
id: dep-cache
uses: actions/cache@v3
env:
cache-name: jstoxml-cache
with:
path: node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
# Fully install from scratch when no cache is available.
- name: Install dependencies from scratch (cache miss only)
if: steps.dep-cache.outputs.cache-hit != 'true'
run: npm i
- name: Unit tests
run: npm test
shell: bash