Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

ci(nix): cut the node_modules check to one build on a faster Mac (#9717)

teo7e4391687aac
diff --git a/.github/workflows/check_node_modules_nix.yml b/.github/workflows/check_node_modules_nix.yml
index 2bd88fe35b..c7e60a7a9e 100644
--- a/.github/workflows/check_node_modules_nix.yml
+++ b/.github/workflows/check_node_modules_nix.yml
@@ -41,17 +41,21 @@ jobs:
uses: './.github/actions/setup-nix'
- name: verify js node_modules derivation is up to date
run: |
- # The first build ensures the output exists. The rebuild then forces Nix
- # to validate it instead of accepting a cached fixed-output derivation
- # whose hash predates a bun.lock or package manifest change.
- nix build .#js-node-modules --no-link
- nix build .#js-node-modules --no-link --rebuild
+ # A fixed-output derivation already in the store is accepted without
+ # running it, whatever bun.lock now says, so only then does the check
+ # need a rebuild. On a store without it, the first build is the check.
+ out=$(nix eval --raw .#js-node-modules.outPath)
+ if nix-store --check-validity "$out" 2>/dev/null; then
+ nix build .#js-node-modules --no-link --rebuild
+ else
+ nix build .#js-node-modules --no-link
+ fi
- name: Teardown Nix
if: always()
uses: './.github/actions/teardown-nix'
check-darwin-node-modules-nix:
name: check Darwin node_modules nix
- runs-on: macos-15
+ runs-on: nscloud-macos-sequoia-arm64-6x14
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
@@ -85,8 +89,12 @@ jobs:
shell: bash
- name: verify js node_modules derivation is up to date
run: |
- # The first build ensures the output exists. The rebuild then forces Nix
- # to validate it instead of accepting a cached fixed-output derivation
- # whose hash predates a bun.lock or package manifest change.
- nix build .#js-node-modules --no-link
- nix build .#js-node-modules --no-link --rebuild
+ # A fixed-output derivation already in the store is accepted without
+ # running it, whatever bun.lock now says, so only then does the check
+ # need a rebuild. On a store without it, the first build is the check.
+ out=$(nix eval --raw .#js-node-modules.outPath)
+ if nix-store --check-validity "$out" 2>/dev/null; then
+ nix build .#js-node-modules --no-link --rebuild
+ else
+ nix build .#js-node-modules --no-link
+ fi
diff --git a/tooling/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rs b/tooling/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rs
index 57401da3aa..826bcb24ff 100644
--- a/tooling/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rs
+++ b/tooling/xtask/crates/xtask_workflows/src/workflows/check_node_modules_nix.rs
@@ -61,7 +61,7 @@ fn check_linux_node_modules_nix() -> Job {
fn check_darwin_node_modules_nix() -> Job {
Job::default()
.name("check Darwin node_modules nix")
- .runs_on("macos-15")
+ .runs_on(runners::Runner::MacOsArm.to_string())
.add_step(steps::checkout(false, false))
.add_step(assert_arm64())
.add_step(install_nix_macos())
@@ -88,10 +88,14 @@ fn install_nix_macos() -> Step<gh_workflow::Run> {
fn verify_node_modules_nix() -> Step<gh_workflow::Run> {
Step::new("verify js node_modules derivation is up to date").run(indoc::indoc! {r#"
- # The first build ensures the output exists. The rebuild then forces Nix
- # to validate it instead of accepting a cached fixed-output derivation
- # whose hash predates a bun.lock or package manifest change.
- nix build .#js-node-modules --no-link
- nix build .#js-node-modules --no-link --rebuild
+ # A fixed-output derivation already in the store is accepted without
+ # running it, whatever bun.lock now says, so only then does the check
+ # need a rebuild. On a store without it, the first build is the check.
+ out=$(nix eval --raw .#js-node-modules.outPath)
+ if nix-store --check-validity "$out" 2>/dev/null; then
+ nix build .#js-node-modules --no-link --rebuild
+ else
+ nix build .#js-node-modules --no-link
+ fi
"#})
}