ci: Init attempt

This commit is contained in:
kat witch 2021-05-13 17:10:18 +01:00
parent 4d15a1bf2e
commit d3b06255db
No known key found for this signature in database
GPG key ID: 1B477797DCA5EC72
4 changed files with 130 additions and 2 deletions

100
.github/workflows/nixfiles.yml vendored Normal file
View file

@ -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

16
ci.nix Normal file
View file

@ -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=";
};
}

View file

@ -23,6 +23,18 @@
"url": "https://github.com/arcnmx/nixexprs/archive/614d248d1ab66fab84903b8bd6d387a7530915c4.tar.gz",
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.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/<owner>/<repo>/archive/<rev>.tar.gz"
},
"home-manager": {
"branch": "master",
"description": "Manage a user environment using Nix [maintainer=@rycee] ",

View file

@ -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" ];