Skip to content

Commit 2a98468

Browse files
committed
introduce ci build
1 parent 6cdb7fa commit 2a98468

File tree

2 files changed

+118
-12
lines changed

2 files changed

+118
-12
lines changed

.github/workflows/ci.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
name: CI Build
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
name: Build and Test
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
16+
strategy:
17+
matrix:
18+
java: ['8', '11', '17', '21']
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up JDK ${{ matrix.java }}
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: ${{ matrix.java }}
28+
distribution: 'temurin'
29+
cache: 'maven'
30+
31+
- name: Build with Maven
32+
run: mvn -B clean compile --file pom.xml
33+
34+
- name: Run tests
35+
run: mvn -B test --file pom.xml
36+
37+
- name: Generate test report
38+
if: always()
39+
run: mvn surefire-report:report-only
40+
41+
- name: Upload test results
42+
if: always()
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: test-results-java-${{ matrix.java }}
46+
path: target/surefire-reports/
47+
retention-days: 7
48+
49+
- name: Upload coverage report
50+
if: matrix.java == '8'
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: coverage-report
54+
path: target/site/jacoco/
55+
retention-days: 30
56+
57+
quality:
58+
name: Code Quality Checks
59+
runs-on: ubuntu-latest
60+
permissions:
61+
contents: read
62+
63+
steps:
64+
- name: Checkout code
65+
uses: actions/checkout@v4
66+
67+
- name: Set up JDK 8
68+
uses: actions/setup-java@v4
69+
with:
70+
java-version: '8'
71+
distribution: 'temurin'
72+
cache: 'maven'
73+
74+
- name: Compile code
75+
run: mvn -B clean compile --file pom.xml
76+
77+
- name: Run Checkstyle
78+
run: mvn checkstyle:checkstyle --file pom.xml
79+
continue-on-error: true
80+
81+
- name: Upload Checkstyle report
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: checkstyle-report
85+
path: target/checkstyle-result.xml
86+
retention-days: 7
87+
88+
- name: Run SpotBugs
89+
run: mvn spotbugs:spotbugs --file pom.xml
90+
continue-on-error: true
91+
92+
- name: Upload SpotBugs report
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: spotbugs-report
96+
path: target/spotbugsXml.xml
97+
retention-days: 7
98+
99+
- name: Run PMD
100+
run: mvn pmd:pmd --file pom.xml
101+
continue-on-error: true
102+
103+
- name: Upload PMD report
104+
uses: actions/upload-artifact@v4
105+
with:
106+
name: pmd-report
107+
path: target/pmd.xml
108+
retention-days: 7

.github/workflows/codeql-analysis.yml

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,18 @@ jobs:
3030

3131
steps:
3232
- name: Checkout repository
33-
uses: actions/checkout@v2
34-
with:
35-
# We must fetch at least the immediate parents so that if this is
36-
# a pull request then we can checkout the head.
37-
fetch-depth: 2
33+
uses: actions/checkout@v4
3834

39-
# If this run was triggered by a pull request event, then checkout
40-
# the head of the pull request instead of the merge commit.
41-
- run: git checkout HEAD^2
42-
if: ${{ github.event_name == 'pull_request' }}
35+
- name: Set up JDK 8
36+
uses: actions/setup-java@v4
37+
with:
38+
java-version: '8'
39+
distribution: 'temurin'
40+
cache: 'maven'
4341

4442
# Initializes the CodeQL tools for scanning.
4543
- name: Initialize CodeQL
46-
uses: github/codeql-action/init@v2
44+
uses: github/codeql-action/init@v3
4745
with:
4846
languages: ${{ matrix.language }}
4947
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -54,7 +52,7 @@ jobs:
5452
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5553
# If this step fails, then you should remove it and run the build manually (see below)
5654
- name: Autobuild
57-
uses: github/codeql-action/autobuild@v2
55+
uses: github/codeql-action/autobuild@v3
5856

5957
# ℹ️ Command-line programs to run using the OS shell.
6058
# 📚 https://git.io/JvXDl
@@ -68,4 +66,4 @@ jobs:
6866
# make release
6967

7068
- name: Perform CodeQL Analysis
71-
uses: github/codeql-action/analyze@v2
69+
uses: github/codeql-action/analyze@v3

0 commit comments

Comments
 (0)