Skip to content

Commit

Permalink
modernize CI
Browse files Browse the repository at this point in the history
update tullia
build all available platforms
  • Loading branch information
dermetfan committed Nov 21, 2022
1 parent d15ff2b commit 3d3d667
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 57 deletions.
28 changes: 21 additions & 7 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions flake.nix
Expand Up @@ -69,10 +69,7 @@

cardano-mainnet-mirror.url = "github:input-output-hk/cardano-mainnet-mirror/nix";

tullia = {
url = "github:input-output-hk/tullia";
inputs.nixpkgs.follows = "nixpkgs";
};
tullia.url = "github:input-output-hk/tullia";
};

outputs =
Expand Down Expand Up @@ -401,7 +398,7 @@
};
};
} //
tullia.fromSimple system (import ./nix/tullia.nix self system)
tullia.fromSimple system (import ./nix/tullia.nix)
);

makeRequired = isPr: jobs: extra:
Expand Down
69 changes: 24 additions & 45 deletions nix/tullia.nix
Expand Up @@ -14,29 +14,35 @@ the rule that describes when a Tullia task is to be invoked.
Learn more: https://github.com/input-output-hk/cicero
*/

self: system:

let
ciInputName = "GitHub event";
repo = "input-output-hk/cardano-node";
repository = "input-output-hk/cardano-node";
in rec {
tasks = let
common = {
config,
...
}: {
mkTask = top: {config, lib, ...}: {
preset = {
# needed on top-level task to set runtime options
nix.enable = true;

github-ci = {
github.status = {
enable = config.actionRun.facts != {};
inherit repo;
sha = config.preset.github-ci.lib.getRevision ciInputName null;
clone.enable = false;
inherit repository;
revision = config.preset.github.lib.readRevision ciInputName null;
};
};

command.text = let
flakeUrl = ''github:${repository}/"$(${lib.escapeShellArg config.preset.github.status.revision})"'';
in config.preset.github.status.lib.reportBulk {
bulk.text = ''
echo '["x86_64-linux", "x86_64-darwin"]' | nix-systems -i \
| jq 'with_entries(.key |= {"x86_64-linux": "linux", "x86_64-darwin": "macos"}[.])'
'';
each.text = ''nix build -L ${flakeUrl}#${lib.escapeShellArg top}."$1".required'';
skippedDescription = lib.escapeShellArg "No nix builder available for this platform";
} + ''
nix build -L ${flakeUrl}#${lib.escapeShellArg top}.cardano-deployment
'';

# some hydra jobs run NixOS tests
env.NIX_CONFIG = ''
extra-system-features = kvm
Expand All @@ -45,45 +51,18 @@ in rec {
memory = 1024 * 32;
nomad.resources.cpu = 10000;
};

# the attribute name in `hydraJobs` for the current system
os = {
x86_64-linux = "linux";
x86_64-darwin = "macos";
}.${system};

flakeUrl = {config, lib, ...}:
lib.escapeShellArg "github:${repo}/${config.preset.github-ci.lib.getRevision ciInputName null}";
in
{
"ci/push" = {lib, ...} @ args: {
imports = [common];

command.text = ''
nix build -L \
${flakeUrl args}#hydraJobs.${lib.escapeShellArg os}.required \
${flakeUrl args}#hydraJobs.cardano-deployment
'';
};

"ci/pr" = {lib, ...} @ args: {
imports = [common];

command.text = ''
nix build -L \
${flakeUrl args}#hydraJobsPr.${lib.escapeShellArg os}.required \
${flakeUrl args}#hydraJobsPr.cardano-deployment
'';
};
};
in {
"ci/push" = mkTask "hydraJobs";
"ci/pr" = mkTask "hydraJobsPr";
};

actions = {
"cardano-node/ci/push" = {
task = "ci/push";
io = ''
#lib.io.github_push
#input: "${ciInputName}"
#repo: "${repo}"
#repo: "${repository}"
'';
};

Expand All @@ -92,7 +71,7 @@ in rec {
io = ''
#lib.io.github_pr
#input: "${ciInputName}"
#repo: "${repo}"
#repo: "${repository}"
#target_default: false
'';
};
Expand Down

0 comments on commit 3d3d667

Please sign in to comment.