mirror of
https://gitlab.com/TECHNOFAB/nix-gitlab-ci.git
synced 2025-12-12 02:00:13 +01:00
test: copy over most tests, add new tests for soonix
This commit is contained in:
parent
0bd75fd1bb
commit
436e2fde25
7 changed files with 439 additions and 9 deletions
|
|
@ -2,7 +2,7 @@
|
|||
pkgs,
|
||||
lib,
|
||||
} @ args: let
|
||||
inherit (lib) types isAttrs filterAttrs mapAttrs mkOption mkOptionType isType literalExpression;
|
||||
inherit (lib) types isAttrs filterAttrs mapAttrs mkOption mkOptionType isType literalExpression pipe;
|
||||
in rec {
|
||||
prepend = key: arr: job: {
|
||||
${key} = arr ++ (job.${key} or []);
|
||||
|
|
@ -15,7 +15,13 @@ in rec {
|
|||
|
||||
# json is also valid yaml and this removes dependency on jq and/or remarshal
|
||||
# (used in pkgs.formats.json and pkgs.formats.yaml respectively)
|
||||
toYaml = name: value: builtins.toFile name (builtins.toJSON value);
|
||||
toYaml = name: value:
|
||||
pipe value [
|
||||
builtins.toJSON
|
||||
builtins.unsafeDiscardOutputDependency
|
||||
builtins.unsafeDiscardStringContext
|
||||
(builtins.toFile name)
|
||||
];
|
||||
toYamlPretty = (pkgs.formats.yaml {}).generate;
|
||||
|
||||
customMapAttrs = cb: set: builtins.listToAttrs (builtins.map (key: cb key (builtins.getAttr key set)) (builtins.attrNames set));
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
jobSubmodule,
|
||||
...
|
||||
}: let
|
||||
inherit (lib) mkOption types filterAttrs mergeAttrsList pipe mapAttrs;
|
||||
inherit (lib) mkOption types filterAttrs mergeAttrsList mapAttrs;
|
||||
inherit (cilib.helpers) filterUnset mkUnsetOption toYaml toYamlPretty;
|
||||
|
||||
pipelineConfigSubmodule = {rootConfig, ...}: {
|
||||
|
|
@ -93,12 +93,7 @@
|
|||
// mapAttrs (_name: value: value.finalConfig) config.jobs;
|
||||
packages =
|
||||
{
|
||||
"gitlab-ci:pipeline:${name}" = pipe config.finalConfig [
|
||||
builtins.toJSON
|
||||
builtins.unsafeDiscardOutputDependency
|
||||
builtins.unsafeDiscardStringContext
|
||||
(toYaml "gitlab-ci-config.json")
|
||||
];
|
||||
"gitlab-ci:pipeline:${name}" = toYaml "gitlab-ci-config.json" config.finalConfig;
|
||||
"gitlab-ci:pipeline:${name}:pretty" = toYamlPretty "gitlab-ci-config.yml" config.finalConfig;
|
||||
}
|
||||
// mergeAttrsList (map (job: job.packages) (builtins.attrValues config.jobs));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue