-
Notifications
You must be signed in to change notification settings - Fork 0
152 lines (147 loc) · 5.26 KB
/
backend-checks.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
on:
workflow_call:
jobs:
check-formatting-backend:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: true
# NodeJS is used by prettier, which formats kotlin in spotless
# Using the latest LTS should work
- name: Setup NodeJS
uses: actions/setup-node@v4
with:
node-version-file: ./backend/.node-version
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "23.0"
distribution: "temurin"
cache: gradle
- name: Run spotlessCheck
working-directory: ./backend
run: ./gradlew spotlessCheck
- name: On failure send status to Slack
# only on failure and if on "main" branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
test-backend:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "23.0"
distribution: "temurin"
cache: gradle
- name: Run tests
run: ./gradlew test
working-directory: ./backend
- name: Upload test report artifact
uses: actions/upload-artifact@v4
with:
name: backend-test-report
path: backend/build/reports/tests/test
if-no-files-found: warn
- name: On failure send status to Slack
# only on failure and if on "main" branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
build-backend:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "23.0"
distribution: "temurin"
cache: gradle
- name: Build backend
run: ./gradlew build --profile -x test -x spotlessCheck
working-directory: ./backend
- name: Upload build performance report
uses: actions/upload-artifact@v4
with:
name: backend-build-performance-report
path: backend/build/reports/profile/profile*.html
- name: On failure send status to Slack
# only on failure and if on "main" branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
check-code-quality-with-sonarqube-backend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "23.0"
distribution: "temurin"
cache: gradle
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
- name: Scan with SonarQube
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
working-directory: ./backend
run: ./gradlew sonar --info
- name: Check SonarQube Quality Gate
uses: sonarsource/sonarqube-quality-gate-action@df914238f99aa5d81f4490aeea80f205c7ed9600
with:
scanMetadataReportFile: backend/build/sonar/report-task.txt
timeout-minutes: 3 # Force to fail step after specific time
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN_BACKEND }}
- name: On failure send status to Slack
# only on failure and if on "main" branch
if: ${{ failure() && github.ref == 'refs/heads/main' }}
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
check-licenses:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: "23.0"
distribution: "temurin"
cache: gradle
- name: Check licenses
working-directory: ./backend
run: ./gradlew checkLicense
- name: Upload licence report
uses: actions/upload-artifact@v4
with:
name: backend-license-report
retention-days: 3
path: ./backend/build/reports/dependency-license/index.html
- name: Send status to Slack
uses: digitalservicebund/notify-on-failure-gha@814d0c4b2ad6a3443e89c991f8657b10126510bf # v1.5.0
if: ${{ failure() && github.ref == 'refs/heads/main'}}
with:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}