Skip to content

Build in CI

The wire build command ^1.1.0

wire build builds nodes locally. It is distinct from wire apply build, as it will not ping or push the result, making it useful for CI.

It accepts the same --on argument as wire apply does.

Partitioning builds

wire build accepts a --partition option inspired by cargo-nextest, which splits selected nodes into buckets to be built separately.

It accepts values in the format --partition current/total, where 1 ≤ current ≤ total.

For example, these two commands will build the entire hive in two invocations:

sh
wire build --partition 1/2

# later or synchronously:

wire build --partition 2/2

Example: Build in Github Actions

.github/workflows/build.yml
yml
name: Build

on:
  push:
    branches: [main]

jobs:
  build-partitioned:
    name: Build Partitioned
    runs-on: ubuntu-latest
    permissions: {}
    strategy:
      matrix:
        # Break into 4 partitions
        partition: [1, 2, 3, 4]
    steps:
      - uses: actions/checkout@v6
        with:
          persist-credentials: false
      # This will likely be required if you have multiple architectures
      # in your hive.
      - name: Set up QEMU
        uses: docker/setup-qemu-action@c7c53464625b32c7a7e944ae62b3e17d2b600130
      - uses: cachix/install-nix-action@4e002c8ec80594ecd40e759629461e26c8abed15
        with:
          nix_path: nixpkgs=channel:nixos-unstable
          extra_nix_config: |
            # Install binary cache as described in the install wire guide
            trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g=
            substituters = https://cache.nixos.org/ https://cache.garnix.io

            # Again, include additional architectures if you have multiple
            # architectures in your hive
            extra-platforms = aarch64-linux i686-linux
      # Uses wire from your shell (as described in the install wire guide).
      - name: Build partition ${{ matrix.partition }}
        run: nix develop -Lvc wire \
          build \
          --parallel 1 \
          --partition ${{ matrix.partition }}/4