Skip to content

Merge shell tests into the Java CI pipeline#1120

Open
rzo1 wants to merge 1 commit into
mainfrom
ci-merge-shell-tests-into-build
Open

Merge shell tests into the Java CI pipeline#1120
rzo1 wants to merge 1 commit into
mainfrom
ci-merge-shell-tests-into-build

Conversation

@rzo1

@rzo1 rzo1 commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Runs the shell (bats/Pester) tests as a stage after the regular build in maven.yml, and removes the standalone shell-tests.yml workflow.

Why

Previously the distribution was built per run: 6 in maven.yml (3 OS × 2 JDK) plus 3 more in shell-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:

  1. Built once in the build job (Ubuntu / JDK 21) and uploaded via actions/upload-artifact.
  2. Downloaded by the per-OS shell-test jobs (needs: build) via actions/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-artifact and actions/download-artifact are in the actions/* namespace, which is automatically allowed under the ASF GitHub Actions policy (alongside apache/* and github/*). No INFRA allowlist change is required.

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.
@rzo1 rzo1 requested review from atarora, krickert and mawiesne June 25, 2026 13:20
@rzo1 rzo1 self-assigned this Jun 25, 2026
@mawiesne mawiesne marked this pull request as draft June 26, 2026 06:42
@rzo1 rzo1 marked this pull request as ready for review June 26, 2026 07:04
@mawiesne mawiesne marked this pull request as draft June 26, 2026 07:12

@krickert krickert left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just this one concern - I'd just do either of the two.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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: build

My 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 on ubuntu-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?

@rzo1 rzo1 marked this pull request as ready for review June 26, 2026 11:44
@rzo1

rzo1 commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Good catch on the mechanics — you're right that needs: build waits on the whole 6-leg matrix, so if any leg fails the shell-test jobs get skipped. But that's actually the behavior I want here, and it ties into the whole point of this PR.

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 maven.yml + 3 in shell-tests.yml); this PR drops that to building it once on Linux/JDK 21 and reusing the artifact. Gating the shell tests on a fully-green matrix fits the same intent: if any build leg is red, the run is already failing, so spinning up three more OS runners to shell-test a build we know is broken just burns minutes we're trying to save. The skip can't ever mask a failure — it never turns a red run green — so we lose nothing on the safety side; we only skip shell coverage on a run that's already failing for another reason.

Your build-distribution job idea would decouple it, but I'd rather not: it adds a runner back and would let shell tests go green while the main matrix is red, which is a more confusing signal than a clean skip.

Thanks for the careful review!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants