-
Notifications
You must be signed in to change notification settings - Fork 4
67 lines (64 loc) · 2.06 KB
/
ci.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: code-and-dependencies-analysis
on:
pull_request:
types:
- opened
- synchronize
- reopened
- ready_for_review
jobs:
verify:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: "npm"
- name: Install project
run: npm ci
- name: Verify project
run: npm run test-ci
- name: Jest coverage comment
uses: MishaKav/jest-coverage-comment@main
- name: Build project
run: npm run build
- name: Get branch name
id: branch-name
uses: tj-actions/branch-names@v6
- name: Analyze build code
uses: sonarsource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.organization=littil
-Dsonar.projectKey=littil-frontend
-Dsonar.sources=src/app
-Dsonar.tests=src/app
-Dsonar.test.inclusions=**/*.spec.ts
-Dsonar.branch.target=${{ steps.branch-name.outputs.base_ref_branch}}
-Dsonar.branch.name=${{ steps.branch-name.outputs.head_ref_branch }}
security-scan:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run Snyk to check for vulnerabilities
uses: snyk/actions/node@master
env:
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
continue-on-error: true
with:
command: test --severity-threshold=high --sarif-file-output=snyk-report/snyk.sarif
- name: Upload result to GitHub Code Scanning
uses: github/codeql-action/upload-sarif@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
with:
sarif_file: snyk-report/snyk.sarif
category: Snyk