From 3c81c3000107ad693ec587ba2bd994abe0c9ea3d Mon Sep 17 00:00:00 2001 From: Robin Stumm Date: Fri, 18 Nov 2022 16:42:20 +0100 Subject: [PATCH] add CI using cicero and tullia --- flake.lock | 417 ++++++++++++++++++++++++++++++++++++++++++++++++- flake.nix | 16 +- nix/tullia.nix | 62 ++++++++ 3 files changed, 492 insertions(+), 3 deletions(-) create mode 100644 nix/tullia.nix diff --git a/flake.lock b/flake.lock index 8b4ff314827..12688972325 100644 --- a/flake.lock +++ b/flake.lock @@ -31,6 +31,21 @@ "type": "github" } }, + "blank_2": { + "locked": { + "lastModified": 1625557891, + "narHash": "sha256-O8/MWsPBGhhyPoPLHZAuoZiiHo9q6FLlEeIDEXuj6T4=", + "owner": "divnix", + "repo": "blank", + "rev": "5a5d2684073d9f563072ed07c871d577a6c614a8", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "blank", + "type": "github" + } + }, "cabal-32": { "flake": false, "locked": { @@ -142,6 +157,33 @@ "type": "github" } }, + "devshell_2": { + "inputs": { + "flake-utils": [ + "tullia", + "std", + "flake-utils" + ], + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1663445644, + "narHash": "sha256-+xVlcK60x7VY1vRJbNUEAHi17ZuoQxAIH4S4iUFUGBA=", + "owner": "numtide", + "repo": "devshell", + "rev": "e3dc3e21594fe07bdb24bdf1c8657acaa4cb8f66", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "devshell", + "type": "github" + } + }, "dmerge": { "inputs": { "nixlib": [ @@ -171,6 +213,33 @@ "type": "github" } }, + "dmerge_2": { + "inputs": { + "nixlib": [ + "tullia", + "std", + "nixpkgs" + ], + "yants": [ + "tullia", + "std", + "yants" + ] + }, + "locked": { + "lastModified": 1659548052, + "narHash": "sha256-fzI2gp1skGA8mQo/FBFrUAtY0GQkAIAaV/V127TJPyY=", + "owner": "divnix", + "repo": "data-merge", + "rev": "d160d18ce7b1a45b88344aa3f13ed1163954b497", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "data-merge", + "type": "github" + } + }, "ema": { "inputs": { "flake-compat": "flake-compat", @@ -295,6 +364,22 @@ "type": "github" } }, + "flake-compat_5": { + "flake": false, + "locked": { + "lastModified": 1650374568, + "narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "b4a34015c698c7793d592d66adbab377907a2be8", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-parts": { "inputs": { "nixpkgs": "nixpkgs_3" @@ -328,6 +413,51 @@ "type": "github" } }, + "flake-utils_10": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_11": { + "locked": { + "lastModified": 1659877975, + "narHash": "sha256-zllb8aq3YO3h8B/U0/J1WBgAL8EX5yWf5pMj3G0NAmc=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "c0e246b9b83f637f4681389ecabcb2681b4f3af0", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "flake-utils_12": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "flake-utils_2": { "locked": { "lastModified": 1619345332, @@ -485,6 +615,25 @@ "type": "github" } }, + "gomod2nix_2": { + "inputs": { + "nixpkgs": "nixpkgs_12", + "utils": "utils_2" + }, + "locked": { + "lastModified": 1655245309, + "narHash": "sha256-d/YPoQ/vFn1+GTmSdvbSBSTOai61FONxB4+Lt6w/IVI=", + "owner": "tweag", + "repo": "gomod2nix", + "rev": "40d32f82fc60d66402eb0972e6e368aeab3faf58", + "type": "github" + }, + "original": { + "owner": "tweag", + "repo": "gomod2nix", + "type": "github" + } + }, "hackage": { "flake": false, "locked": { @@ -646,6 +795,22 @@ "type": "github" } }, + "mdbook-kroki-preprocessor_2": { + "flake": false, + "locked": { + "lastModified": 1661755005, + "narHash": "sha256-1TJuUzfyMycWlOQH67LR63/ll2GDZz25I3JfScy/Jnw=", + "owner": "JoelCourtney", + "repo": "mdbook-kroki-preprocessor", + "rev": "93adb5716d035829efed27f65f2f0833a7d3e76f", + "type": "github" + }, + "original": { + "owner": "JoelCourtney", + "repo": "mdbook-kroki-preprocessor", + "type": "github" + } + }, "n2c": { "inputs": { "flake-utils": "flake-utils_9", @@ -670,6 +835,29 @@ "type": "github" } }, + "n2c_2": { + "inputs": { + "flake-utils": "flake-utils_12", + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1665039323, + "narHash": "sha256-SAh3ZjFGsaCI8FRzXQyp56qcGdAqgKEfJWPCQ0Sr7tQ=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "b008fe329ffb59b67bf9e7b08ede6ee792f2741a", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, "nix": { "inputs": { "lowdown-src": "lowdown-src", @@ -713,6 +901,38 @@ "type": "github" } }, + "nix-nomad_2": { + "inputs": { + "flake-compat": "flake-compat_5", + "flake-utils": [ + "tullia", + "nix2container", + "flake-utils" + ], + "gomod2nix": "gomod2nix_2", + "nixpkgs": [ + "tullia", + "nixpkgs" + ], + "nixpkgs-lib": [ + "tullia", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1658277770, + "narHash": "sha256-T/PgG3wUn8Z2rnzfxf2VqlR1CBjInPE0l1yVzXxPnt0=", + "owner": "tristanpemble", + "repo": "nix-nomad", + "rev": "054adcbdd0a836ae1c20951b67ed549131fd2d70", + "type": "github" + }, + "original": { + "owner": "tristanpemble", + "repo": "nix-nomad", + "type": "github" + } + }, "nix2container": { "inputs": { "flake-utils": "flake-utils_7", @@ -732,6 +952,25 @@ "type": "github" } }, + "nix2container_2": { + "inputs": { + "flake-utils": "flake-utils_10", + "nixpkgs": "nixpkgs_13" + }, + "locked": { + "lastModified": 1658567952, + "narHash": "sha256-XZ4ETYAMU7XcpEeAFP3NOl9yDXNuZAen/aIJ84G+VgA=", + "owner": "nlewo", + "repo": "nix2container", + "rev": "60bb43d405991c1378baf15a40b5811a53e32ffa", + "type": "github" + }, + "original": { + "owner": "nlewo", + "repo": "nix2container", + "type": "github" + } + }, "nixago": { "inputs": { "flake-utils": [ @@ -767,6 +1006,38 @@ "type": "github" } }, + "nixago_2": { + "inputs": { + "flake-utils": [ + "tullia", + "std", + "flake-utils" + ], + "nixago-exts": [ + "tullia", + "std", + "blank" + ], + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1661824785, + "narHash": "sha256-/PnwdWoO/JugJZHtDUioQp3uRiWeXHUdgvoyNbXesz8=", + "owner": "nix-community", + "repo": "nixago", + "rev": "8c1f9e5f1578d4b2ea989f618588d62a335083c3", + "type": "github" + }, + "original": { + "owner": "nix-community", + "repo": "nixago", + "type": "github" + } + }, "nixpkgs": { "locked": { "lastModified": 1646470760, @@ -925,6 +1196,53 @@ "type": "github" } }, + "nixpkgs_12": { + "locked": { + "lastModified": 1653581809, + "narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "83658b28fe638a170a19b8933aa008b30640fbd1", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_13": { + "locked": { + "lastModified": 1654807842, + "narHash": "sha256-ADymZpr6LuTEBXcy6RtFHcUZdjKTBRTMYwu19WOx17E=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "fc909087cc3386955f21b4665731dbdaceefb1d8", + "type": "github" + }, + "original": { + "owner": "NixOS", + "repo": "nixpkgs", + "type": "github" + } + }, + "nixpkgs_14": { + "locked": { + "lastModified": 1665087388, + "narHash": "sha256-FZFPuW9NWHJteATOf79rZfwfRn5fE0wi9kRzvGfDHPA=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "95fda953f6db2e9496d2682c4fc7b82f959878f7", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixpkgs-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1619531122, @@ -1096,7 +1414,8 @@ "nixpkgs": [ "haskellNix", "nixpkgs-unstable" - ] + ], + "tullia": "tullia_2" } }, "stackage": { @@ -1153,6 +1472,42 @@ "type": "github" } }, + "std_2": { + "inputs": { + "blank": "blank_2", + "devshell": "devshell_2", + "dmerge": "dmerge_2", + "flake-utils": "flake-utils_11", + "makes": [ + "tullia", + "std", + "blank" + ], + "mdbook-kroki-preprocessor": "mdbook-kroki-preprocessor_2", + "microvm": [ + "tullia", + "std", + "blank" + ], + "n2c": "n2c_2", + "nixago": "nixago_2", + "nixpkgs": "nixpkgs_14", + "yants": "yants_2" + }, + "locked": { + "lastModified": 1665513321, + "narHash": "sha256-D6Pacw9yf/HMs84KYuCxHXnNDL7v43gtcka5URagFqE=", + "owner": "divnix", + "repo": "std", + "rev": "94a90eedb9cfc115b12ae8f6622d9904788559e4", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "std", + "type": "github" + } + }, "tailwind-haskell": { "inputs": { "flake-utils": "flake-utils_3", @@ -1194,6 +1549,29 @@ "type": "github" } }, + "tullia_2": { + "inputs": { + "nix-nomad": "nix-nomad_2", + "nix2container": "nix2container_2", + "nixpkgs": [ + "nixpkgs" + ], + "std": "std_2" + }, + "locked": { + "lastModified": 1668711738, + "narHash": "sha256-CBjky16o9pqsGE1bWu6nRlRajgSXMEk+yaFQLibqXcE=", + "owner": "input-output-hk", + "repo": "tullia", + "rev": "ead1f515c251f0e060060ef0e2356a51d3dfe4b0", + "type": "github" + }, + "original": { + "owner": "input-output-hk", + "repo": "tullia", + "type": "github" + } + }, "utils": { "locked": { "lastModified": 1653893745, @@ -1209,6 +1587,21 @@ "type": "github" } }, + "utils_2": { + "locked": { + "lastModified": 1653893745, + "narHash": "sha256-0jntwV3Z8//YwuOjzhV2sgJJPt+HY6KhU7VZUL0fKZQ=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "1ed9fb1935d260de5fe1c2f7ee0ebaae17ed2fa1", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "yants": { "inputs": { "nixpkgs": [ @@ -1231,6 +1624,28 @@ "repo": "yants", "type": "github" } + }, + "yants_2": { + "inputs": { + "nixpkgs": [ + "tullia", + "std", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660507851, + "narHash": "sha256-BKjq7JnVuUR/xDtcv6Vm9GYGKAblisXrAgybor9hT/s=", + "owner": "divnix", + "repo": "yants", + "rev": "0b895ca02a8fa72bad50b454cb3e7d8a66407c96", + "type": "github" + }, + "original": { + "owner": "divnix", + "repo": "yants", + "type": "github" + } } }, "root": "root", diff --git a/flake.nix b/flake.nix index 60c26da3ebc..3b9f7819577 100644 --- a/flake.nix +++ b/flake.nix @@ -55,9 +55,13 @@ ema = { url = "github:srid/ema"; }; + tullia = { + url = "github:input-output-hk/tullia"; + inputs.nixpkgs.follows = "nixpkgs"; + }; }; - outputs = { self, nixpkgs, hostNixpkgs, flake-utils, haskellNix, iohkNix, customConfig, emanote, ... }: + outputs = { self, nixpkgs, hostNixpkgs, flake-utils, haskellNix, iohkNix, customConfig, emanote, tullia, ... }: let inherit (nixpkgs) lib; config = import ./nix/config.nix lib customConfig; @@ -106,6 +110,12 @@ in hydraJobs // { required = mkRequiredJob hydraJobs; + linux = hydraJobs.linux // { + required = mkRequiredJob { inherit (hydraJobs) linux; }; + }; + macos = hydraJobs.macos // { + required = mkRequiredJob { inherit (hydraJobs) macos; }; + }; }; systems = eachSystem supportedSystems @@ -405,7 +415,9 @@ systemHydraJobs = mkSystemHydraJobs hydraProject; systemHydraJobsPr = mkSystemHydraJobs hydraProjectPr; systemHydraJobsBors = mkSystemHydraJobs hydraProjectBors; - }); + } + // tullia.fromSimple system (import nix/tullia.nix) + ); in lib.recursiveUpdate (removeAttrs systems [ "systemHydraJobs" "systemHydraJobsPr" "systemHydraJobsBors" ]) diff --git a/nix/tullia.nix b/nix/tullia.nix new file mode 100644 index 00000000000..4a3ddc7f68e --- /dev/null +++ b/nix/tullia.nix @@ -0,0 +1,62 @@ +let + ciInputName = "GitHub event"; + repository = "input-output-hk/cardano-wallet"; +in rec { + tasks = let + mkTask = top: { config, lib, pkgs, ... }: { + preset = { + nix.enable = true; + + github.ci = { + enable = config.actionRun.facts != {}; + inherit repository; + revision = config.preset.github.lib.readRevision ciInputName null; + }; + }; + + command.text = 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 .#${lib.escapeShellArg top}."$1".required''; + skippedDescription = lib.escapeShellArg "No nix builder available for this platform"; + }; + + dependencies = [ pkgs.jq ]; + + # some hydra jobs run NixOS tests + env.NIX_CONFIG = '' + extra-system-features = kvm + ''; + + memory = 1024 * 16; + nomad.resources.cpu = 10000; + }; + in + { + "ci/push" = mkTask "hydraJobs"; + "ci/pr" = mkTask "hydraJobsPr"; + }; + + actions = { + "cardano-wallet/ci/push" = { + task = "ci/push"; + io = '' + #lib.io.github_push + #input: "${ciInputName}" + #repo: "${repository}" + ''; + }; + + "cardano-wallet/ci/pr" = { + task = "ci/pr"; + io = '' + #lib.io.github_pr + #input: "${ciInputName}" + #repo: "${repository}" + #target_default: false + ''; + }; + }; +}