Skip to content

Commit e388aea

Browse files
fix(ci): switch test shards from scalatest:test to mvn test + add verify step
scalatest:test (direct plugin goal) skips the Maven lifecycle so test-classes are not put on the classpath — result is 0 tests found. Switch to `mvn test` so Zinc detects the pre-compiled artifacts and runs ScalaTest without recompiling. Also adds a "Verify compiled output" step on each shard to confirm that obp-api/target/test-classes is populated before tests run.
1 parent b65db79 commit e388aea

File tree

2 files changed

+40
-14
lines changed

2 files changed

+40
-14
lines changed

.github/workflows/build_container.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ jobs:
164164
with:
165165
name: compiled-output
166166

167+
- name: Verify compiled output
168+
run: |
169+
echo "=== obp-api/target/ layout ==="
170+
ls -la obp-api/target/ 2>/dev/null || echo "MISSING: obp-api/target/"
171+
echo ""
172+
echo "=== .class file counts ==="
173+
echo "main: $(find obp-api/target/classes -name '*.class' 2>/dev/null | wc -l)"
174+
echo "test: $(find obp-api/target/test-classes -name '*.class' 2>/dev/null | wc -l)"
175+
echo "commons: $(find obp-commons/target/classes -name '*.class' 2>/dev/null | wc -l)"
176+
echo ""
177+
echo "=== sample test-classes paths ==="
178+
find obp-api/target/test-classes -name '*.class' 2>/dev/null | head -5 || echo "none found"
179+
167180
- name: Install local artifacts into Maven repo
168181
run: |
169182
# The compile runner's ~/.m2 is discarded after that job completes.
@@ -224,14 +237,14 @@ jobs:
224237
225238
- name: Run tests — shard ${{ matrix.shard }} (${{ matrix.name }})
226239
run: |
227-
# scalatest:test (direct plugin goal) runs tests without triggering
228-
# the compile lifecycle — compiled classes from the artifact are used.
229-
# Tests in this project are run by scalatest-maven-plugin, not surefire
230-
# (surefire has <skipTests>true</skipTests> in pom.xml).
231-
# -DwildcardSuites passes space-separated package prefixes as -w args
232-
# to the ScalaTest runner, matching all suites in those packages.
240+
# mvn test runs the full lifecycle. With compiled classes already
241+
# present in target/ (from the artifact), Zinc incremental compilation
242+
# detects no source changes and skips recompilation. Tests are run by
243+
# scalatest-maven-plugin (surefire is disabled in pom.xml).
244+
# -DwildcardSuites filters to the packages for this shard.
245+
# See README.md: "mvn -DwildcardSuites=code.api.directloginTest test"
233246
MAVEN_OPTS="-Xmx3G -Xss2m -XX:MaxMetaspaceSize=1G" \
234-
mvn scalatest:test -pl obp-api \
247+
mvn test \
235248
-DwildcardSuites="${{ matrix.test_filter }}" \
236249
> maven-build-shard${{ matrix.shard }}.log 2>&1
237250

.github/workflows/build_pull_request.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,19 @@ jobs:
164164
with:
165165
name: compiled-output
166166

167+
- name: Verify compiled output
168+
run: |
169+
echo "=== obp-api/target/ layout ==="
170+
ls -la obp-api/target/ 2>/dev/null || echo "MISSING: obp-api/target/"
171+
echo ""
172+
echo "=== .class file counts ==="
173+
echo "main: $(find obp-api/target/classes -name '*.class' 2>/dev/null | wc -l)"
174+
echo "test: $(find obp-api/target/test-classes -name '*.class' 2>/dev/null | wc -l)"
175+
echo "commons: $(find obp-commons/target/classes -name '*.class' 2>/dev/null | wc -l)"
176+
echo ""
177+
echo "=== sample test-classes paths ==="
178+
find obp-api/target/test-classes -name '*.class' 2>/dev/null | head -5 || echo "none found"
179+
167180
- name: Install local artifacts into Maven repo
168181
run: |
169182
# The compile runner's ~/.m2 is discarded after that job completes.
@@ -224,14 +237,14 @@ jobs:
224237
225238
- name: Run tests — shard ${{ matrix.shard }} (${{ matrix.name }})
226239
run: |
227-
# scalatest:test (direct plugin goal) runs tests without triggering
228-
# the compile lifecycle — compiled classes from the artifact are used.
229-
# Tests in this project are run by scalatest-maven-plugin, not surefire
230-
# (surefire has <skipTests>true</skipTests> in pom.xml).
231-
# -DwildcardSuites passes space-separated package prefixes as -w args
232-
# to the ScalaTest runner, matching all suites in those packages.
240+
# mvn test runs the full lifecycle. With compiled classes already
241+
# present in target/ (from the artifact), Zinc incremental compilation
242+
# detects no source changes and skips recompilation. Tests are run by
243+
# scalatest-maven-plugin (surefire is disabled in pom.xml).
244+
# -DwildcardSuites filters to the packages for this shard.
245+
# See README.md: "mvn -DwildcardSuites=code.api.directloginTest test"
233246
MAVEN_OPTS="-Xmx3G -Xss2m -XX:MaxMetaspaceSize=1G" \
234-
mvn scalatest:test -pl obp-api \
247+
mvn test \
235248
-DwildcardSuites="${{ matrix.test_filter }}" \
236249
> maven-build-shard${{ matrix.shard }}.log 2>&1
237250

0 commit comments

Comments
 (0)