Merge pull request #13 from chaos-jetzt/gh-actions-quality-of-life

CODEOWNERS and GitHub actions
This commit is contained in:
Moritz 2023-02-20 17:15:27 +01:00 committed by GitHub
commit 948664e5dc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 56 additions and 0 deletions

55
.github/workflows/build-systems.yaml vendored Normal file
View file

@ -0,0 +1,55 @@
name: "Build system config"
on:
pull_request:
push:
jobs:
avoid_duplicates:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
# All of these options are optional, so you can remove them if you are happy with the defaults
concurrent_skipping: 'same_content_newer'
skip_after_successful_duplicate: 'true'
do_not_skip: '["workflow_dispatch", "schedule"]'
build:
runs-on: ubuntu-latest
needs: avoid_duplicates
if: needs.avoid_duplicates.outputs.should_skip != 'true'
steps:
- uses: actions/checkout@v3
- uses: cachix/install-nix-action@v19
with:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
- uses: cachix/cachix-action@v12
with:
name: chaos-jetzt-nixfiles
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- 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
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
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

1
CODEOWNERS Normal file
View file

@ -0,0 +1 @@
* @chaos-jetzt/infra