Repository navigation
Commit 85aa44b
authored
perf(release): publish without the Nix dev shell (#1257)
* perf(ccusage): drop schema regeneration from the publish build
The publish build ran `generate:schema`, which compiles and runs the Rust
`generate-config-schema` binary on every `pnpm publish` and pkg-pr-new pack.
The committed apps/ccusage/config-schema.json is already kept in sync with the
Rust source by the `nix flake check` schema-drift check, so regenerating it
during packaging is redundant: it adds cargo build time and a hard Rust
toolchain dependency to the publish path.
`build` now runs only `tsdown` and `ensure:native-binary`. The `generate:schema`
script stays for local regeneration (`pnpm --filter ccusage run generate:schema`
and `just schema`).
* ci(release): publish to npm without the Nix dev shell
The npm publish job runs on a GitHub-hosted runner (required for npm
provenance, which rejects self-hosted/Blacksmith runners), so it never gets the
Blacksmith sticky-disk Nix cache and re-downloaded the full dev shell (Rust
toolchain, litellm, etc.) from cache.nixos.org on every release — ~5 minutes of
the ~7-minute job for a task that only needs node, pnpm and bun.
Now that the publish build no longer invokes cargo, drop `nix develop` and set
up the toolchain directly: pnpm/action-setup (reads packageManager), setup-node,
then `pnpm install --frozen-lockfile`, which downloads the bun runtime declared
in engines.runtime so the `ensure:native-binary` script resolves it from
node_modules/.bin during packaging.
* ci: scope the Blacksmith sticky-disk Nix store per job
The sticky-disk key was shared across every Linux job of the same arch. A
sticky disk clones the last committed snapshot and re-commits on completion, so
jobs that realize different Nix closures (a full dev shell vs. a single
`nix build`) overwrote each other's store on the shared key, forcing cold
re-downloads from cache.nixos.org — the source of the large run-to-run variance
in pkg-pr-new (149s vs 388s).
Key the disk by `github.job` so each closure stays warm independently.
* ci(release): provision pnpm from the pinned Nix profile
Replace pnpm/action-setup with `nix profile install --inputs-from . nixpkgs#pnpm`
so the publish toolchain is pinned to the flake's locked nixpkgs (pnpm 11.1.1,
identical to the dev shell) instead of a separate action's resolution, while
still avoiding the full `nix develop` dev shell that made the job slow.
setup-node stays solely for the npm publish configuration (registry + OIDC
provenance .npmrc wiring); the locked nixpkgs node is below the engines floor,
so node is sourced from setup-node. bun is not installed here — `pnpm install`
downloads it via engines.runtime into node_modules/.bin, where the prepack
`ensure:native-binary` script resolves it.1 parent b7948ab commit 85aa44b
3 files changed
Lines changed: 10 additions & 3 deletions
File tree
- .github
- actions/setup-linux-blacksmith-sticky-disk
- workflows
- apps/ccusage
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
90 | 90 | | |
91 | 91 | | |
92 | 92 | | |
| 93 | + | |
| 94 | + | |
93 | 95 | | |
94 | 96 | | |
95 | 97 | | |
| |||
100 | 102 | | |
101 | 103 | | |
102 | 104 | | |
103 | | - | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
| 32 | + | |
33 | 33 | | |
34 | 34 | | |
35 | 35 | | |
| |||
0 commit comments