{ pkgs, ntlib, cilib, ... }: { suites."autoChecks" = { pos = __curPos; tests = [ { name = "flakeModule"; type = "script"; script = # sh '' ${ntlib.helpers.scriptHelpers} ${ntlib.helpers.path (with pkgs; [coreutils nix gnused gnugrep jq])} export SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt export NIX_SSL_CERT_FILE=${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt repo_path=${../.} cp ${./fixtures/flake_parts_autochecks}/* . sed -i -e "s|@repo_path@|$repo_path|" flake.nix nix build --impure .#gitlab-ci:pipeline:default assert "-f result" "should exist" system=$(nix eval --impure --expr "builtins.currentSystem" --raw) jq -e '."my-check" | .stage == "test"' result > /dev/null jq -e '."my-check" | .script[0] | contains("nix build")' result > /dev/null jq -e '."my-check" | .script[0] | contains("'"$system"'")' result > /dev/null jq -e '."my-check" | has("before_script")' result > /dev/null jq -e '."my-check" | has("after_script")' result > /dev/null ''; } { name = "direct"; type = "script"; script = let system = pkgs.system; fakeCheck = pkgs.runCommand "fake-check" {} "touch $out"; ci = cilib.mkCI { checks.my-check = fakeCheck; config.autoChecks.enable = true; pipelines.default.stages = [ "test" ]; }; pkg = ci.packages."gitlab-ci:pipeline:default"; in # sh '' ${ntlib.helpers.scriptHelpers} ${ntlib.helpers.path (with pkgs; [coreutils gnugrep jq])} json=$(cat ${pkg}) echo "$json" | jq -e '.stages == [".pre", "test", ".post"]' > /dev/null echo "$json" | jq -e '."my-check" | .stage == "test"' > /dev/null echo "$json" | jq -e '."my-check" | .script[0] | contains("nix build")' > /dev/null echo "$json" | jq -e '."my-check" | .script[0] | contains("${system}")' > /dev/null echo "$json" | jq -e '."my-check" | has("before_script")' > /dev/null echo "$json" | jq -e '."my-check" | has("after_script")' > /dev/null ''; } ]; }; }