From d3b06255db4cc243527492782d569bdb2bb16c1c Mon Sep 17 00:00:00 2001 From: kat witch Date: Thu, 13 May 2021 17:10:18 +0100 Subject: [PATCH] ci: Init attempt --- .github/workflows/nixfiles.yml | 100 +++++++++++++++++++++++++++++++++ ci.nix | 16 ++++++ nix/sources.json | 12 ++++ profiles/common/nix.nix | 4 +- 4 files changed, 130 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/nixfiles.yml create mode 100644 ci.nix diff --git a/.github/workflows/nixfiles.yml b/.github/workflows/nixfiles.yml new file mode 100644 index 00000000..b7436aa3 --- /dev/null +++ b/.github/workflows/nixfiles.yml @@ -0,0 +1,100 @@ +env: + CI_ALLOW_ROOT: '1' + CI_CONFIG: ./ci.nix + CI_PLATFORM: gh-actions +jobs: + ci: + name: nixfiles + 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.run.bootstrap + quiet: false + - id: host-athame + name: build host/athame + run: nix build -Lf . hosts.athame.config.system.build.toplevel --show-trace + - id: host-samhain + name: build host/samhain + run: nix build -Lf . hosts.samhain.config.system.build.toplevel --show-trace + - id: host-yule + name: build host/yule + run: nix build -Lf . hosts.yule.config.system.build.toplevel --show-trace + - id: ci-dirty + name: nix test dirty + uses: arcnmx/ci/actions/nix/run@master + with: + attrs: ci.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.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.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.run.test + command: ci-build-cache + quiet: false + stdin: ${{ runner.temp }}/ci.build.cache + ci-check: + name: nixfiles check + 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-action-build + name: nix build ci.gh-actions.configFile + uses: arcnmx/ci/actions/nix/build@master + with: + attrs: ci.gh-actions.configFile + out-link: .ci/workflow.yml + - id: ci-action-compare + name: gh-actions compare + uses: arcnmx/ci/actions/nix/run@master + with: + args: -u .github/workflows/nixfiles.yml .ci/workflow.yml + attrs: nixpkgs.diffutils + command: diff +name: nixfiles +'on': +- push +- pull_request diff --git a/ci.nix b/ci.nix new file mode 100644 index 00000000..2708d990 --- /dev/null +++ b/ci.nix @@ -0,0 +1,16 @@ +{ lib, ... }: with lib; { + name = "nixfiles"; + ci.gh-actions.enable = true; + ci.gh-actions.export = true; + gh-actions.jobs.ci.step = let + hostnames = [ "samhain" "yule" "athame"]; + in mapAttrs' (k: nameValuePair "host-${k}") (genAttrs hostnames (host: { + name = "build host/${host}"; + run = "nix build -Lf . hosts.${host}.config.system.build.toplevel --show-trace"; + })); + ci.gh-actions.checkoutOptions.submodules = false; + cache.cachix.kittywitch = { + enable = true; + publicKey = "kittywitch.cachix.org-1:KIzX/G5cuPw5WgrXad6UnrRZ8UDr7jhXzRTK/lmqyK0="; + }; +} diff --git a/nix/sources.json b/nix/sources.json index b72ba1a5..d9c83f59 100644 --- a/nix/sources.json +++ b/nix/sources.json @@ -23,6 +23,18 @@ "url": "https://github.com/arcnmx/nixexprs/archive/614d248d1ab66fab84903b8bd6d387a7530915c4.tar.gz", "url_template": "https://github.com///archive/.tar.gz" }, + "ci": { + "branch": "master", + "description": "CI helpers", + "homepage": "https://arcnmx.github.io/ci", + "owner": "arcnmx", + "repo": "ci", + "rev": "7c5456059dda85618340c5aa9ede3267eae5aa5d", + "sha256": "1xa66px4k10whrggk64q2dc6sbixid2rf39nh58n95viqjy31s6g", + "type": "tarball", + "url": "https://github.com/arcnmx/ci/archive/7c5456059dda85618340c5aa9ede3267eae5aa5d.tar.gz", + "url_template": "https://github.com///archive/.tar.gz" + }, "home-manager": { "branch": "master", "description": "Manage a user environment using Nix [maintainer=@rycee] ", diff --git a/profiles/common/nix.nix b/profiles/common/nix.nix index 115750a2..c8aeba60 100644 --- a/profiles/common/nix.nix +++ b/profiles/common/nix.nix @@ -14,9 +14,9 @@ "NUR=${sources.NUR}" "arc=${sources.arc-nixexprs}" ]; - binaryCaches = [ "https://arc.cachix.org" ]; + binaryCaches = [ "https://arc.cachix.org" "https://kittywitch.cachix.org" ]; binaryCachePublicKeys = - [ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" ]; + [ "arc.cachix.org-1:DZmhclLkB6UO0rc0rBzNpwFbbaeLfyn+fYccuAy7YVY=" "kittywitch.cachix.org-1:KIzX/G5cuPw5WgrXad6UnrRZ8UDr7jhXzRTK/lmqyK0=" ]; gc.automatic = lib.mkDefault true; gc.options = lib.mkDefault "--delete-older-than 1w"; trustedUsers = [ "root" "@wheel" ];