mirror of
https://gitlab.com/TECHNOFAB/nixtest.git
synced 2025-12-16 12:03:52 +01:00
refactor: replace flake-parts, devenv etc. with rensa
This commit is contained in:
parent
5a7053afcb
commit
0414493963
16 changed files with 443 additions and 602 deletions
85
nix/repo/ci.nix
Normal file
85
nix/repo/ci.nix
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
{inputs, ...}: let
|
||||
inherit (inputs) pkgs cilib;
|
||||
in
|
||||
cilib.mkCI {
|
||||
pipelines."default" = {
|
||||
stages = ["test" "build" "deploy"];
|
||||
jobs = {
|
||||
"test:lib" = {
|
||||
stage = "test";
|
||||
script = [
|
||||
"nix run .#tests -- --junit=junit.xml"
|
||||
];
|
||||
allow_failure = true;
|
||||
artifacts = {
|
||||
when = "always";
|
||||
reports.junit = "junit.xml";
|
||||
};
|
||||
};
|
||||
"test:go" = {
|
||||
stage = "test";
|
||||
nix.deps = with pkgs; [gcc go go-junit-report gocover-cobertura];
|
||||
variables = {
|
||||
GOPATH = "$CI_PROJECT_DIR/.go";
|
||||
GOCACHE = "$CI_PROJECT_DIR/.go/pkg/mod";
|
||||
};
|
||||
script = [
|
||||
# sh
|
||||
''
|
||||
set +e
|
||||
go test -coverprofile=coverage.out -v 2>&1 ./... | go-junit-report -set-exit-code > report.xml
|
||||
TEST_EXIT_CODE=$?
|
||||
go tool cover -func coverage.out
|
||||
gocover-cobertura < coverage.out > coverage.xml
|
||||
|
||||
exit $TEST_EXIT_CODE
|
||||
''
|
||||
];
|
||||
allow_failure = true;
|
||||
coverage = "/\(statements\)(?:\s+)?(\d+(?:\.\d+)?%)/";
|
||||
cache.paths = [".go/pkg/mod/"];
|
||||
artifacts = {
|
||||
when = "always";
|
||||
reports = {
|
||||
junit = "report.xml";
|
||||
coverage_report = {
|
||||
coverage_format = "cobertura";
|
||||
path = "coverage.xml";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
"build" = {
|
||||
stage = "build";
|
||||
script = [
|
||||
# sh
|
||||
"nix build .#nixtest"
|
||||
];
|
||||
};
|
||||
"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";
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue