mirror of
https://github.com/SebastianStork/nixos-config.git
synced 2026-03-22 21:19:07 +01:00
workflows/ci: Also build workstations but don't wait for them for deploying
This commit is contained in:
parent
9d46cb54df
commit
116ac08ad8
2 changed files with 58 additions and 24 deletions
29
.github/workflows/build-host.yml
vendored
Normal file
29
.github/workflows/build-host.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
name: Build host
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
hosts:
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
secrets:
|
||||||
|
CACHIX_AUTH_TOKEN:
|
||||||
|
required: true
|
||||||
|
jobs:
|
||||||
|
build-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
|
||||||
53
.github/workflows/ci.yml
vendored
53
.github/workflows/ci.yml
vendored
|
|
@ -8,7 +8,8 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
checks: ${{ steps.checks.outputs.checks }}
|
checks: ${{ steps.checks.outputs.checks }}
|
||||||
hosts: ${{ steps.hosts.outputs.hosts }}
|
servers: ${{ steps.servers.outputs.servers }}
|
||||||
|
workstations: ${{ steps.workstations.outputs.workstations }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v5
|
- uses: actions/checkout@v5
|
||||||
- uses: cachix/install-nix-action@v31
|
- uses: cachix/install-nix-action@v31
|
||||||
|
|
@ -19,15 +20,24 @@ jobs:
|
||||||
run: |
|
run: |
|
||||||
checks=$(nix flake show --json | jq -c '.checks."x86_64-linux" | keys')
|
checks=$(nix flake show --json | jq -c '.checks."x86_64-linux" | keys')
|
||||||
printf "checks=%s" "$checks" >> "$GITHUB_OUTPUT"
|
printf "checks=%s" "$checks" >> "$GITHUB_OUTPUT"
|
||||||
- name: Get hosts
|
- name: Get servers
|
||||||
id: hosts
|
id: servers
|
||||||
run: |
|
run: |
|
||||||
hosts=$(nix eval .#nixosConfigurations --apply 'configs:
|
servers=$(nix eval .#nixosConfigurations --apply 'configs:
|
||||||
configs
|
configs
|
||||||
|> builtins.attrNames
|
|> builtins.attrNames
|
||||||
|> builtins.filter (name: configs.${name}.config.custom.services.comin.enable)
|
|> builtins.filter (name: configs.${name}.config.custom.services.comin.enable)
|
||||||
' --json)
|
' --json)
|
||||||
printf "hosts=%s" "$hosts" >> "$GITHUB_OUTPUT"
|
printf "servers=%s" "$servers" >> "$GITHUB_OUTPUT"
|
||||||
|
- name: Get workstations
|
||||||
|
id: workstations
|
||||||
|
run: |
|
||||||
|
workstations=$(nix eval .#nixosConfigurations --apply 'configs:
|
||||||
|
configs
|
||||||
|
|> builtins.attrNames
|
||||||
|
|> builtins.filter (name: !configs.${name}.config.custom.services.comin.enable)
|
||||||
|
' --json)
|
||||||
|
printf "workstations=%s" "$workstations" >> "$GITHUB_OUTPUT"
|
||||||
build-check:
|
build-check:
|
||||||
needs: parse-flake
|
needs: parse-flake
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
@ -47,27 +57,22 @@ jobs:
|
||||||
useDaemon: false
|
useDaemon: false
|
||||||
- name: Build check
|
- name: Build check
|
||||||
run: nix build .#checks.x86_64-linux.${{ matrix.check }} --print-build-logs
|
run: nix build .#checks.x86_64-linux.${{ matrix.check }} --print-build-logs
|
||||||
build-host:
|
build-server:
|
||||||
needs: parse-flake
|
needs: parse-flake
|
||||||
runs-on: ubuntu-latest
|
uses: ./.github/workflows/build-host.yml
|
||||||
strategy:
|
with:
|
||||||
fail-fast: false
|
hosts: ${{ needs.parse-flake.outputs.servers }}
|
||||||
matrix:
|
secrets:
|
||||||
host: ${{ fromJson(needs.parse-flake.outputs.hosts) }}
|
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||||
steps:
|
build-workstation:
|
||||||
- uses: actions/checkout@v5
|
needs: parse-flake
|
||||||
- uses: cachix/install-nix-action@v31
|
uses: ./.github/workflows/build-host.yml
|
||||||
with:
|
with:
|
||||||
extra_nix_config: experimental-features = nix-command flakes pipe-operators
|
hosts: ${{ needs.parse-flake.outputs.workstations }}
|
||||||
- uses: cachix/cachix-action@v15
|
secrets:
|
||||||
with:
|
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }}
|
||||||
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
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: [build-check, build-host]
|
needs: [build-check, build-server]
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue