Skip to content

Commit baa0227

Browse files
committed
CI Pipeline work
1 parent ec9186a commit baa0227

File tree

9 files changed

+2429
-36
lines changed

9 files changed

+2429
-36
lines changed

.github/workflows/ci-reports.yml

Lines changed: 111 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@ name: CI Reports
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- 'features/**'
58
pull_request:
9+
branches:
10+
- main
611

712
jobs:
813
ci-reports:
@@ -24,45 +29,130 @@ jobs:
2429
path: ~/.m2
2530
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
2631
restore-keys: ${{ runner.os }}-m2
27-
28-
- name: Run tests with coverage
32+
33+
# ===== TESTING =====
34+
- name: Run unit tests with coverage
2935
run: ./mvnw -B clean test
36+
continue-on-error: false
3037

31-
- name: Generate JaCoCo report
32-
run: ./mvnw -B jacoco:report -Dmaven.test.skip=true
38+
# ===== CODE COVERAGE =====
39+
- name: Generate JaCoCo coverage report
40+
run: ./mvnw -B jacoco:report
41+
if: always()
3342

34-
- name: Generate PMD report (without failing on violations)
35-
run: ./mvnw -B pmd:pmd -Dpmd.failOnViolation=false -Dmaven.test.skip=true
43+
# ===== STATIC ANALYSIS =====
44+
- name: Run Checkstyle analysis
45+
run: ./mvnw -B checkstyle:checkstyle
46+
continue-on-error: true
47+
if: always()
3648

37-
- name: Generate HTML site reports
38-
run: ./mvnw -B site -Dcheckstyle.failsOnError=false -Dpmd.failOnViolation=false -Dmaven.test.skip=true
49+
- name: Generate PMD report
50+
run: ./mvnw -B pmd:pmd -Dpmd.failOnViolation=false
51+
continue-on-error: true
52+
if: always()
3953

40-
- name: Run quality checks (separate from report generation)
41-
run: ./mvnw -B checkstyle:check pmd:check -Dmaven.test.skip=true
54+
# ===== GENERATE SITE REPORTS =====
55+
- name: Generate Maven site with all reports
56+
run: ./mvnw -B site -Dcheckstyle.failsOnError=false -Dpmd.failOnViolation=false
4257
continue-on-error: true
58+
if: always()
4359

44-
- name: Debug - List generated files
60+
# ===== QUALITY GATES =====
61+
- name: Run Checkstyle quality gate
62+
run: ./mvnw -B checkstyle:check
63+
continue-on-error: true
64+
if: always()
65+
66+
- name: Run PMD quality gate
67+
run: ./mvnw -B pmd:check
68+
continue-on-error: true
69+
if: always()
70+
71+
# ===== DEBUG & VERIFICATION =====
72+
- name: List generated reports
4573
run: |
46-
echo "Checking for generated reports..."
47-
ls -la target/site/ || echo "No target/site directory"
48-
ls -la target/site/jacoco/ || echo "No JaCoCo reports"
49-
echo "PMD report location:"
50-
find target -name "pmd.html" -o -name "index.html" | grep -E "(pmd|site)" || echo "No PMD HTML reports found"
74+
echo "========================================="
75+
echo "Generated CI Reports Structure"
76+
echo "========================================="
77+
echo ""
78+
echo "Target directory structure:"
79+
find target -type f -name "*.xml" -o -name "*.html" | grep -E "(checkstyle|pmd|jacoco|surefire)" | sort || echo "No report files found"
80+
echo ""
81+
echo "Site reports:"
82+
ls -la target/site/ 2>/dev/null || echo "No target/site directory"
83+
echo ""
84+
echo "JaCoCo reports:"
85+
ls -la target/site/jacoco/ 2>/dev/null || echo "No JaCoCo reports"
86+
echo ""
87+
echo "Checkstyle reports:"
88+
ls -la target/ | grep checkstyle || echo "No Checkstyle reports"
89+
echo ""
90+
echo "PMD reports:"
91+
find target -name "*pmd*" -type f || echo "No PMD reports"
92+
if: always()
5193

52-
- name: Install wkhtmltopdf
94+
# ===== CONVERT TO PNG =====
95+
- name: Install wkhtmltopdf for report conversion
5396
run: |
5497
sudo apt-get update
5598
sudo apt-get install -y wkhtmltopdf
99+
if: always()
56100

