From 408eab0beb39f715df279326403bcd15c13aab82 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 14:31:18 +0000 Subject: [PATCH 1/3] build(workflows): skip test-less packages in `run_tests_coverage` 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 Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz --- .../workflows/scripts/run_tests_coverage/run | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/.github/workflows/scripts/run_tests_coverage/run b/.github/workflows/scripts/run_tests_coverage/run index 35a6ab95799c..e8d2741a1f86 100755 --- a/.github/workflows/scripts/run_tests_coverage/run +++ b/.github/workflows/scripts/run_tests_coverage/run @@ -138,12 +138,17 @@ main() { exit 0 fi - mkdir -p artifacts coverage='' for package in ${directories}; do # For each package, extract coverage values from the respective coverage report: pkg=$(echo "$package" | sed -E 's/^.*stdlib\///') + # Skip packages which do not have a test directory (e.g., presentation-only sub-packages), as `make test-javascript-cov` fails when a `TESTS_FILTER` matches zero files: + if [ ! -d "lib/node_modules/@stdlib/${pkg}/test" ]; then + echo "::warning::No test directory found for package '${pkg}'. Skipping..." + continue + fi + if [ -f "lib/node_modules/@stdlib/${pkg}/binding.gyp" ]; then NODE_ADDONS_PATTERN="${pkg}" make install-node-addons fi @@ -195,10 +200,14 @@ main() { rm -rf reports/coverage/lcov-report/* done - # Format coverage as Markdown table row: - table_body=$(echo "$coverage" | sed -e 's/,/|/g; s/"/ /g; s/\[/|/g; s/\]/|/g') - table_header="| Package | Statements | Branches | Functions | Lines |\n| --------- | ------------ | ---------- | ----------- | ----- |" - table="${table_header}${table_body}" + # Format coverage as a Markdown table row, unless every changed package was skipped (e.g., no package had a test directory): + if [ -z "$coverage" ]; then + table='' + else + table_body=$(echo "$coverage" | sed -e 's/,/|/g; s/"/ /g; s/\[/|/g; s/\]/|/g') + table_header="| Package | Statements | Branches | Functions | Lines |\n| --------- | ------------ | ---------- | ----------- | ----- |" + table="${table_header}${table_body}" + fi echo "table=$table" >> "$GITHUB_OUTPUT" From 381e975b088f9484b875d471c736ae0d2b663e4e Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 22:04:44 +0000 Subject: [PATCH 2/3] style(workflows): simplify skip-comment wording in `run_tests_coverage` 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 Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz --- .github/workflows/scripts/run_tests_coverage/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/run_tests_coverage/run b/.github/workflows/scripts/run_tests_coverage/run index e8d2741a1f86..fbc07b7b31cb 100755 --- a/.github/workflows/scripts/run_tests_coverage/run +++ b/.github/workflows/scripts/run_tests_coverage/run @@ -143,7 +143,7 @@ main() { # For each package, extract coverage values from the respective coverage report: pkg=$(echo "$package" | sed -E 's/^.*stdlib\///') - # Skip packages which do not have a test directory (e.g., presentation-only sub-packages), as `make test-javascript-cov` fails when a `TESTS_FILTER` matches zero files: + # Skip packages which do not have a test directory, as `make test-javascript-cov` fails when a `TESTS_FILTER` matches zero files: if [ ! -d "lib/node_modules/@stdlib/${pkg}/test" ]; then echo "::warning::No test directory found for package '${pkg}'. Skipping..." continue From 6ff9cb8acb82290ba6bd280102c09113ecb96409 Mon Sep 17 00:00:00 2001 From: Claude Date: Sun, 27 Sep 2026 22:05:24 +0000 Subject: [PATCH 3/3] style(workflows): use plain-text warning in `run_tests_coverage` 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 Claude-Session: https://claude.ai/code/session_01Ch53UGBgsUodCvqUP9zcHz --- .github/workflows/scripts/run_tests_coverage/run | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/scripts/run_tests_coverage/run b/.github/workflows/scripts/run_tests_coverage/run index fbc07b7b31cb..48042ecec212 100755 --- a/.github/workflows/scripts/run_tests_coverage/run +++ b/.github/workflows/scripts/run_tests_coverage/run @@ -145,7 +145,7 @@ main() { # Skip packages which do not have a test directory, as `make test-javascript-cov` fails when a `TESTS_FILTER` matches zero files: if [ ! -d "lib/node_modules/@stdlib/${pkg}/test" ]; then - echo "::warning::No test directory found for package '${pkg}'. Skipping..." + echo "WARNING: No test directory found for package '${pkg}'. Skipping..." >&2 continue fi