forked from NUWCDIVNPT/stigman-watcher
-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (42 loc) · 1.05 KB
/
unit-testing.yml
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
32
33
34
35
36
37
38
39
40
41
42
name: Run Unit Tests and Upload Coverage Artifact
on:
workflow_dispatch:
push:
branches:
- main
- update-actions-versions
paths:
- "lib/**"
- "index.js"
- "test/**"
- ".github/workflows/unit-testing.yml"
pull_request:
branches:
- main
paths:
- "lib/**"
- "index.js"
- "test/**"
- ".github/workflows/unit-testing.yml"
jobs:
build_test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20.x"
- name: Install app dependencies
run: npm ci
- name: Create .env file
run: echo -e "WATCHER_COLLECTION=1\nWATCHER_API_BASE=url\nWATCHER_AUTHORITY=auth\nWATCHER_CLIENT_ID=clientId\nWATCHER_CLIENT_SECRET=secret" > .env
- name: Run tests
run: npm test
- name: Upload coverage to github
uses: actions/upload-artifact@v4
if: ${{ always() }}
with:
name: coverage
path: coverage