Skip to content

Commit be5827b

Browse files
Update GitHub Actions workflow for unit testing
1 parent 5eb9ca0 commit be5827b

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/unit-testing.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,39 @@ jobs:
3030
distribution: 'temurin'
3131
cache: 'maven'
3232

33-
- name: Run unit tests with coverage (excluding integration tests)
33+
- name: Run unit tests (excluding integration tests)
3434
run: |
3535
echo "Running unit tests only (excluding *IT.java files)..."
3636
mvn clean test -Dtest='!*IT' -Dgpg.skip=true
37-
echo "Tests completed, generating JaCoCo report..."
37+
continue-on-error: false
38+
39+
- name: Generate JaCoCo coverage report
40+
run: |
41+
echo "Generating JaCoCo report..."
3842
mvn jacoco:report -Dgpg.skip=true
39-
echo "✅ Unit tests and coverage report completed"
43+
echo "✅ Coverage report generated"
44+
if: always()
4045

4146
- name: Verify JaCoCo reports generated
4247
run: |
4348
echo "Checking for JaCoCo reports..."
49+
echo "Current directory: $(pwd)"
50+
echo "Target directory contents:"
51+
ls -la target/ || echo "No target directory found"
52+
if [ -d "target/site/jacoco" ]; then
53+
echo "JaCoCo directory contents:"
54+
ls -lh target/site/jacoco/
55+
fi
4456
if [ ! -f "target/site/jacoco/jacoco.xml" ]; then
4557
echo "❌ Error: jacoco.xml not found"
58+
echo "This usually means tests didn't run or JaCoCo plugin isn't configured correctly"
4659
exit 1
4760
fi
4861
if [ ! -f "target/site/jacoco/jacoco.csv" ]; then
4962
echo "⚠️ Warning: jacoco.csv not found (badge generation will be skipped)"
5063
fi
5164
echo "✅ JaCoCo XML report found"
52-
ls -lh target/site/jacoco/
65+
if: always()
5366

5467
- name: Generate JaCoCo Badge
5568
id: jacoco
@@ -64,6 +77,7 @@ jobs:
6477

6578
- name: Check coverage thresholds
6679
id: coverage-check
80+
if: hashFiles('target/site/jacoco/jacoco.xml') != ''
6781
run: |
6882
echo "Checking coverage thresholds (unit tests only)..."
6983
# Extract coverage percentages from JaCoCo XML report (using sed for cross-platform compatibility)

0 commit comments

Comments
 (0)