Skip to content

Commit a495cd2

Browse files
committed
feat: use blacksmith for nixos tests on aarch64-linux
1 parent 5acf917 commit a495cd2

3 files changed

Lines changed: 26 additions & 16 deletions

File tree

nix/ext/tests/pgrouting.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pkgs.testers.runNixOSTest {
3636
in
3737
''
3838
from pathlib import Path
39+
3940
versions = {
4041
"15": [${lib.concatStringsSep ", " (map (s: ''"${s}"'') (versions "15"))}],
4142
"17": [${lib.concatStringsSep ", " (map (s: ''"${s}"'') (versions "17"))}],

nix/packages/github-matrix/github_matrix.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -81,10 +81,6 @@ class NixEvalError(TypedDict):
8181
"group": "self-hosted-runners-nix",
8282
"labels": ["aarch64-darwin"],
8383
},
84-
"aarch64-linux": {
85-
"group": "self-hosted-runners-nix",
86-
"labels": ["aarch64-linux"],
87-
},
8884
},
8985
}
9086

@@ -251,18 +247,21 @@ def get_runner_for_package(pkg: NixEvalJobsOutput) -> RunsOnConfig | None:
251247
"""Determine the appropriate GitHub Actions runner for a package.
252248
253249
Priority order:
254-
1. KVM packages → self-hosted runners
255-
2. Large packages on Linux → 32vcpu ephemeral runners
256-
3. Darwin packages → self-hosted runners
257-
4. Default → ephemeral runners
250+
1. KVM packages on Darwin → self-hosted runners
251+
2. KVM packages on Linux → ephemeral runners
252+
3. Large packages on Linux → 32vcpu ephemeral runners
253+
4. Darwin packages → self-hosted runners
254+
5. Default → ephemeral runners
258255
"""
259256
system = pkg["system"]
260257

261258
if is_kvm_pkg(pkg):
262-
runConfig = BUILD_RUNNER_MAP["self-hosted"].get(system)
259+
if system == "aarch64-darwin":
260+
return BUILD_RUNNER_MAP["self-hosted"]["aarch64-darwin"]
261+
runConfig = BUILD_RUNNER_MAP["ephemeral"].get(system)
263262
if runConfig is None:
264263
raise ValueError(
265-
f"No self-hosted with kvm support available for system: {system}"
264+
f"No ephemeral runner with kvm support available for system: {system}"
266265
)
267266
return runConfig
268267

nix/packages/github-matrix/tests/test_github_matrix.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,8 @@ def test_kvm_package_x86_64_linux(self):
103103
"system": "x86_64-linux",
104104
"requiredSystemFeatures": ["kvm"],
105105
}
106-
with pytest.raises(
107-
ValueError,
108-
match=r"No self-hosted with kvm support available for system: x86_64-linux",
109-
):
110-
get_runner_for_package(pkg)
106+
result = get_runner_for_package(pkg)
107+
assert result == {"labels": ["blacksmith-8vcpu-ubuntu-2404"]}
111108

112109
def test_kvm_package_aarch64_linux(self):
113110
pkg: NixEvalJobsOutput = {
@@ -120,9 +117,22 @@ def test_kvm_package_aarch64_linux(self):
120117
"requiredSystemFeatures": ["kvm"],
121118
}
122119
result = get_runner_for_package(pkg)
120+
assert result == {"labels": ["blacksmith-8vcpu-ubuntu-2404-arm"]}
121+
122+
def test_kvm_package_aarch64_darwin(self):
123+
pkg: NixEvalJobsOutput = {
124+
"attr": "packages.aarch64-darwin.vm-test",
125+
"attrPath": ["packages", "aarch64-darwin", "vm-test"],
126+
"cacheStatus": "notBuilt",
127+
"drvPath": "/nix/store/test.drv",
128+
"name": "vm-test",
129+
"system": "aarch64-darwin",
130+
"requiredSystemFeatures": ["kvm"],
131+
}
132+
result = get_runner_for_package(pkg)
123133
assert result == {
124134
"group": "self-hosted-runners-nix",
125-
"labels": ["aarch64-linux"],
135+
"labels": ["aarch64-darwin"],
126136
}
127137

128138
def test_large_package_x86_64_linux(self):

0 commit comments

Comments
 (0)