chaos-jetzt-nixfiles/.github/workflows/build-systems.yaml
Moritz 'e1mo' Fromm b8f968dc23
Rework diff-hosts
Now it'll detect wether there are changes to a hosts closure at all,
lists build failures as such and is able to handle newly added or
removed hosts.
2023-08-05 14:35:46 +02:00

49 lines
1.8 KiB
YAML

name: "Build system config"
on:
pull_request:
workflow_dispatch:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@v4
- name: Run the Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@v2
- name: nix flake check
run: |
nix flake check --no-build
echo "## \`nix flake check\` succeeded" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
- name: Discover nixosConfigurations
run: |
echo Discovered the following system configs
nix flake show . --json | jq ".nixosConfigurations|keys[]" -r
- name: Build systems
id: build
run: |
echo "## Builds succeeded" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Host | Out path |" >> $GITHUB_STEP_SUMMARY
echo "| ---- | -------- |" >> $GITHUB_STEP_SUMMARY
for host in $(nix flake show . --json | jq ".nixosConfigurations|keys[]" -r); do
echo "::group::Building ${host}"
drv=".#nixosConfigurations.$host.config.system.build.toplevel"
build_cmd="nix build ${drv}"
#cachix watch-exec chaos-jetzt-nixfiles -- $build_cmd
$build_cmd
echo "::endgroup::"
out_path=$($build_cmd --print-out-paths)
echo -e "\x1b[32;1mSuccessfully built .#nixosConfigurations.${host}\x1b[0m"
echo "| ${host} | \`${out_path}\` |" >> $GITHUB_STEP_SUMMARY
done
- name: Diff closures
# Still would like to see the changes for the non-failing hosts
if: ${{ success() }} || ${{ failure() }}
run: ./.github/scripts/diff-hosts.sh