-
Notifications
You must be signed in to change notification settings - Fork 0
154 lines (133 loc) · 4.44 KB
/
verify.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
name: Verify
on:
push:
pull_request:
workflow_call:
secrets:
SONAR_TOKEN:
required: true
jobs:
verify:
runs-on: ubuntu-latest
env:
dependabot-run: ${{ github.actor == 'dependabot[bot]' }}
upload-dev-artifacts: ${{ github.ref != 'refs/heads/development' || github.event_name == 'pull_request' }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Sync PR with target
if: github.event_name == 'pull_request'
run: git merge origin/${{ github.event.pull_request.base.ref }} --no-commit
- name: Get branch names
id: branch-name
uses: tj-actions/branch-names@v8
- name: Use Java 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
check-latest: true
- name: Use Node 18
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.m2
~/.npm
./node_modules
./node
./nx
key: ${{ runner.os }}-deps-${{ github.run_id }}
restore-keys: |
${{ runner.os }}-deps-
${{ runner.os }}-
- name: Java Dependencies
working-directory: apps/api
run: mvn -B dependency:resolve dependency:resolve-plugins
- name: Node Dependencies
run: yarn install
- name: Format Check
run: npx nx format:check --all
- name: Lint
uses: MansaGroup/nrwl-nx-action@v3
with:
targets: lint
all: 'true'
parallel: 'true'
- name: Build
uses: MansaGroup/nrwl-nx-action@v3
with:
targets: build
all: 'true'
parallel: 'true'
- name: Test
uses: MansaGroup/nrwl-nx-action@v3
with:
targets: test
all: 'true'
parallel: 'true'
args: '--codeCoverage'
- name: Merge Test Reports
run: npm run test:merge
if: always()
- name: Frontend Test Execution Report
uses: frango9000/test-execution-report@v0.0.2
if: env.dependabot-run == 'false' && always()
with:
name: Frontend Tests
path: coverage/**/jest-junit.xml
reporter: jest-junit
fail-on-error: false
- name: Backend Test Execution Report
uses: frango9000/test-execution-report@v0.0.2
if: env.dependabot-run == 'false' && always()
with:
name: Backend Tests
path: apps/api/target/*-reports/merged-*ts.xml
reporter: java-junit
fail-on-error: false
- name: Coverage Report
uses: frango9000/test-coverage-report@v0.0.4
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "Application"
disable-comment: ${{ github.event_name == 'push' }} # Only post on pull request, not on commit
report-paths: |
apps/api/target/site/jacoco-*t/jacoco.xml
coverage/**/lcov.info
enable-build-fail: false
file-coverage-error-min: 60
file-coverage-warn-min: 70
report-coverage-error-min: 50
report-coverage-warn-min: 60
global-coverage-error-min: 40
global-coverage-warn-min: 50
- name: Upload Coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: apps/api/target/site/**/jacoco.xml,coverage/**/lcov.info
verbose: true
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@v2.1.1
if: env.dependabot-run == 'false'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Upload Development Backend Artifact
if: env.upload-dev-artifacts && env.dependabot-run == 'false'
uses: actions/upload-artifact@v4
with:
name: backend
path: apps/api/target/*.jar
- name: Upload Development Frontend Artifact
if: env.upload-dev-artifacts && env.dependabot-run == 'false'
uses: actions/upload-artifact@v4
with:
name: frontend
path: dist/apps/app