-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackend_unit_test_sonarqube.yml
More file actions
48 lines (43 loc) · 1.29 KB
/
backend_unit_test_sonarqube.yml
File metadata and controls
48 lines (43 loc) · 1.29 KB
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
name: Unit Tests and SonarQube analysis for Java backend
run-name: Unit Tests and SonarQube
on:
workflow_call:
secrets:
SONAR_TOKEN:
description: "SonarQube authentication token"
required: true
jobs:
unit-test-sonarqube:
name: Unit Tests and SonarQube
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Set up JDK 25
uses: actions/setup-java@v5
with:
java-version: '25'
distribution: 'corretto'
- name: Restore Maven Cache
uses: actions/cache/restore@v5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Run Unit Tests
run: mvn -B test -T 1C
- name: Run SonarQube Analysis
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
mvn -T 1C sonar:sonar -Dsonar.coverage.jacoco.xmlReportPaths=target/jacoco-report/jacoco.xml
- name: Save Maven Cache
uses: actions/cache/save@v5
if: success()
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}