From e7d9f5caf6e1cf2f805e7956d60c05182e090af8 Mon Sep 17 00:00:00 2001 From: SebastianStork Date: Sat, 7 Mar 2026 20:16:09 +0100 Subject: [PATCH] ci: Re-add build jobs for packages and workstations --- .github/workflows/build-host.yml | 30 +++++++++++++++ .github/workflows/ci.yml | 63 +++++++++++++++++++++++--------- 2 files changed, 76 insertions(+), 17 deletions(-) create mode 100644 .github/workflows/build-host.yml diff --git a/.github/workflows/build-host.yml b/.github/workflows/build-host.yml new file mode 100644 index 0000000..392691a --- /dev/null +++ b/.github/workflows/build-host.yml @@ -0,0 +1,30 @@ +name: Build host +on: + workflow_call: + inputs: + hosts: + required: true + type: string + secrets: + CACHIX_AUTH_TOKEN: + required: true +jobs: + build-host: + name: ${{ matrix.host }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + host: ${{ fromJson(inputs.hosts) }} + steps: + - uses: actions/checkout@v5 + - uses: cachix/install-nix-action@v31 + with: + extra_nix_config: experimental-features = nix-command flakes pipe-operators + - uses: cachix/cachix-action@v15 + with: + name: sebastian-stork + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + useDaemon: false + - name: Build host + run: nix build .#nixosConfigurations.${{ matrix.host }}.config.system.build.toplevel --print-build-logs diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b3d65af..6457516 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,11 @@ jobs: - uses: cachix/install-nix-action@v31 with: extra_nix_config: experimental-features = nix-command flakes pipe-operators + - name: Get packages + id: packages + run: | + packages=$(nix flake show --json | jq -c '.packages."x86_64-linux" | keys') + printf "packages=%s" "$packages" >> "$GITHUB_OUTPUT" - name: Get checks id: checks run: | @@ -33,6 +38,35 @@ jobs: |> builtins.filter (hostName: configs.${hostName}.config.custom.services.comin.enable) ' --json) printf "servers=%s" "$servers" >> "$GITHUB_OUTPUT" + - name: Get workstations + id: workstations + run: | + workstations=$(nix eval .#nixosConfigurations --apply 'configs: + configs + |> builtins.attrNames + |> builtins.filter (hostName: !configs.${hostName}.config.custom.services.comin.enable) + ' --json) + printf "workstations=%s" "$workstations" >> "$GITHUB_OUTPUT" + build-package: + name: ${{ matrix.package }} + needs: parse-flake + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + package: ${{ fromJson(needs.parse-flake.outputs.packages) }} + steps: + - uses: actions/checkout@v5 + - uses: cachix/install-nix-action@v31 + with: + extra_nix_config: experimental-features = nix-command flakes pipe-operators + - uses: cachix/cachix-action@v15 + with: + name: sebastian-stork + authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" + useDaemon: false + - name: Build package + run: nix build .#packages.x86_64-linux.${{ matrix.package }} --print-build-logs build-check: name: ${{ matrix.check }} needs: parse-flake @@ -56,23 +90,18 @@ jobs: build-server: name: ${{ matrix.server }} needs: parse-flake - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - server: ${{ fromJson(needs.parse-flake.outputs.servers) }} - steps: - - uses: actions/checkout@v5 - - uses: cachix/install-nix-action@v31 - with: - extra_nix_config: experimental-features = nix-command flakes pipe-operators - - uses: cachix/cachix-action@v15 - with: - name: sebastian-stork - authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}" - useDaemon: false - - name: Build server - run: nix build .#nixosConfigurations.${{ matrix.server }}.config.system.build.toplevel --print-build-logs + uses: ./.github/workflows/build-host.yml + with: + hosts: ${{ needs.parse-flake.outputs.servers }} + secrets: + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} + build-workstation: + needs: parse-flake + uses: ./.github/workflows/build-host.yml + with: + hosts: ${{ needs.parse-flake.outputs.workstations }} + secrets: + CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} trigger-deploy: needs: [build-check, build-server] runs-on: ubuntu-latest