build: skip packages without a test directory - #15591
Merged
kgryte merged 3 commits intoSep 27, 2026
Merged
Conversation
The job `Calculate test coverage for packages` failed on develop for
a commit touching `repl/lib/commands/load.js` and
`repl/presentation/lib/commands/*.js`.
Root cause: the script derives one package directory per changed
file. `@stdlib/repl` and `@stdlib/repl/presentation` are distinct
packages, and the latter has no `test/` directory. The script then
unconditionally runs `make test-javascript-cov
TESTS_FILTER=".*/${pkg}/test/.*"` for every derived package. With
zero matching test files, `tools/make/lib/test-cov/c8.mk`'s `test-c8`
rule pipes `find | grep ... | while read`, and under this repo's
`.SHELLFLAGS := -eu -o pipefail -c`, a zero-match `grep` (exit 1)
fails the whole recipe immediately, with no test output.
This commit skips any derived package directory lacking a `test/`
directory before invoking `make`, and adjusts the two places that
assumed at least one package was always tested: the coverage
artifacts directory is now created lazily per package (so it is never
left behind, empty, when every changed package is skipped) and the
Markdown coverage table is only built when at least one package
produced coverage output, so an all-skipped run falls back to the
workflow's existing "No coverage information available." message
instead of a header-only table.
Ref: https://github.com/stdlib-js/stdlib/actions/runs/36269983327
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
kgryte
reviewed
Sep 27, 2026
kgryte
reviewed
Sep 27, 2026
Applies @kgryte's review suggestion: drop the "e.g., presentation-only sub-packages" aside, since the guard applies to any package lacking a test directory, not just presentation sub-packages. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
Applies @kgryte's review suggestion: replace the GitHub Actions `::warning::` workflow command with a plain "WARNING: ..." message, matching this script's existing diagnostic-echo convention (see the "No packages to test." and "ERROR: ..." messages), and redirect to stderr like every other diagnostic echo in the file. `::warning::` is GitHub Actions-specific syntax that would print literally if this script were ever run outside Actions. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
kgryte
marked this pull request as ready for review
September 27, 2026 22:07
kgryte
approved these changes
Sep 27, 2026
run_tests_coverage
kgryte
deleted the
philipp/ci-fix-test-coverage-no-tests-dir-2026-09-27
branch
September 27, 2026 22:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This pull request:
run_tests_coverageworkflow so it does not fail when a changed package has notest/directory.The
run_tests_coverageworkflow fails on develop at commit a8b875b ("chore: clean-up", #15566): https://github.com/stdlib-js/stdlib/actions/runs/36269983327, job "Calculate test coverage for packages".make[1]: *** [tools/make/lib/test-cov/c8.mk:89: test-c8] Error 1, zero test output printed..github/workflows/scripts/run_tests_coverage/runderives one "package directory" per changed file. The triggering commit touchedrepl/lib/commands/load.jsand severalrepl/presentation/lib/commands/*.jsfiles.@stdlib/repland@stdlib/repl/presentationare separate packages, each with its ownpackage.json;@stdlib/repl/presentationhas notest/directory at all. The script ranmake test-javascript-cov TESTS_FILTER=".*/${pkg}/test/.*"unconditionally for every derived package. With a filter matching zero files,test-cov/c8.mk'stest-c8rule pipesfind | grep '^[\/]...' | while read -r test; do ...; under this repo's.SHELLFLAGS := -eu -o pipefail -c,grepfinding nothing exits 1 and kills the recipe before any test runs.Fix: skip any derived package directory lacking a
test/directory before invokingmake, emitting an::warning::annotation naming the skipped package. Two knock-on changes were needed so "every changed package skipped" doesn't just fail one step later:artifacts/is now created lazily, per package, instead of unconditionally up front. An unconditional emptyartifacts/dir would make the later "Copy artifacts to the repository" step'scp -R ./artifacts/*fail on no matches.1 file changed:
.github/workflows/scripts/run_tests_coverage/run, +14/-5. The three hunks are dependent, not independent fixes.Related Issues
This pull request has no related issues.
Questions
No.
Other
Validated by reproducing the directory-derivation logic against the failing commit's changed-file list in a local shell simulation: confirms
replis tested andrepl/presentationis skipped. Separately simulated the all-packages-skipped path end to end, including the downstreamif [ -d ./artifacts ]check inrun_tests_coverage.yml: no failure.bash -nsyntax check passes.Reviewed across two rounds by three independent automated reviewers (correctness, regression scope, style/conventions). Round 1 flagged the all-skipped-artifacts gap; fixed, and round 2 approved unanimously.
Known limitation, not addressed here: this guards only a completely absent
test/directory, not one that exists but is empty. Flagged by reviewers as non-blocking.Checklist
AI Assistance
If you answered "yes" above, how did you use AI assistance?
Disclosure
This PR was investigated, written, and validated by an automated Claude Code CI-monitoring routine, including root-cause investigation and two rounds of independent multi-reviewer validation of the fix.
@stdlib-js/reviewers
🤖 Generated with Claude Code
https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz
Generated by Claude Code