This repository was archived by the owner on Aug 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrelease.nix
116 lines (102 loc) · 3.76 KB
/
release.nix
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
############################################################################
#
# Hydra release jobset.
#
# The purpose of this file is to select jobs defined in default.nix and map
# them to all supported build platforms.
#
############################################################################
# The project sources
{ cardano-byron-proxy ? { outPath = ./.; rev = "abcdef"; }
# Function arguments to pass to the project
, projectArgs ? {
config = { allowUnfree = false; inHydra = true; };
gitrev = cardano-byron-proxy.rev;
}
# The systems that the jobset will be built for.
, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
# The systems used for cross-compiling
, supportedCrossSystems ? [ "x86_64-linux" ]
# A Hydra option
, scrubJobs ? true
# Import IOHK common nix lib
, commonLib ? import ./lib.nix {}
}:
with (import commonLib.iohkNix.release-lib) {
inherit (commonLib) pkgs;
inherit supportedSystems supportedCrossSystems scrubJobs projectArgs;
packageSet = import cardano-byron-proxy;
gitrev = cardano-byron-proxy.rev;
};
with pkgs.lib;
let
nixosTests = (import ./. {}).nixosTests;
getArchDefault = system: let
table = {
x86_64-linux = import ./. { system = "x86_64-linux"; };
x86_64-darwin = import ./. { system = "x86_64-darwin"; };
x86_64-windows = import ./. { system = "x86_64-linux"; crossSystem = "x86_64-windows"; };
};
in table.${system};
default = getArchDefault builtins.currentSystem;
makeScripts = cluster: let
getScript = name: {
x86_64-linux = (getArchDefault "x86_64-linux").scripts.${cluster}.${name};
x86_64-darwin = (getArchDefault "x86_64-darwin").scripts.${cluster}.${name};
};
in {
proxy = getScript "proxy";
};
# TODO: add docker images
#wrapDockerImage = cluster: let
# images = (getArchDefault "x86_64-linux").dockerImages;
# wrapImage = image: commonLib.pkgs.runCommand "${image.name}-hydra" {} ''
# mkdir -pv $out/nix-support/
# cat <<EOF > $out/nix-support/hydra-build-products
# file dockerimage ${image}
# EOF
# '';
makeRelease = cluster: {
name = cluster;
value = {
scripts = makeScripts cluster;
#dockerImage = wrapDockerImage cluster;
};
};
extraBuilds = let
# only build nixos tests for linux
default = getArchDefault "x86_64-linux";
in {
inherit nixosTests;
} // (builtins.listToAttrs (map makeRelease [
"mainnet"
"staging"
"shelley_staging_short"
"shelley_staging"
"testnet"
]));
testsSupportedSystems = [ "x86_64-linux" "x86_64-darwin" ];
# Recurse through an attrset, returning all test derivations in a list.
collectTests' = ds: filter (d: elem d.system testsSupportedSystems) (collect isDerivation ds);
# Adds the package name to the test derivations for windows-testing-bundle.nix
# (passthru.identifier.name does not survive mapTestOn)
collectTests = ds: concatLists (
mapAttrsToList (packageName: package:
map (drv: drv // { inherit packageName; }) (collectTests' package)
) ds);
inherit (systems.examples) mingwW64 musl64;
jobs = {
native = mapTestOn (__trace (__toJSON (packagePlatforms project)) (packagePlatforms project));
"${mingwW64.config}" = mapTestOnCross mingwW64 (packagePlatformsCross project);
# TODO: fix broken evals
#musl64 = mapTestOnCross musl64 (packagePlatformsCross project);
} // extraBuilds // (mkRequiredJob (
collectTests jobs.native.tests ++
collectTests jobs.native.benchmarks ++ [
jobs.native.cardano-byron-proxy.x86_64-darwin
jobs.native.cardano-byron-proxy.x86_64-linux
(map (cluster: jobs.${cluster}.scripts.proxy.x86_64-linux) [ "mainnet" "testnet" "staging" ])
# windows cross compilation targets
#jobs.x86_64-pc-mingw32.cardano-byron-proxy.x86_64-linux
]));
in jobs