diff --git a/.github/actions/nix-install-ephemeral/action.yml b/.github/actions/nix-install-ephemeral/action.yml index 5dbdabe8e8..ac2ca9c028 100644 --- a/.github/actions/nix-install-ephemeral/action.yml +++ b/.github/actions/nix-install-ephemeral/action.yml @@ -49,3 +49,7 @@ runs: trusted-public-keys = nix-postgres-artifacts:dGZlQOvKcNEjvT7QEAJbcV6b6uk7VF/hWMjhYleiaLI= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= ${{ inputs.push-to-cache == 'true' && 'post-build-hook = /etc/nix/upload-to-cache.sh' || '' }} max-jobs = 4 + - name: Test KVM support + shell: bash + run: | + ls -l /dev/kvm || echo "KVM support not available" diff --git a/nix/ext/tests/pgrouting.nix b/nix/ext/tests/pgrouting.nix index f6fee222e6..61aa7624ff 100644 --- a/nix/ext/tests/pgrouting.nix +++ b/nix/ext/tests/pgrouting.nix @@ -36,6 +36,7 @@ pkgs.testers.runNixOSTest { in '' from pathlib import Path + versions = { "15": [${lib.concatStringsSep ", " (map (s: ''"${s}"'') (versions "15"))}], "17": [${lib.concatStringsSep ", " (map (s: ''"${s}"'') (versions "17"))}], diff --git a/nix/packages/github-matrix/github_matrix.py b/nix/packages/github-matrix/github_matrix.py index 81385c2151..6ee6ba1978 100755 --- a/nix/packages/github-matrix/github_matrix.py +++ b/nix/packages/github-matrix/github_matrix.py @@ -81,10 +81,6 @@ class NixEvalError(TypedDict): "group": "self-hosted-runners-nix", "labels": ["aarch64-darwin"], }, - "aarch64-linux": { - "group": "self-hosted-runners-nix", - "labels": ["aarch64-linux"], - }, }, } @@ -251,18 +247,21 @@ def get_runner_for_package(pkg: NixEvalJobsOutput) -> RunsOnConfig | None: """Determine the appropriate GitHub Actions runner for a package. Priority order: - 1. KVM packages → self-hosted runners - 2. Large packages on Linux → 32vcpu ephemeral runners - 3. Darwin packages → self-hosted runners - 4. Default → ephemeral runners + 1. KVM packages on Darwin → self-hosted runners + 2. KVM packages on Linux → ephemeral runners + 3. Large packages on Linux → 32vcpu ephemeral runners + 4. Darwin packages → self-hosted runners + 5. Default → ephemeral runners """ system = pkg["system"] if is_kvm_pkg(pkg): - runConfig = BUILD_RUNNER_MAP["self-hosted"].get(system) + if system == "aarch64-darwin": + return BUILD_RUNNER_MAP["self-hosted"]["aarch64-darwin"] + runConfig = BUILD_RUNNER_MAP["ephemeral"].get(system) if runConfig is None: raise ValueError( - f"No self-hosted with kvm support available for system: {system}" + f"No ephemeral runner with kvm support available for system: {system}" ) return runConfig diff --git a/nix/packages/github-matrix/tests/test_github_matrix.py b/nix/packages/github-matrix/tests/test_github_matrix.py index 17ce8132db..50d3177df4 100644 --- a/nix/packages/github-matrix/tests/test_github_matrix.py +++ b/nix/packages/github-matrix/tests/test_github_matrix.py @@ -103,11 +103,8 @@ def test_kvm_package_x86_64_linux(self): "system": "x86_64-linux", "requiredSystemFeatures": ["kvm"], } - with pytest.raises( - ValueError, - match=r"No self-hosted with kvm support available for system: x86_64-linux", - ): - get_runner_for_package(pkg) + result = get_runner_for_package(pkg) + assert result == {"labels": ["blacksmith-8vcpu-ubuntu-2404"]} def test_kvm_package_aarch64_linux(self): pkg: NixEvalJobsOutput = { @@ -120,9 +117,22 @@ def test_kvm_package_aarch64_linux(self): "requiredSystemFeatures": ["kvm"], } result = get_runner_for_package(pkg) + assert result == {"labels": ["blacksmith-8vcpu-ubuntu-2404-arm"]} + + def test_kvm_package_aarch64_darwin(self): + pkg: NixEvalJobsOutput = { + "attr": "packages.aarch64-darwin.vm-test", + "attrPath": ["packages", "aarch64-darwin", "vm-test"], + "cacheStatus": "notBuilt", + "drvPath": "/nix/store/test.drv", + "name": "vm-test", + "system": "aarch64-darwin", + "requiredSystemFeatures": ["kvm"], + } + result = get_runner_for_package(pkg) assert result == { "group": "self-hosted-runners-nix", - "labels": ["aarch64-linux"], + "labels": ["aarch64-darwin"], } def test_large_package_x86_64_linux(self):