-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (74 loc) · 2.43 KB
/
Copy pathci.yml
File metadata and controls
90 lines (74 loc) · 2.43 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
name: CI/CD
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '21' ]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Configure Git for version bumps
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
git config user.name "Version Bump"
git config user.email "version-bump@flossware.org"
- name: Auto-increment version
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
mvn -U build-helper:parse-version versions:set -DnewVersion=\${parsedVersion.majorVersion}.\${parsedVersion.nextMinorVersion} versions:commit
- name: Build with Maven
run: mvn -B clean verify
- name: Run tests
run: mvn -B test
- name: Commit and tag version
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
git add pom.xml
git commit -m "Automated Version Bump ${VERSION} [ci skip]"
git tag "${VERSION}"
git push origin main --tags
- name: Generate test report
if: always()
run: mvn surefire-report:report-only
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-java-${{ matrix.java }}
path: target/surefire-reports/
retention-days: 30
code-quality:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '21'
cache: 'maven'
- name: OWASP Dependency Check
run: mvn org.owasp:dependency-check-maven:check -DfailBuildOnCVSS=7
continue-on-error: true
- name: Upload OWASP Report
if: always()
uses: actions/upload-artifact@v4
with:
name: dependency-check-report
path: target/dependency-check-report.html
retention-days: 30