-
Notifications
You must be signed in to change notification settings - Fork 0
68 lines (63 loc) · 1.73 KB
/
ci-api-build.and.test.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
name: API CI
on:
workflow_dispatch:
push:
branches:
- master
- 'feature/**'
- 'Feature/**'
- 'fix/*'
- 'Fix/*'
paths:
- 'api/**'
pull_request:
branches: [ master ]
paths:
- 'api/**'
jobs:
quality_profile:
runs-on: ubuntu-20.04
defaults:
run:
working-directory: api
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-java@v3
with:
java-version: 17
distribution: oracle
- uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run unit tests
run: mvn -f pom.xml clean package
- name: Cache SonarCloud packages
uses: actions/cache@v3
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
- name: Run Sonar Analysis
run: mvn -f pom.xml sonar:sonar
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=bcgov-sonarcloud
-Dsonar.projectKey=${{ secrets.SONAR_PROJECT_KEY }}
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Run Trivy vulnerability scanner in repo mode
uses: aquasecurity/trivy-action@0.10.0
with:
scan-type: 'fs'
ignore-unfixed: true
format: 'sarif'
output: 'trivy-results.sarif'
severity: 'CRITICAL'
- name: Upload Trivy scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: 'trivy-results.sarif'