mirror of
https://github.com/gensokyo-zone/infrastructure.git
synced 2026-02-09 12:29:19 -08:00
ci: Reorganising, shell: Fixes for CI functions
This commit is contained in:
parent
5a75f7b986
commit
9c945dbf4d
3 changed files with 29 additions and 23 deletions
|
|
@ -4,7 +4,7 @@ env:
|
||||||
CI_PLATFORM: gh-actions
|
CI_PLATFORM: gh-actions
|
||||||
jobs:
|
jobs:
|
||||||
ci-check:
|
ci-check:
|
||||||
name: nixfiles check
|
name: hosts check
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- id: checkout
|
- id: checkout
|
||||||
|
|
@ -25,11 +25,11 @@ jobs:
|
||||||
name: gh-actions compare
|
name: gh-actions compare
|
||||||
uses: arcnmx/ci/actions/nix/run@master
|
uses: arcnmx/ci/actions/nix/run@master
|
||||||
with:
|
with:
|
||||||
args: -u .github/workflows/nixfiles.yml .ci/workflow.yml
|
args: -u .github/workflows/hosts.yml .ci/workflow.yml
|
||||||
attrs: nixpkgs.diffutils
|
attrs: nixpkgs.diffutils
|
||||||
command: diff
|
command: diff
|
||||||
host-athame:
|
host-athame:
|
||||||
name: nixfiles-host-athame
|
name: hosts-host-athame
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- id: checkout
|
- id: checkout
|
||||||
|
|
@ -86,7 +86,7 @@ jobs:
|
||||||
quiet: false
|
quiet: false
|
||||||
stdin: ${{ runner.temp }}/ci.build.cache
|
stdin: ${{ runner.temp }}/ci.build.cache
|
||||||
host-samhain:
|
host-samhain:
|
||||||
name: nixfiles-host-samhain
|
name: hosts-host-samhain
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- id: checkout
|
- id: checkout
|
||||||
|
|
@ -143,7 +143,7 @@ jobs:
|
||||||
quiet: false
|
quiet: false
|
||||||
stdin: ${{ runner.temp }}/ci.build.cache
|
stdin: ${{ runner.temp }}/ci.build.cache
|
||||||
host-yule:
|
host-yule:
|
||||||
name: nixfiles-host-yule
|
name: hosts-host-yule
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- id: checkout
|
- id: checkout
|
||||||
|
|
@ -199,7 +199,7 @@ jobs:
|
||||||
command: ci-build-cache
|
command: ci-build-cache
|
||||||
quiet: false
|
quiet: false
|
||||||
stdin: ${{ runner.temp }}/ci.build.cache
|
stdin: ${{ runner.temp }}/ci.build.cache
|
||||||
name: nixfiles
|
name: hosts
|
||||||
'on':
|
'on':
|
||||||
- push
|
- push
|
||||||
- pull_request
|
- pull_request
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
{ lib, channels, env, ... }: with lib; let
|
{ lib, channels, env, ... }: with lib; let
|
||||||
nixfiles = import ./.;
|
nixfiles = import ./.;
|
||||||
in {
|
in {
|
||||||
name = "nixfiles";
|
name = "hosts";
|
||||||
ci.gh-actions.enable = true;
|
ci.gh-actions.enable = true;
|
||||||
ci.gh-actions.export = true;
|
ci.gh-actions.export = true;
|
||||||
|
|
||||||
38
shell.nix
38
shell.nix
|
|
@ -1,30 +1,36 @@
|
||||||
{ }: let
|
{ }: let
|
||||||
config = import ./default.nix;
|
config = import ./default.nix;
|
||||||
tf = config.deploy.tf {};
|
tf = config.deploy.tf {};
|
||||||
|
gh-actions-generate = config.pkgs.writeShellScriptBin "gh-actions-generate" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
export CI_ROOT=./;
|
||||||
|
export CI_CONFIG_ROOT=./ci;
|
||||||
|
CI_CONFIG_FILES=($CI_CONFIG_ROOT/hosts.nix)
|
||||||
|
for f in "''${CI_CONFIG_FILES[@]}"; do
|
||||||
|
nix run --arg config $f ci.run.gh-actions-generate
|
||||||
|
done
|
||||||
|
'';
|
||||||
|
test-all = config.pkgs.writeShellScriptBin "test-all" ''
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
export CI_ROOT=./;
|
||||||
|
export CI_CONFIG_ROOT=./ci;
|
||||||
|
CI_CONFIG_FILES=($CI_CONFIG_ROOT/hosts.nix)
|
||||||
|
for f in "''${CI_CONFIG_FILES[@]}"; do
|
||||||
|
nix run --arg config $f ci.test || break
|
||||||
|
done
|
||||||
|
'';
|
||||||
inherit (config) pkgs;
|
inherit (config) pkgs;
|
||||||
in pkgs.mkShell {
|
in pkgs.mkShell {
|
||||||
nativeBuildInputs = config.runners.lazy.nativeBuildInputs;
|
nativeBuildInputs = [
|
||||||
|
gh-actions-generate
|
||||||
|
test-all
|
||||||
|
] ++ config.runners.lazy.nativeBuildInputs;
|
||||||
HISTFILE = toString (tf.terraform.baseDir + "/.history");
|
HISTFILE = toString (tf.terraform.baseDir + "/.history");
|
||||||
|
|
||||||
CI_ROOT = toString ./.;
|
|
||||||
CI_CONFIG_ROOT = toString ./ci;
|
|
||||||
#CI_CONFIG = toString ./example/ci.nix
|
|
||||||
CI_PLATFORM = "impure"; # use host's nixpkgs for more convenient testing
|
CI_PLATFORM = "impure"; # use host's nixpkgs for more convenient testing
|
||||||
|
|
||||||
shellHook = ''
|
shellHook = ''
|
||||||
export HOME_HOSTNAME=$(hostname -s)
|
export HOME_HOSTNAME=$(hostname -s)
|
||||||
export NIX_PATH="$NIX_PATH:nixfiles=${toString ./.}"
|
export NIX_PATH="$NIX_PATH:nixfiles=${toString ./.}"
|
||||||
|
|
||||||
CI_CONFIG_FILES=($CI_CONFIG_ROOT/hosts.nix)
|
|
||||||
gh-actions-generate() {
|
|
||||||
for f in "''${CI_CONFIG_FILES[@]}"; do
|
|
||||||
nix run --arg config $f ci.run.gh-actions-generate
|
|
||||||
done
|
|
||||||
}
|
|
||||||
test-all() {
|
|
||||||
for f in "''${CI_CONFIG_FILES[@]}"; do
|
|
||||||
nix run --arg config $f ci.test || break
|
|
||||||
done
|
|
||||||
}
|
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue