feat: add CI with nix-gitlab-ci

This commit is contained in:
technofab 2025-09-04 11:01:08 +02:00
parent 63a8dfab9c
commit 93b282cd27
No known key found for this signature in database
6 changed files with 79 additions and 3 deletions

5
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,5 @@
# Generated by soonix, DO NOT EDIT
include:
- component: gitlab.com/TECHNOFAB/nix-gitlab-ci/nix-gitlab-ci@3.0.0-alpha.2
inputs:
version: 3.0.0-alpha.2

View file

@ -23,12 +23,14 @@
(simple "tests") (simple "tests")
(simple "docs") (simple "docs")
(simple "soonix") (simple "soonix")
(simple "ci")
]; ];
} }
{ {
packages = ren.select self [ packages = ren.select self [
["repo" "tests"] ["repo" "tests"]
["repo" "docs"] ["repo" "docs"]
["repo" "ci" "packages"]
["repo" "soonix" "packages"] ["repo" "soonix" "packages"]
]; ];
}; };

45
nix/repo/ci.nix Normal file
View file

@ -0,0 +1,45 @@
{inputs, ...}: let
inherit (inputs) cilib;
in
cilib.mkCI {
pipelines."default" = {
stages = ["test" "build" "deploy"];
jobs = {
"test" = {
stage = "test";
script = [
"nix run .#tests -- --junit=junit.xml"
];
allow_failure = true;
artifacts = {
when = "always";
reports.junit = "junit.xml";
};
};
"docs" = {
stage = "build";
script = [
# sh
''
nix build .#docs:default
mkdir -p public
cp -r result/. public/
''
];
artifacts.paths = ["public"];
};
"pages" = {
nix.enable = false;
image = "alpine:latest";
stage = "deploy";
script = ["true"];
artifacts.paths = ["public"];
rules = [
{
"if" = "$CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH";
}
];
};
};
};
}

25
nix/repo/flake.lock generated
View file

@ -17,6 +17,24 @@
"type": "gitlab" "type": "gitlab"
} }
}, },
"nix-gitlab-ci-lib": {
"locked": {
"dir": "lib",
"lastModified": 1756974596,
"narHash": "sha256-KxQj76sUqvPNtrqzNWMZeOWqTitc0aFCYj7UZzToiEA=",
"owner": "TECHNOFAB",
"repo": "nix-gitlab-ci",
"rev": "00cf5b83c6c46698fba12a54b9cc15c6d4e5a4dd",
"type": "gitlab"
},
"original": {
"dir": "lib",
"owner": "TECHNOFAB",
"ref": "3.0.0-alpha.2",
"repo": "nix-gitlab-ci",
"type": "gitlab"
}
},
"nixmkdocs-lib": { "nixmkdocs-lib": {
"locked": { "locked": {
"dir": "lib", "dir": "lib",
@ -37,11 +55,11 @@
"nixtest-lib": { "nixtest-lib": {
"locked": { "locked": {
"dir": "lib", "dir": "lib",
"lastModified": 1753957623, "lastModified": 1756812148,
"narHash": "sha256-kdImwKx57N0QL8HPUUb5ADwXFgSjaNOk39b/eKlzyTo=", "narHash": "sha256-0g8KNk4zoLApA51PBHOWqPLRYpprjrQuSzNCjfBQgu8=",
"owner": "TECHNOFAB", "owner": "TECHNOFAB",
"repo": "nixtest", "repo": "nixtest",
"rev": "22b43c9fe83be73c3f0648bbb54bc3c1cf7f96df", "rev": "5741109cc9ec2b6d41b56abd3f5bc51ed7a9a228",
"type": "gitlab" "type": "gitlab"
}, },
"original": { "original": {
@ -54,6 +72,7 @@
"root": { "root": {
"inputs": { "inputs": {
"devshell-lib": "devshell-lib", "devshell-lib": "devshell-lib",
"nix-gitlab-ci-lib": "nix-gitlab-ci-lib",
"nixmkdocs-lib": "nixmkdocs-lib", "nixmkdocs-lib": "nixmkdocs-lib",
"nixtest-lib": "nixtest-lib", "nixtest-lib": "nixtest-lib",
"treefmt-nix": "treefmt-nix" "treefmt-nix": "treefmt-nix"

View file

@ -3,6 +3,7 @@
devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib"; devshell-lib.url = "gitlab:rensa-nix/devshell?dir=lib";
nixtest-lib.url = "gitlab:TECHNOFAB/nixtest?dir=lib"; nixtest-lib.url = "gitlab:TECHNOFAB/nixtest?dir=lib";
nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib"; nixmkdocs-lib.url = "gitlab:TECHNOFAB/nixmkdocs?dir=lib";
nix-gitlab-ci-lib.url = "gitlab:TECHNOFAB/nix-gitlab-ci/3.0.0-alpha.2?dir=lib";
treefmt-nix = { treefmt-nix = {
url = "github:numtide/treefmt-nix"; url = "github:numtide/treefmt-nix";
flake = false; flake = false;
@ -14,6 +15,7 @@
ntlib = i.nixtest-lib.lib {inherit (i.parent) pkgs;}; ntlib = i.nixtest-lib.lib {inherit (i.parent) pkgs;};
devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;}; devshell = i.devshell-lib.lib {inherit (i.parent) pkgs;};
doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;}; doclib = i.nixmkdocs-lib.lib {inherit (i.parent) pkgs;};
cilib = i.nix-gitlab-ci-lib.lib {inherit (i.parent) pkgs;};
soonix = import "${i.parent.self}/lib" {inherit (i.parent) pkgs;}; soonix = import "${i.parent.self}/lib" {inherit (i.parent) pkgs;};
treefmt = import i.treefmt-nix; treefmt = import i.treefmt-nix;
}; };

View file

@ -1,11 +1,14 @@
{ {
inputs, inputs,
cell,
... ...
}: let }: let
inherit (inputs) soonix; inherit (inputs) soonix;
inherit (cell) ci;
in in
(soonix.make { (soonix.make {
hooks = { hooks = {
ci = ci.soonix;
test = { test = {
output = "test.yaml"; output = "test.yaml";
generator = "nix"; generator = "nix";