1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
{ lib }:
let
commonSteps = { name, signingKey }: [
{
uses = "actions/checkout@v2";
"with" = {
"submodules" = "recursive";
};
}
{
uses = "cachix/install-nix-action@v14.1";
}
{
uses = "cachix/cachix-action@v10";
"with" = {
inherit name signingKey;
};
}
];
job =
{ steps
, ocamlVersions ? [
"4_12"
"4_13"
"4_14"
"5_00"
]
, ...
}@attrs: (builtins.removeAttrs attrs [ "ocamlVersions" ]) // {
strategy = {
fail-fast = false;
matrix = {
ocamlVersion = ocamlVersions
;
};
};
};
gh-actions = {
cachixBuild = { name, branches ? [ "master" ], os, cachix }:
lib.generators.toYAML { } {
inherit name;
on = {
pull_request = null;
push = {
inherit branches;
};
};
jobs = lib.mapAttrs
(os: { run, name, ... }@conf:
job ({
runs-on = os;
steps = commonSteps cachix
++ [{ inherit name run; }];
} // (if (conf ? ocamlVersions) then {
inherit (conf) ocamlVersions;
} else { })))
os;
};
};
in
gh-actions.cachixBuild {
name = "Build";
cachix = {
name = "anmonteiro";
signingKey = "\${{ secrets.CACHIX_SIGNING_KEY }}";
};
os = {
macos-latest = {
name = "Run nix-build";
ocamlVersions = [ "4_13" "4_14" "5_00" ];
run = "nix-build ./nix/ci/test.nix -A native --argstr ocamlVersion \${{ matrix.ocamlVersion }}";
};
ubuntu-latest = {
ocamlVersions = [ "4_12" "4_13" "4_14" "5_00" ];
name = "Run nix-build";
run = "nix-build ./nix/ci/test.nix -A native -A musl64 --argstr ocamlVersion \${{ matrix.ocamlVersion }}";
};
};
}
|