name: Build on: pull_request: push: jobs: build: strategy: matrix: include: - label: x86_64-linux image: ubuntu-latest - label: aarch64-linux image: ubuntu-latest system: aarch64-linux - label: aarch64-darwin image: macos-latest system: aarch64-darwin name: ${{ matrix.label }} runs-on: ${{ matrix.image }} steps: - uses: actions/checkout@v7.0.1 - name: Install Nix uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23 continue-on-error: true # Self-hosted runners already have Nix installed - name: Set up QEMU uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0 if: matrix.system == 'aarch64-linux' - name: Generate System Flags run: | LOCAL_SYSTEM=$(nix-instantiate --eval --json -E 'builtins.currentSystem' | jq -r) HOST_SYSTEM=${HOST_SYSTEM:-$LOCAL_SYSTEM} if [[ "$LOCAL_SYSTEM" != "$HOST_SYSTEM" ]]; then echo "system_flags=--system $HOST_SYSTEM" >>"$GITHUB_ENV" echo "extra-platforms = $HOST_SYSTEM" | sudo tee -a /etc/nix/nix.conf fi env: HOST_SYSTEM: '${{ matrix.system }}' - name: Enable Binary Cache uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 with: name: colmena authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build Colmena run: nix build -L $system_flags - name: Build manual run: nix build .#manual -L nix-matrix: runs-on: ubuntu-latest outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - uses: actions/checkout@v7.0.1 - name: Install Nix uses: DeterminateSystems/nix-installer-action@3138316df39ed29be04236d7ffc686fa525866aa # v23 continue-on-error: true # Self-hosted runners already have Nix installed - name: Enable Binary Cache uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 with: name: colmena authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - id: set-matrix name: Generate Nix Matrix run: | set -Eeu matrix="$(nix eval --json '.#githubActions.matrix')" echo "matrix=$matrix" >> "$GITHUB_OUTPUT" nix-matrix-job: name: ${{ matrix.name }} runs-on: ${{ matrix.os }} needs: - build - nix-matrix strategy: matrix: ${{ fromJSON(needs.nix-matrix.outputs.matrix) }} steps: - uses: actions/checkout@v7.0.1 - name: Reclaim uses: wimpysworld/nothing-but-nix@main - name: Install Nix uses: NixOS/nix-installer-action@main with: extra-conf: | accept-flake-config = true build-dir = /nix/build experimental-features = nix-command flakes - name: Enable Binary Cache uses: cachix/cachix-action@0fc020193b5a1fa3ac4575aa3a7d3aa6a35435ad # v16 with: name: colmena authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' - name: Build ${{ matrix.attr }} run: | nix build --no-link --print-out-paths -L '.#${{ matrix.attr }}'