Appearance
Commit check
check-commits proves that each commit of a branch installs, passes its checks and builds by itself.
Run it
From the root of the repository, give the base and the head of the branch:
sh
node tools/pr-prep/check-commits.ts origin/main HEADThe report gives one row for each commit and one column for each check. After the table, a line tells how many commits had a tree that already passed.
What it runs
For each commit, the check runs these steps:
- It checks that only a
docsorinstructioncommit changes Markdown. - It runs commitlint on the commit message, with the commitlint configuration of the checkout.
- In a new worktree of the commit, it runs
npm ciand each of thetest,lint,lint:markdown,lint:proseandbuildscripts.
Speed
Two features speed up the check:
- The check keeps the result of each tree that passed every step, in
pr-prep-cachein the Git directory. A commit can have the same tree, the same Node.js major version and the same scripts as a tree that passed. Then the check uses the old result and does not make a worktree. A new commit message does not change the tree, so a rebuilt stack reuses most results. - The check runs several worktrees at the same time. By default, it uses half of the processors of the machine.
Two environment variables change this behavior:
PR_PREP_JOBSsets the number of worktrees that run at the same time.PR_PREP_NO_CACHEstops the check from reading or writing the cache.
CI starts with an empty cache, so CI checks each commit in full.