Skip to content

Commit cb71db9

Browse files
committed
ci: avoid macOS devenv stalls
1 parent e516137 commit cb71db9

2 files changed

Lines changed: 13 additions & 5 deletions

File tree

.github/workflows/test.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,13 @@ jobs:
3232
- name: Install devenv.sh
3333
run: nix profile install nixpkgs#devenv
3434

35-
- name: Build the devenv shell and run any pre-commit hooks
36-
run: devenv test
35+
# `devenv test` also starts every configured process. The docs dev server is
36+
# unrelated to this suite and makes process-compose wait for its timeout when
37+
# docs dependencies are not installed, so run the hooks and tests directly.
38+
- name: Run pre-commit hooks
39+
run: devenv tasks run devenv:git-hooks:run --show-output
40+
- name: Run tests
41+
run: devenv shell -- cargo test --all
3742

3843
# Windows runners can't run Nix/devenv, so the suite runs here natively via
3944
# rustup + cargo. This exists specifically to catch Windows-only path handling

devenv.nix

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{ pkgs, ... }: {
1+
{ lib, pkgs, ... }: {
22
languages.rust = {
33
enable = true;
44
# The Rust version is pinned in rust-toolchain.toml, which the native CI
@@ -69,6 +69,8 @@
6969
];
7070

7171
# Fully-static musl build of the Go SDK (-tags static + -extldflags -static).
72+
# Keep these Linux-only: interpolating the cross-toolchain paths on macOS makes
73+
# Nix build a Linux-targeting GCC toolchain from source just to enter the shell.
7274
# The musl C cross-toolchain and static libdbus/libunwind are referenced HERE by
7375
# absolute path only -- NOT added to `packages`, because devenv `packages` inject
7476
# their lib dirs into the host NIX_LDFLAGS, which would make the ordinary glibc
@@ -77,7 +79,7 @@
7779
# the host build environment. The CC_/linker vars are musl-target-scoped, so host
7880
# (glibc) cargo builds are unaffected; MUSL_CC / MUSL_STATIC_LDFLAGS feed the cgo
7981
# step so the final binary statically links libdbus + libunwind.
80-
env =
82+
env = lib.optionalAttrs pkgs.stdenv.isLinux (
8183
let
8284
muslcc = "${pkgs.pkgsCross.musl64.stdenv.cc}/bin/x86_64-unknown-linux-musl-gcc";
8385
in
@@ -86,7 +88,8 @@
8688
CARGO_TARGET_X86_64_UNKNOWN_LINUX_MUSL_LINKER = muslcc;
8789
MUSL_CC = muslcc;
8890
MUSL_STATIC_LDFLAGS = "-L${pkgs.pkgsStatic.dbus.lib}/lib -L${pkgs.pkgsStatic.libunwind}/lib";
89-
};
91+
}
92+
);
9093

9194
git-hooks.hooks = {
9295
rustfmt.enable = true;

0 commit comments

Comments
 (0)