Merge shell tests into the Java CI pipeline#1120
Conversation
Run the shell (bats/Pester) tests as a stage after the regular build in maven.yml instead of in a separate workflow that rebuilt OpenNLP from scratch on each OS. The binary distribution is pure-Java and platform-independent, so it is now built once (Ubuntu/JDK 21), uploaded as an artifact, and reused by the per-OS shell-test jobs via needs/download-artifact. This removes three redundant Maven builds per run. actions/upload-artifact and actions/download-artifact are in the actions/* namespace, which is automatically allowed under the ASF GitHub Actions policy, so no INFRA allowlist change is required.
krickert
left a comment
There was a problem hiding this comment.
Just this one concern - I'd just do either of the two.
There was a problem hiding this comment.
Found a potential issue: the shell tests may be skipped when the build matrix has partial failures. This doesn't look intentional..
The three new shell-test jobs (test-unix-shell-ubuntu, test-unix-shell-macos, test-windows-shell) all declare:
needs: buildMy understanding:
The build job is a matrix of 6 combinations (ubuntu/macos/windows × java 21/25) with fail-fast: false. In GitHub Actions, needs: <matrix-job> waits for the entire matrix to succeed. If any single leg fails (even an unrelated one like windows-latest + Java 25), the shell-test jobs are marked as skipped—even though the ubuntu-latest/java 21 leg that produces the opennlp-distribution artifact succeeded and uploaded it.
The comments in the workflow (lines 60-62 and 74-75) indicate the intent is to reuse the distribution from the Linux/JDK 21 build. This skipping behavior is probably unintentional?
Assuming this is the intent, I can think of two ways to fix this:
- Introduce a separate, non-matrix job (e.g.,
build-distribution) that only runs onubuntu-latest+ Java 21, uploads the artifact, and have the shell tests depend on that job instead. - Or keep the current matrix but make the shell-test dependency more granular (e.g., via an
if:condition that checks whether the required artifact exists).
Thoughts?
|
Good catch on the mechanics — you're right that The goal is to cut CI load so we don't pile up queues when several PRs hit at once. Today the distribution gets built 9× per run (6 in Your Thanks for the careful review! |
What
Runs the shell (bats/Pester) tests as a stage after the regular build in
maven.yml, and removes the standaloneshell-tests.ymlworkflow.Why
Previously the distribution was built 9× per run: 6 in
maven.yml(3 OS × 2 JDK) plus 3 more inshell-tests.yml(one per OS), purely to produce the tarball the shell tests run against.The binary distribution is pure-Java and platform-independent, so it is now:
buildjob (Ubuntu / JDK 21) and uploaded viaactions/upload-artifact.needs: build) viaactions/download-artifact, which then extract and run bats (Ubuntu/macOS) / Pester (Windows).This drops the 3 redundant Maven builds per run.
ASF policy note
actions/upload-artifactandactions/download-artifactare in theactions/*namespace, which is automatically allowed under the ASF GitHub Actions policy (alongsideapache/*andgithub/*). No INFRA allowlist change is required.