tests: try testing with nixtest

This commit is contained in:
technofab 2025-05-10 19:48:20 +02:00
parent 11537ae271
commit 93739ab27c
4 changed files with 40 additions and 0 deletions

18
flake.lock generated
View file

@ -329,6 +329,23 @@
"type": "github"
}
},
"nixtest": {
"locked": {
"dir": "lib",
"lastModified": 1746388457,
"narHash": "sha256-xWAnSFxogdy47rZyGj18R9qDlLFs/PvwPpD3iAiR2Hc=",
"owner": "technofab",
"repo": "nixtest",
"rev": "0a1bbae2c30e3ba8e3b02de223e199c5dfd56572",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "technofab",
"repo": "nixtest",
"type": "gitlab"
}
},
"root": {
"inputs": {
"devenv": "devenv",
@ -336,6 +353,7 @@
"mkdocs-material-umami": "mkdocs-material-umami",
"nix-mkdocs": "nix-mkdocs",
"nixpkgs": "nixpkgs_4",
"nixtest": "nixtest",
"systems": "systems",
"treefmt-nix": "treefmt-nix"
}

View file

@ -9,6 +9,7 @@
inputs.devenv.flakeModule
inputs.treefmt-nix.flakeModule
inputs.nix-mkdocs.flakeModule
inputs.nixtest.flakeModule
./lib/flakeModule.nix
];
systems = import systems;
@ -16,6 +17,7 @@
perSystem = {
pkgs,
config,
self',
system,
...
}: rec {
@ -209,6 +211,23 @@
};
};
nixtest.suites = let
jsonFile = file: builtins.fromJSON (builtins.readFile file);
in {
"Pipeline YAMLs" = [
{
name = "default";
type = "snapshot";
actual = jsonFile self'.legacyPackages."gitlab-ci:pipeline:default";
}
{
name = "non-default";
type = "snapshot";
actual = jsonFile self'.legacyPackages."gitlab-ci:pipeline:non-default";
}
];
};
packages = let
setupScript = pkgs.writeShellScriptBin "setup_nix_ci" (builtins.readFile ./scripts/setup_nix_ci.sh);
finalizeScript = pkgs.writeShellScriptBin "finalize_nix_ci" (builtins.readFile ./scripts/finalize_nix_ci.sh);
@ -269,6 +288,7 @@
treefmt-nix.url = "github:numtide/treefmt-nix";
nix-mkdocs.url = "gitlab:technofab/nixmkdocs?dir=lib";
mkdocs-material-umami.url = "gitlab:technofab/mkdocs-material-umami";
nixtest.url = "gitlab:technofab/nixtest?dir=lib";
};
nixConfig = {

View file

@ -0,0 +1 @@
{"docs":{"after_script":["finalize_nix_ci"],"artifacts":{"paths":["public"]},"before_script":["source setup_nix_ci \"gitlab-ci:pipeline:default:job-deps:docs\""],"cache":[],"image":"$NIX_CI_IMAGE","script":["nix build .#docs:default\nmkdir -p public\ncp -r result/. public/\n"],"stage":"build","variables":{}},"pages":{"artifacts":{"paths":["public"]},"image":"alpine:latest","rules":[{"if":"$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH"}],"script":["true"],"stage":"deploy"},"stages":["test","build","deploy"],"test":{"after_script":["finalize_nix_ci"],"before_script":["source setup_nix_ci \"gitlab-ci:pipeline:default:job-deps:test\""],"cache":[{"key":"$CI_JOB_NAME-$CI_COMMIT_REF_SLUG","paths":[".nix-cache/"]}],"image":"$NIX_CI_IMAGE","script":["hello","curl google.de","echo $TEST $TEST_WITH_DERIVATION"],"stage":"test","variables":{"NIX_CI_CACHE_STRATEGY":"runner","TEST":"test"}},"test-default":{"after_script":["finalize_nix_ci"],"before_script":["source setup_nix_ci \"gitlab-ci:pipeline:default:job-deps:test-default\""],"cache":[],"image":"$NIX_CI_IMAGE","script":["hello"],"stage":"test","variables":{}},"test-non-nix":{"image":"alpine:latest","script":["echo \"This job will not be modified to use nix\""],"stage":"test"}}

View file

@ -0,0 +1 @@
{"stages":["test"],"test":{"after_script":["finalize_nix_ci"],"before_script":["source setup_nix_ci \"gitlab-ci:pipeline:non-default:job-deps:test\""],"cache":[],"image":"$NIX_CI_IMAGE","script":["echo Hello from another pipeline"],"stage":"test","variables":{}}}