This repository has been archived by the owner on Mar 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
67 lines (61 loc) · 1.86 KB
/
unit-tests.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
name: Unit Tests and Analysis
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- main
paths-ignore:
- "**.md"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Note: Testing only - don't use the same SONAR_TOKEN twice!
tests:
name: Unit Tests
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-latest
strategy:
matrix:
dir: [backend, frontend]
steps:
- uses: actions/checkout@v3
- uses: bcgov-nr/[email protected]
with:
commands: |
npm ci
npm run test:cov
dir: ${{ matrix.dir }}
repository: bcgov/nr-quickstart-typescript
sonar_args: >
-Dsonar.exclusions=**/coverage/**
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=bcgov_nr-quickstart-helpers
sonar_comment_token: ${{ secrets.GITHUB_TOKEN }}
sonar_project_token: ${{ secrets.SONAR_TOKEN }}
# https://github.com/marketplace/actions/aqua-security-trivy
trivy:
name: Trivy Security Scan
if: github.event_name != 'pull_request' || !github.event.pull_request.draft
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/[email protected]
with:
format: "sarif"
output: "trivy-results.sarif"
ignore-unfixed: true
scan-type: "fs"
security-checks: "vuln,secret,config"
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: "trivy-results.sarif"