Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

ci: cache Nix builds in the Nix Linux lane (#4098)

Francesco Bonaccib227ebf07709
diff --git a/.github/scripts/tests/test_ci_nix_linux_paths.py b/.github/scripts/tests/test_ci_nix_linux_paths.py
index 9275c13cf7..e1b718b396 100644
--- a/.github/scripts/tests/test_ci_nix_linux_paths.py
+++ b/.github/scripts/tests/test_ci_nix_linux_paths.py
@@ -80,7 +80,15 @@ class TestCiNixLinuxPaths(unittest.TestCase):
"docs/public/img/cua-driver/cursor-themes/delivery-target-context.gif",
)
- self.assertEqual(self.workflow.count(" - name:"), 5)
+ for attribute in (
+ "cua-compositor-build",
+ "cua-driver-build",
+ "cua-driver-linux-rust-unit",
+ "cua-driver-policy-yaml",
+ "cua-driver-policy-rego",
+ ):
+ with self.subTest(attribute=attribute):
+ self.assertIn(attribute, self.workflow)
self.assertFalse(self.workflow_selected(gallery_only))
def test_production_nix_and_workflow_changes_still_select_the_matrix(self) -> None:
diff --git a/.github/workflows/ci-nix-linux.yml b/.github/workflows/ci-nix-linux.yml
index 03ef85d167..2b4e969830 100644
--- a/.github/workflows/ci-nix-linux.yml
+++ b/.github/workflows/ci-nix-linux.yml
@@ -59,15 +59,17 @@ jobs:
matrix:
include:
- name: compositor build
- attribute: cua-compositor-build
- - name: driver package
- attribute: cua-driver-build
+ attributes: cua-compositor-build
- name: Rust unit tests
- attribute: cua-driver-linux-rust-unit
- - name: YAML policy VM
- attribute: cua-driver-policy-yaml
- - name: Rego policy VM
- attribute: cua-driver-policy-rego
+ attributes: cua-driver-linux-rust-unit
+ # Both policy VMs boot the cua-driver package derivation. Building
+ # them in the same job as the package compiles the workspace once
+ # and reuses it from the local store, instead of once per job.
+ - name: driver package and policy VMs
+ attributes: >-
+ cua-driver-build
+ cua-driver-policy-yaml
+ cua-driver-policy-rego
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- name: Install Nix
@@ -75,8 +77,20 @@ jobs:
with:
extra_nix_config: |
experimental-features = nix-command flakes
+ # Shares built store paths between workflow runs through the GitHub
+ # Actions cache. Pull requests read main's entries but write only to
+ # their own ref scope, so they cannot poison main.
+ - name: Cache Nix store paths
+ uses: DeterminateSystems/magic-nix-cache-action@84c0677f58dcedf3b91f8223ce36a9ea5b3c84b7 # v15
+ with:
+ use-flakehub: disabled
+ diagnostic-endpoint: ""
- name: Build ${{ matrix.name }}
- run: >-
- nix build
- .#checks.x86_64-linux.${{ matrix.attribute }}
- --no-link --print-build-logs --show-trace
+ env:
+ ATTRIBUTES: ${{ matrix.attributes }}
+ run: |
+ targets=()
+ for attribute in $ATTRIBUTES; do
+ targets+=(".#checks.x86_64-linux.${attribute}")
+ done
+ nix build "${targets[@]}" --no-link --print-build-logs --show-trace