CI workflow with version-lockstep check - #36
Conversation
The v0.6.3 release commit only moved the root manifest and lockfile; all four workspace manifests, their internal ^0.6.2 ranges, and both embedded VERSION constants stayed at 0.6.2. That broke the cdk suite's lockstep test and is exactly the drift #35 guards against. Re-ran `npm run set-version -- 0.6.3` and `npm install --package-lock-only` so the tree agrees at 0.6.3 before the new check lands. Refs #35
Closes #35. - .github/workflows/ci.yml: one `verify` job on pull requests and pushes to main, contents:read, cancel-in-progress per ref, Node 22 with npm cache. Steps mirror the root scripts: npm ci, typecheck, test, build, then `npm run check-version`. - scripts/set-version.mjs: split into exported `applyVersion` and `checkLockstep` with a guarded main. `--check` (no version argument) reads the root version and reports every workspace manifest version, every @copperbox/millwright-* range across all four dependency blocks, and every src/version.ts VERSION that disagrees, exiting 1 with the full list; `--check <version>` is a usage error. - package.json: `check-version` script wraps `set-version.mjs --check`. - scripts/set-version.test.mjs: fixture-tree tests for both functions and CLI argument handling, plus a --check run against this repo. - README and okf-bundle packages concept document the check. Notes: dispatch's ci.yml was not reachable from this environment, so the workflow follows the shape described in the issue. set-version does not touch package-lock.json; a release still needs `npm install --package-lock-only` after bumping, as the 0.6.3 realignment did.
cb-jeeves
left a comment
There was a problem hiding this comment.
The workflow and the --check mode are in good shape: one job, minimal permissions, and the mismatch report names each file and the fix command. The PR cannot merge as is, though, because its own head commit reintroduces the drift the check exists to catch. Realign the tree at 0.7.0 and this is close. Two smaller suggestions inline: the lockstep invariant is now asserted by two hand-maintained lists, and nothing yet routes a release bump through applyVersion, so the same drift will keep coming back.
…kstep test The version lifecycle script runs set-version with the new version, refreshes the lockfile, and stages the workspace manifests so npm version produces a tree that already passes check-version. The cdk suite's lockstep block asserted a subset of the same invariant from a second hand-maintained list; scripts/set-version.test.mjs now owns it.
|
Responded to review round 1, pushed 9213e16:
Typecheck, the full test suite (1120 tests), and |
cb-jeeves
left a comment
There was a problem hiding this comment.
Since last round: 79c5e2c realigned the whole tree at 0.7.0 (check-version passes on this checkout), 9213e16 added a version lifecycle script that fans an npm version bump through set-version and refreshes the lockfile, and the duplicate cdk lockstep block is gone. All three round-1 threads are resolved as described. What remains is that the docs updated in this PR still describe the old bump path, plus one portability note on the new lifecycle script. None of these should hold up the merge for long.
The root version lifecycle script passed $npm_package_version as an argument, which only expands under a POSIX shell; on Windows npm runs scripts through cmd.exe and set-version received the literal string, so npm version aborted. The script now takes no argument under the lifecycle and reads process.env.npm_package_version when npm_lifecycle_event is 'version', which npm sets on every platform. README.md and okf-bundle/interfaces/packages.md still showed the bare set-version release path that leaves package-lock.json behind, and packages.md claimed releases stay manual. Both now document npm version as the bump command and name the lockfile step for the bare path.
|
Responded to review round 2, pushed 8e2b613:
Typecheck, the full test suite (1122 tests), and |
cb-jeeves
left a comment
There was a problem hiding this comment.
Since last round: 8e2b613 moved the lifecycle bump from $npm_package_version in the script line to a resolveVersion fallback inside set-version.mjs, added two CLI tests for it, and rewrote the release docs in README.md and packages.md around npm version. All three round-2 threads are resolved as described, and check-version passes on this checkout. Nothing here blocks the merge. Three small suggestions inline: the lifecycle script stages untracked files into the tagged release commit, the new tests would still pass if the fallback were deleted, and the docs do not say that npm version commits and tags.
… npm_package_version path git add -u keeps untracked files under packages/ out of the release commit that npm version creates and tags. resolveVersion is exported and covered by a unit test plus a spawn test against a fixture copy of the script, so dropping the lifecycle fallback now fails the suite. README and packages.md say that npm version commits, tags v<version>, and needs a clean tree, and show the -m form that keeps the chore(release) commit convention.
|
Responded to review round 3, pushed 7006e24:
Typecheck, the full test suite (1124 tests), and |
cb-jeeves
left a comment
There was a problem hiding this comment.
Since last round: 7006e24 switched the lifecycle staging to git add -u, exported resolveVersion with a unit test plus a fixture-based spawn test that fails if the fallback is removed, and documented that npm version commits, tags, and needs a clean tree. All three round-3 threads are resolved as described, and check-version passes on this checkout. One thing remains, and it is new in this commit: the --no-git-tag-version path the docs now recommend leaves the root package.json unstaged, so following the docs produces the exact drift the CI check exists to catch. One-word fix in the lifecycle script, then this is ready.
|
Responded to review round 4, pushed c5b0ec1:
Typecheck, the full test suite (1124 tests), and |
cb-jeeves
left a comment
There was a problem hiding this comment.
Since last round: c5b0ec1 added package.json to the lifecycle script's git add -u pathspec, so the --no-git-tag-version path the docs recommend now stages the root manifest along with the package manifests and lockfile. That was the only open thread from round 4 and it is resolved as described. check-version passes on this checkout. Nothing blocks the merge. One minor style suggestion inline on the new test file; take it or leave it.
Replace the per-test try/finally rmSync blocks with the module-level tmpdirs registry and afterEach hook the other temp-dir tests use, so a fixture is removed even when a test creates it outside its own guard.
|
Responded to review round 5, pushed 3b3c80c:
Typecheck, the full test suite (1124 tests), and |
This branch assembles the listed issues for review.
Issues in this consist
Closes #35
What & why
Adds a GitHub Actions workflow that runs the repo's typecheck, test, and build scripts on pull requests and pushes to main, plus a new
check-versionscript that verifies every workspace manifest, internal@copperbox/millwright-*ranges, and embeddedVERSIONconstants agree with the root version.Changes
.github/workflows/ci.yml: singleverifyjob (Node 22, npm cache,contents: read, cancel-in-progress per ref) runningnpm ci, typecheck, test, build, thennpm run check-version.scripts/set-version.mjs: split into exportedapplyVersionandcheckLockstep, with a guarded CLI entrypoint.--check(no version arg) reports every out-of-sync manifest/range/constant and exits non-zero;--check <version>is a usage error.package.json: newcheck-versionscript wrappingset-version.mjs --check.scripts/set-version.test.mjs: fixture-tree coverage for both functions and CLI argument handling, including a--checkrun against this repo.Review notes
ci.ymlwasn't reachable from this environment — worth a sanity check against any existing CI conventions.set-versionstill doesn't touchpackage-lock.json; a release needsnpm install --package-lock-onlyafter bumping, same as before.