From 0bd5d2b2373643d97b60c6c0fb66b84a300375fe Mon Sep 17 00:00:00 2001 From: kat witch Date: Sun, 8 Aug 2021 21:34:35 +0100 Subject: [PATCH] CI changes (all hosts) --- .github/workflows/hosts.yml | 114 ++++++++++++++++++++++++++++++++++++ ci/hosts.nix | 2 +- ci/niv-cron.nix | 5 +- 3 files changed, 118 insertions(+), 3 deletions(-) diff --git a/.github/workflows/hosts.yml b/.github/workflows/hosts.yml index be4b658e..3df890f3 100644 --- a/.github/workflows/hosts.yml +++ b/.github/workflows/hosts.yml @@ -85,6 +85,120 @@ jobs: command: ci-build-cache quiet: false stdin: ${{ runner.temp }}/ci.build.cache + host-beltane: + name: hosts-host-beltane + runs-on: ubuntu-latest + steps: + - id: checkout + name: git clone + uses: actions/checkout@v1 + with: + submodules: false + - id: nix-install + name: nix install + uses: arcnmx/ci/actions/nix/install@master + - id: ci-setup + name: nix setup + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-beltane.run.bootstrap + quiet: false + - id: ci-dirty + name: nix test dirty + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-beltane.run.test + command: ci-build-dirty + quiet: false + stdout: ${{ runner.temp }}/ci.build.dirty + - id: ci-test + name: nix test build + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-beltane.run.test + command: ci-build-realise + ignore-exit-code: true + quiet: false + stdin: ${{ runner.temp }}/ci.build.dirty + - env: + CI_EXIT_CODE: ${{ steps.ci-test.outputs.exit-code }} + id: ci-summary + name: nix test results + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-beltane.run.test + command: ci-build-summarise + quiet: false + stdin: ${{ runner.temp }}/ci.build.dirty + stdout: ${{ runner.temp }}/ci.build.cache + - env: + CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} + id: ci-cache + if: always() + name: nix test cache + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-beltane.run.test + command: ci-build-cache + quiet: false + stdin: ${{ runner.temp }}/ci.build.cache + host-ostara: + name: hosts-host-ostara + runs-on: ubuntu-latest + steps: + - id: checkout + name: git clone + uses: actions/checkout@v1 + with: + submodules: false + - id: nix-install + name: nix install + uses: arcnmx/ci/actions/nix/install@master + - id: ci-setup + name: nix setup + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-ostara.run.bootstrap + quiet: false + - id: ci-dirty + name: nix test dirty + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-ostara.run.test + command: ci-build-dirty + quiet: false + stdout: ${{ runner.temp }}/ci.build.dirty + - id: ci-test + name: nix test build + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-ostara.run.test + command: ci-build-realise + ignore-exit-code: true + quiet: false + stdin: ${{ runner.temp }}/ci.build.dirty + - env: + CI_EXIT_CODE: ${{ steps.ci-test.outputs.exit-code }} + id: ci-summary + name: nix test results + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-ostara.run.test + command: ci-build-summarise + quiet: false + stdin: ${{ runner.temp }}/ci.build.dirty + stdout: ${{ runner.temp }}/ci.build.cache + - env: + CACHIX_SIGNING_KEY: ${{ secrets.CACHIX_SIGNING_KEY }} + id: ci-cache + if: always() + name: nix test cache + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.job.host-ostara.run.test + command: ci-build-cache + quiet: false + stdin: ${{ runner.temp }}/ci.build.cache host-samhain: name: hosts-host-samhain runs-on: ubuntu-latest diff --git a/ci/hosts.nix b/ci/hosts.nix index 735b1691..0cde88b5 100644 --- a/ci/hosts.nix +++ b/ci/hosts.nix @@ -14,7 +14,7 @@ ''; }; - jobs = let hostnames = [ "samhain" "yule" "athame" ]; + jobs = let hostnames = remove "dummy" (lib.attrNames (import ../.).hosts); in mapAttrs' (k: nameValuePair "host-${k}") (genAttrs hostnames (host: { tasks.${host}.inputs = channels.nixfiles.network.nodes.${host}.deploy.system; })); diff --git a/ci/niv-cron.nix b/ci/niv-cron.nix index 37620420..d48de118 100644 --- a/ci/niv-cron.nix +++ b/ci/niv-cron.nix @@ -46,7 +46,8 @@ with lib; { }; displayName = "niv update build"; environment = [ "OPENSSH_PRIVATE_KEY" "CACHIX_SIGNING_KEY" "GITHUB_REF" ]; - command = '' + command = let hostnames = remove "dummy" (lib.attrNames (import ../.).hosts); + hostBuildString = concatMapStrings (host: "nix build -Lf . network.nodes.${host}.deploy.system && nix-collect-garbage -d && " ) hostnames; in '' # ${toString builtins.currentTime} if [[ -n $OPENSSH_PRIVATE_KEY ]]; then mkdir ~/.ssh @@ -75,7 +76,7 @@ with lib; { git -P diff nix/sources.json nix build --no-link -Lf . sourceCache.local echo "checking that network.nodes.still build..." >&2 - if nix build -Lf . network.nodes.athame.deploy.system && nix-collect-garbage -d && nix build -Lf . network.nodes.yule.system && nix-collect-garbage -d && nix build -Lf . network.nodes.samhain.system; then + if ${hostBuildString}; then if [[ -n $CACHIX_SIGNING_KEY ]]; then nix build --no-link -Lf . sourceCache.all cachix push kittywitch $(nix eval --raw -f . sourceCache.allStr)