2024-02-24 23:55:58 +00:00
|
|
|
name: nix
|
2022-02-20 20:48:51 +00:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
2022-05-06 16:03:56 +00:00
|
|
|
- main
|
2022-02-20 20:48:51 +00:00
|
|
|
pull_request:
|
|
|
|
|
2022-03-16 19:18:01 +00:00
|
|
|
permissions: read-all
|
|
|
|
|
2022-02-20 20:48:51 +00:00
|
|
|
jobs:
|
|
|
|
nix:
|
2024-02-24 23:55:58 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, macos-14]
|
|
|
|
runs-on: ${{ matrix.os }}
|
2024-02-23 07:20:19 +00:00
|
|
|
timeout-minutes: 15 # NOTE (aseipp): keep in-sync with the build.yml timeout limit
|
2024-02-24 23:55:58 +00:00
|
|
|
|
|
|
|
name: flake check
|
2022-02-20 20:48:51 +00:00
|
|
|
steps:
|
2023-10-18 15:15:28 +00:00
|
|
|
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
|
2022-02-20 20:48:51 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2023-12-05 15:16:02 +00:00
|
|
|
- uses: DeterminateSystems/nix-installer-action@cd46bde16ab981b0a7b2dce0574509104543276e
|
2024-02-02 15:22:21 +00:00
|
|
|
- uses: DeterminateSystems/magic-nix-cache-action@eeabdb06718ac63a7021c6132129679a8e22d0c7
|
github(nix): don't build everything twice
When running the `nix build`, the `buildRustPackage` function -- which builds
the `jj` crates -- calls `cargo build --release` with flags like `HOST_CXX`
set. This is called the `buildPhase`. Then, it runs the `checkPhase`, which
calls `cargo nextest`, in our case. However, it does not set `HOST_CXX`, for
some reason.
The intent of `buildRustPackage` is that the `buildPhase` and `checkPhase`
have their compilation options fully aligned so that they reuse the local cargo
`target/` cache directory, avoiding a full recompilation. However, the lack
of `HOST_CXX` above among others causes a cache miss, and a bunch of cascading
recompilations. The net impact is that we compile all of the codebase once in
`buildPhase`, then again in `checkPhase`, making the Nix CI build 2x slower on
average than the other Linux runners; 2-3 minutes versus 7 minutes, on average.
Instead, re-introduce a 'check' into the Flake directly, which overrides the
`jujustsu` package, but stubs out the `buildPhase`. This means it will only run
`checkPhase`, which is what we want. Then, modify the CI to run `nix flake check`
again, like it used to in the past.
Unfortunately, this doesn't fix the cache miss when running `nix build`
yourself, it recompiles from scratch in both phases still. That needs to be
fixed in the future, but it's tolerable for now.
This reverts most of 71a3045032f512.
Signed-off-by: Austin Seipp <aseipp@pobox.com>
2024-02-22 01:50:47 +00:00
|
|
|
- run: nix flake check -L --show-trace
|