Skip to content

ci: run each test shard's packages, not the whole module first - #2516

Open
im-apratap wants to merge 1 commit into
nsgo-dev:mainfrom
im-apratap:ci/test-suite-shards
Open

im-apratap wants to merge 1 commit into
nsgo-dev:mainfrom
im-apratap:ci/test-suite-shards

Conversation

@im-apratap

Copy link
Copy Markdown

Fixes #2504.

nsgo test read its argument as a project directory and always ran ./... inside it, so nsgo test . tested the whole module and the first shard then tested its own list again — 4975 tests against the 4850 a single job ran, with a slower shard than the job the split replaced.

What changes

  • nsgo test takes Go package patterns, counted from the module's root, as go test does: a directory names its own package, /... its tree. One run tests exactly the packages named. No pattern still tests every package under the working directory, and a target run takes one pattern.
  • An app's directory (with its nsgo.yaml) or a TSX entry is taken whole as before, so app and steps runs are unchanged.
  • Each shard in test.yml is one nsgo test run over its patterns instead of a loop of runs, so each package is built and reported once; the matrix has short names (test-suite (app), test-suite (core)).
  • The guard (TestSuiteShardsCoverEveryPackage) expands each shard's patterns the way test does, rejects a package named twice or by no shard, and now also checks the dev client's nsgodev variant runs in exactly one shard — the run test adds only when the patterns name internal/dev.
  • docs/public/en/testing.md, docs/public/zh/testing.md and skills/nsgo/SKILL.md say what a pattern names.

Verification

  • go tool nsgo check -target linux — vetted for linux_arm64 and linux_x64.
  • go tool nsgo test -run 'TestSuiteShardsCoverEveryPackage|TestTestTakesPackagePatterns|TestTestEntryTakesAnAppButNotAModule|TestForwardedTestFlagsDoNotNameADirectory|TestTestArgumentsKeepGoTestFlags|TestTestCommandRegistersJSON|TestRunTestsRejectsAPackageAmongItsFlags' ./cmd/nsgo — 7 passed.
  • go tool nsgo test -run '^$' . ./core — exited 0 and built exactly two packages (github.com/nsgo-dev/nsgo and github.com/nsgo-dev/nsgo/core); before this change . alone expanded to every package of the module.
  • go run ./tools/changelog check — 27 fragments, valid.

The shard timings themselves need a CI run: this machine has no Actions runner, so I did not measure the new shard durations.

🤖 Generated with Codebuff

`nsgo test` read its argument as a project directory and always ran
./... inside it, so the suite's first shard tested every package and
then its own list again, 4975 tests against the 4850 the single job
ran, and the shard was slower than the job it replaced.

test now takes Go package patterns from the module's root, so a
directory names its own package and /... its tree, and one run tests
exactly the packages named. An app's directory or TSX entry is still
taken whole. Each shard is one run, its job names are short, and the
guard expands patterns as test does and checks the dev client's
nsgodev variant runs in one shard.

Fixes nsgo-dev#2504.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
@github-actions github-actions Bot added size/M documentation Improvements or additions to documentation cli ci and removed size/M labels Nov 26, 2026

This branch has not been deployed

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

Labels

ci cli documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci(test): the first test-suite shard tests the whole module, so the split runs everything twice

1 participant