-
Notifications
You must be signed in to change notification settings - Fork 0
108 lines (88 loc) · 2.58 KB
/
Copy pathcode-quality.yml
File metadata and controls
108 lines (88 loc) · 2.58 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
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
name: Code Quality
on:
push:
branches: [ "main", "develop" ]
pull_request:
branches: [ "main" ]
permissions:
contents: read
pull-requests: write
jobs:
test-and-coverage:
name: Unit Tests & Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for better analysis
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Run tests with coverage
run: mvn -B clean test jacoco:report
- name: Generate coverage report
run: mvn jacoco:report
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Archive coverage report
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: target/site/jacoco/
retention-days: 30
- name: Comment coverage on PR
if: github.event_name == 'pull_request'
uses: madrapps/jacoco-report@v1.6.1
with:
paths: ${{ github.workspace }}/target/site/jacoco/jacoco.xml
token: ${{ secrets.GITHUB_TOKEN }}
min-coverage-overall: 50
min-coverage-changed-files: 60
title: '📊 Code Coverage Report'
update-comment: true
code-analysis:
name: Static Code Analysis
runs-on: ubuntu-latest
needs: test-and-coverage
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Compile project
run: mvn -B compile test-compile
- name: Run Maven verify
run: mvn -B verify -DskipTests
build-quality:
name: Build Quality Check
runs-on: ubuntu-latest
needs: [test-and-coverage, code-analysis]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven
- name: Full build with all checks
run: mvn -B clean package
- name: Archive artifacts
uses: actions/upload-artifact@v4
with:
name: build-artifacts
path: |
target/*.jar
target/site/jacoco/
retention-days: 7