diff --git a/actions/cicero/ci/lintAndBuild.nix b/actions/cicero/ci/lintAndBuild.nix new file mode 100644 index 00000000..b0271d16 --- /dev/null +++ b/actions/cicero/ci/lintAndBuild.nix @@ -0,0 +1,42 @@ +{ name, std, lib, actionLib, ... }@args: + +std.behavior.onInputChange "start" name args + +{ + inputs.start = '' + "cicero/ci": start: { + clone_url: string + sha: string + statuses_url?: string + } + ''; + + job = { start }: + let cfg = start.value."cicero/ci".start; in + std.chain args [ + actionLib.simpleJob + + (std.networking.addNameservers [ "1.1.1.1" ]) + + (lib.optionalAttrs (cfg ? statuses_url) + (std.github.reportStatus cfg.statuses_url)) + + (std.git.clone cfg) + + { + resources.memory = 1024 * 3; + + config.packages = std.data-merge.append [ + "github:input-output-hk/cicero/${cfg.sha}#devShell.x86_64-linux" + ]; + } + + (std.wrapScript "bash" (next: '' + set -ex + lint + ${lib.escapeShellArgs next} + '')) + + std.nix.build + ]; +} diff --git a/actions/cicero/pr.nix b/actions/cicero/ci/pr.nix similarity index 100% rename from actions/cicero/pr.nix rename to actions/cicero/ci/pr.nix diff --git a/actions/cicero/ci.nix b/actions/cicero/ci/schemathesis.nix similarity index 61% rename from actions/cicero/ci.nix rename to actions/cicero/ci/schemathesis.nix index 71b6d7fc..fcb76a51 100644 --- a/actions/cicero/ci.nix +++ b/actions/cicero/ci/schemathesis.nix @@ -4,7 +4,7 @@ std.behavior.onInputChange "start" name args { inputs.start = '' - "${name}": start: { + "cicero/ci": start: { clone_url: string sha: string statuses_url?: string @@ -12,14 +12,14 @@ std.behavior.onInputChange "start" name args ''; job = { start }: - let cfg = start.value.${name}.start; in + let cfg = start.value."cicero/ci".start; in std.chain args [ actionLib.jobDefaults (std.escapeNames [ ] [ ]) { - cicero-ci.group.cicero = { + ${name}.group.schemathesis = { network = { mode = "bridge"; port = { @@ -29,57 +29,29 @@ std.behavior.onInputChange "start" name args }; task = { - lintAndBuild = std.chain args [ - (lib.optionalAttrs (cfg ? statuses_url) - (std.github.reportStatus cfg.statuses_url)) - - (std.networking.addNameservers [ "1.1.1.1" ]) - - (std.git.clone cfg) - - { - resources.memory = 1024 * 3; - - config.packages = std.data-merge.append [ - "github:input-output-hk/cicero/${cfg.sha}#devShell.x86_64-linux" - ]; - } - - (std.wrapScript "bash" (next: '' - set -ex - lint - ${lib.escapeShellArgs next} - '')) - - std.nix.build - ]; - - cicero = { + dev = { lifecycle = { hook = "prestart"; sidecar = true; }; + config.nixos = "github:input-output-hk/cicero/${cfg.sha}#nixosConfigurations.dev"; + }; + + cicero = { + lifecycle.sidecar = true; + config = { - packages = [ - "github:input-output-hk/cicero/${cfg.sha}#cicero-entrypoint" - ]; + packages = [ "github:input-output-hk/cicero/${cfg.sha}#cicero-entrypoint" ]; command = [ "/bin/entrypoint" ]; }; env.DATABASE_URL = "postgres://cicero:@127.0.0.1:\${NOMAD_PORT_db}/cicero?sslmode=disable"; }; - dev = { - lifecycle = { - hook = "prestart"; - sidecar = true; - }; - - config.nixos = "github:input-output-hk/cicero/${cfg.sha}#nixosConfigurations.dev"; - }; - schemathesis = std.chain args [ + { lifecycle.hook = "poststart"; } + (lib.optionalAttrs (cfg ? statuses_url) (std.github.reportStatus cfg.statuses_url))