1
0
forked from clan/clan-core

reduce impure tests to just instantiate the template

This commit is contained in:
Jörg Thalheim 2023-08-27 10:05:48 +02:00
parent 4cc40865f5
commit c9adf12e72
3 changed files with 12 additions and 22 deletions

View File

@ -1,4 +1,4 @@
name: checks-integration name: checks-impure
on: on:
pull_request: pull_request:
push: push:
@ -8,4 +8,4 @@ jobs:
runs-on: nix runs-on: nix
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- run: nix run .#checks-impure - run: nix run .#impure-checks

View File

@ -1,6 +1,6 @@
{ self, ... }: { { self, ... }: {
imports = [ imports = [
./integration/flake-module.nix ./impure/flake-module.nix
]; ];
perSystem = { pkgs, lib, self', ... }: { perSystem = { pkgs, lib, self', ... }: {
checks = checks =

View File

@ -1,17 +1,16 @@
{ self, ... }: { { self, ... }: {
perSystem = { pkgs, lib, self', ... }: perSystem = { pkgs, lib, ... }:
let let
integrationTests = { impureChecks = {
check-clan-create = pkgs.writeShellScriptBin "check-clan-init" '' check-clan-template = pkgs.writeShellScriptBin "check-clan-template" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
set -euo pipefail set -euo pipefail
export TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d) export TMPDIR=$(${pkgs.coreutils}/bin/mktemp -d)
trap "${pkgs.coreutils}/bin/chmod -R +w '$TMPDIR'; ${pkgs.coreutils}/bin/rm -rf '$TMPDIR'" EXIT trap "${pkgs.coreutils}/bin/chmod -R +w '$TMPDIR'; ${pkgs.coreutils}/bin/rm -rf '$TMPDIR'" EXIT
export PATH="${lib.makeBinPath [ export PATH="${lib.makeBinPath [
pkgs.git pkgs.gitMinimal
pkgs.gnugrep pkgs.openssh
pkgs.nix pkgs.nix
self'.packages.clan-cli
]}" ]}"
cd $TMPDIR cd $TMPDIR
@ -21,29 +20,20 @@
echo ensure flake outputs can be listed echo ensure flake outputs can be listed
nix flake show nix flake show
echo create a machine
clan machines create machine1
echo check machine1 exists
clan machines list | grep -q machine1
echo check machine1 appears in flake output
nix flake show | grep -q machine1
''; '';
}; };
in in
{ {
packages = packages =
integrationTests // { impureChecks // {
# a script that executes all other checks # a script that executes all other checks
checks-impure = pkgs.writeShellScriptBin "checks-impure" '' impure-checks = pkgs.writeShellScriptBin "impure-checks" ''
#!${pkgs.bash}/bin/bash #!${pkgs.bash}/bin/bash
set -euo pipefail set -euo pipefail
${lib.concatMapStringsSep "\n" (name: '' ${lib.concatMapStringsSep "\n" (name: ''
echo -e "\n\nrunning check ${name}\n" echo -e "\n\nrunning check ${name}\n"
${integrationTests.${name}}/bin/* ${impureChecks.${name}}/bin/*
'') (lib.attrNames integrationTests)} '') (lib.attrNames impureChecks)}
''; '';
}; };
}; };