generated from bcgov/quickstart-openshift
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (76 loc) · 2.56 KB
/
analysis.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Analysis
on:
push:
branches: [main]
pull_request:
types: [opened, reopened, synchronize, ready_for_review, converted_to_draft]
schedule:
- cron: "0 11 * * 0" # 3 AM PST = 12 PM UDT, runs sundays
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Typescript lint
runs-on: ubuntu-24.04
steps:
- uses: bcgov-nr/[email protected]
with:
commands: |
npm ci
npm run lint
dir: frontend
node_version: "20"
tests:
name: Java CI
if: ${{ ! github.event.pull_request.draft }}
runs-on: ubuntu-24.04
strategy:
matrix:
dir: [backend, oracle-api]
include:
- dir: backend
token: SONAR_BACKEND
- dir: oracle-api
token: SONAR_ORACLE_API
steps:
- uses: bcgov-nr/[email protected]
with:
commands: mvn --no-transfer-progress clean compile verify package checkstyle:checkstyle -P all-tests
dir: ${{ matrix.dir }}
java-cache: maven
java-distribution: temurin
java-version: "17"
sonar_args:
-Dsonar.organization=bcgov-sonarcloud -Dsonar.projectKey=nr-spar_${{ matrix.dir }}
-Dsonar.coverage.jacoco.xmlReportPaths=target/coverage-reports/merged-test-report/jacoco.xml
-Dsonar.exclusions=**/config/**,*/dto/**,**/entity/**,**/exception/**,**/filter/**,**/interceptor/**,**/response/**,**/**Builder*,**/RestExceptionEndpoint.*,**/BackendStartApiApplication.*
sonar_token: ${{ secrets[matrix.token] }}
# https://github.com/marketplace/actions/aqua-security-trivy
trivy:
name: Security Scan
if: ${{ ! github.event.pull_request.draft }}
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- 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"
scanners: "vuln,secret,config"
severity: "CRITICAL,HIGH"
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: "trivy-results.sarif"
results:
name: Analysis Results
if: always() && (!failure()) && (!cancelled())
needs: [lint, tests, trivy]
runs-on: ubuntu-24.04
steps:
- run: echo "Workflow completed successfully!"