Skip to content

Commit b3d911f

Browse files
premtsd-codeclaude
andcommitted
ci: fix PR checks to run per-service instead of checking for root pom.xml
All jobs were no-ops because they checked `if [ -f "pom.xml" ]` which doesn't exist (no root aggregator pom). Now loop through each service. Removed unused detect-changes job. Added proper job dependencies. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 8d54317 commit b3d911f

1 file changed

Lines changed: 25 additions & 72 deletions

File tree

.github/workflows/pr-checks.yml

Lines changed: 25 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -6,45 +6,9 @@ on:
66

77
jobs:
88

9-
detect-changes:
10-
name: Detect Changed Services
11-
runs-on: ubuntu-latest
12-
outputs:
13-
api-gateway: ${{ steps.changes.outputs.api-gateway }}
14-
user-service: ${{ steps.changes.outputs.user-service }}
15-
post-service: ${{ steps.changes.outputs.post-service }}
16-
connections-service: ${{ steps.changes.outputs.connections-service }}
17-
notification-service: ${{ steps.changes.outputs.notification-service }}
18-
uploader-service: ${{ steps.changes.outputs.uploader-service }}
19-
config-server: ${{ steps.changes.outputs.config-server }}
20-
discovery-server: ${{ steps.changes.outputs.discovery-server }}
21-
steps:
22-
- uses: actions/checkout@v4
23-
- uses: dorny/paths-filter@v3
24-
id: changes
25-
with:
26-
filters: |
27-
api-gateway:
28-
- 'api-gateway/**'
29-
user-service:
30-
- 'user-service/**'
31-
post-service:
32-
- 'post-service/**'
33-
connections-service:
34-
- 'connections-service/**'
35-
notification-service:
36-
- 'notification-service/**'
37-
uploader-service:
38-
- 'uploader-service/**'
39-
config-server:
40-
- 'config-server/**'
41-
discovery-server:
42-
- 'discovery-server/**'
43-
449
unit-tests:
4510
name: Unit Tests
4611
runs-on: ubuntu-latest
47-
continue-on-error: true
4812
steps:
4913
- uses: actions/checkout@v4
5014
- name: Set up JDK 17
@@ -55,23 +19,21 @@ jobs:
5519
cache: maven
5620
- name: Run unit tests
5721
run: |
58-
if [ -f "pom.xml" ]; then
59-
mvn test -DskipIntegrationTests=true || true
60-
else
61-
echo "No root pom.xml found — skipping tests"
62-
fi
22+
for svc in user-service post-service connections-service notification-service uploader-service; do
23+
echo "=== Testing $svc ==="
24+
cd $svc && mvn test -q && cd ..
25+
done
6326
- name: Upload test results
6427
uses: actions/upload-artifact@v4
6528
if: always()
66-
continue-on-error: true
6729
with:
6830
name: unit-test-results
6931
path: '**/target/surefire-reports/*.xml'
7032

7133
code-coverage:
7234
name: Code Coverage
7335
runs-on: ubuntu-latest
74-
continue-on-error: true
36+
needs: unit-tests
7537
steps:
7638
- uses: actions/checkout@v4
7739
- name: Set up JDK 17
@@ -82,14 +44,12 @@ jobs:
8244
cache: maven
8345
- name: Run tests with coverage
8446
run: |
85-
if [ -f "pom.xml" ]; then
86-
mvn verify jacoco:report -DskipIntegrationTests=true || true
87-
else
88-
echo "No root pom.xml — skipping coverage"
89-
fi
47+
for svc in user-service post-service connections-service notification-service uploader-service; do
48+
echo "=== Coverage for $svc ==="
49+
cd $svc && mvn test jacoco:report -q && cd ..
50+
done
9051
- name: Upload coverage report
9152
uses: actions/upload-artifact@v4
92-
continue-on-error: true
9353
with:
9454
name: coverage-report
9555
path: '**/target/site/jacoco/'
@@ -108,18 +68,14 @@ jobs:
10868
cache: maven
10969
- name: OWASP Dependency Check
11070
run: |
111-
if [ -f "pom.xml" ]; then
112-
mvn dependency-check:check \
113-
-DfailBuildOnCVSS=7 \
114-
-DskipTestScope=true || true
115-
else
116-
echo "No root pom.xml — skipping OWASP"
117-
fi
118-
continue-on-error: true
71+
for svc in user-service post-service connections-service notification-service uploader-service; do
72+
echo "=== OWASP scan for $svc ==="
73+
cd $svc && mvn dependency-check:check -DfailBuildOnCVSS=7 -DskipTestScope=true || true
74+
cd ..
75+
done
11976
- name: Upload OWASP report
12077
uses: actions/upload-artifact@v4
12178
if: always()
122-
continue-on-error: true
12379
with:
12480
name: owasp-report
12581
path: '**/target/dependency-check-report.html'
@@ -130,8 +86,6 @@ jobs:
13086
continue-on-error: true
13187
steps:
13288
- uses: actions/checkout@v4
133-
with:
134-
fetch-depth: 0
13589
- name: Set up JDK 17
13690
uses: actions/setup-java@v4
13791
with:
@@ -140,24 +94,23 @@ jobs:
14094
cache: maven
14195
- name: Checkstyle
14296
run: |
143-
if [ -f "pom.xml" ]; then
144-
mvn checkstyle:check || true
145-
else
146-
echo "No root pom.xml — skipping checkstyle"
147-
fi
148-
continue-on-error: true
97+
for svc in user-service post-service connections-service notification-service uploader-service; do
98+
echo "=== Checkstyle for $svc ==="
99+
cd $svc && mvn checkstyle:check -q || true
100+
cd ..
101+
done
149102
- name: SpotBugs
150103
run: |
151-
if [ -f "pom.xml" ]; then
152-
mvn spotbugs:check || true
153-
else
154-
echo "No root pom.xml — skipping spotbugs"
155-
fi
156-
continue-on-error: true
104+
for svc in user-service post-service connections-service notification-service uploader-service; do
105+
echo "=== SpotBugs for $svc ==="
106+
cd $svc && mvn compile spotbugs:check -q || true
107+
cd ..
108+
done
157109
158110
sonarcloud:
159111
name: SonarCloud Analysis
160112
runs-on: ubuntu-latest
113+
needs: unit-tests
161114
continue-on-error: true
162115
steps:
163116
- uses: actions/checkout@v4

0 commit comments

Comments
 (0)