57-
- name: Make script executable
101+
- name: Make conversion script executable
58102
run: chmod +x scripts/html_to_png.sh
103+
if: always()
59104

60105
- name: Convert HTML reports to PNG
61106
run: bash scripts/html_to_png.sh
107+
continue-on-error: true
108+
if: always()
62109

63-
- name: Upload CI reports
110+
# ===== UPLOAD ARTIFACTS =====
111+
- name: Upload HTML/XML reports
112+
uses: actions/upload-artifact@v4
113+
if: always()
114+
with:
115+
name: ci-reports-html-xml
116+
path: |
117+
target/site/
118+
target/checkstyle-result.xml
119+
target/pmd.xml
120+
target/surefire-reports/
121+
retention-days: 30
122+
123+
- name: Upload PNG screenshots
64124
uses: actions/upload-artifact@v4
65125
if: always()
66126
with:
67-
name: ci-reports
68-
path: reports/*
127+
name: ci-reports-screenshots
128+
path: reports/*.png
129+
retention-days: 30
130+
131+
- name: Upload test results
132+
uses: actions/upload-artifact@v4
133+
if: always()
134+
with:
135+
name: test-results
136+
path: target/surefire-reports/
137+
retention-days: 30
138+
139+
# ===== SUMMARY =====
140+
- name: Generate CI Summary
141+
if: always()
142+
run: |
143+
echo "## 📊 CI Report Summary" >> $GITHUB_STEP_SUMMARY
144+
echo "" >> $GITHUB_STEP_SUMMARY
145+
echo "### Test Results" >> $GITHUB_STEP_SUMMARY
146+
if [ -d "target/surefire-reports" ]; then
147+
TESTS=$(find target/surefire-reports -name "TEST-*.xml" | wc -l)
148+
echo "- Test suites executed: $TESTS" >> $GITHUB_STEP_SUMMARY
149+
fi
150+
echo "" >> $GITHUB_STEP_SUMMARY
151+
echo "### Available Reports" >> $GITHUB_STEP_SUMMARY
152+
echo "- ✅ JaCoCo Coverage Report" >> $GITHUB_STEP_SUMMARY
153+
echo "- ✅ Checkstyle Analysis" >> $GITHUB_STEP_SUMMARY
154+
echo "- ✅ PMD Static Analysis" >> $GITHUB_STEP_SUMMARY
155+
echo "- ✅ Maven Site Documentation" >> $GITHUB_STEP_SUMMARY
156+
echo "" >> $GITHUB_STEP_SUMMARY
157+
echo "### 📥 Download Artifacts" >> $GITHUB_STEP_SUMMARY
158+
echo "All reports are available as workflow artifacts above." >> $GITHUB_STEP_SUMMARY

.github/workflows/maven-main.yml

Lines changed: 40 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,53 @@
1-
name: main Branch
1+
name: Build and Test
22

33
on:
44
push:
55
branches:
66
- 'main'
7+
- 'features/**'
8+
pull_request:
9+
branches:
10+
- main
711

812
jobs:
9-
10-
test:
11-
name: Test - Units & Integrations
13+
build:
14+
name: Build and Test
1215
runs-on: ubuntu-latest
1316

1417
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up JDK 4
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Set up JDK 17
1722
uses: actions/setup-java@v4
1823
with:
1924
distribution: 'temurin'
20-
java-version: '18'
21-
- name: Maven Package
22-
run: mvn -B -f IndividualProject/pom.xml clean package -DskipTests
23-
- name: Maven Verify
24-
run: mvn -B -f IndividualProject/pom.xml clean verify -Pintegration-test
25+
java-version: '17'
26+
27+
- name: Cache Maven dependencies
28+
uses: actions/cache@v4
29+
with:
30+
path: ~/.m2
31+
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
32+
restore-keys: ${{ runner.os }}-m2
33+
34+
- name: Build with Maven
35+
run: ./mvnw -B clean compile
36+
37+
- name: Run unit tests
38+
run: ./mvnw -B test
39+
40+
- name: Package application
41+
run: ./mvnw -B package -DskipTests
42+
43+
- name: Verify build artifacts
44+
run: |
45+
echo "Checking build output..."
46+
ls -lh target/*.jar
47+
48+
- name: Upload build artifact
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: application-jar
52+
path: target/*.jar
53+
retention-days: 7

0 commit comments

Comments
 (0)