Skip to content

Commit b368a5d

Browse files
authored
Cache ghc883 and ghc8101 again (without tests) (#821)
When ghc 8.8.4 and ghc 8.10.2 were added we stopped building the older versions on ci. This changes adds them back but does not run all the tests on them.
1 parent fa25a67 commit b368a5d

File tree

4 files changed

+71
-31
lines changed

4 files changed

+71
-31
lines changed

ci.nix

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@
1212
"R1909" = "nixpkgs-1909";
1313
"R2003" = "nixpkgs-2003";
1414
};
15-
compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (compiler-nix-name: _:
16-
(import ./default.nix { inherit checkMaterialization; }).nixpkgsArgs) ({
17-
ghc865 = {};
18-
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2003") {
19-
ghc884 = {};
20-
ghc8102 = {};
21-
});
15+
compilerNixNames = nixpkgsName: nixpkgs: builtins.mapAttrs (compiler-nix-name: runTests: {
16+
inherit (import ./default.nix { inherit checkMaterialization; }) nixpkgsArgs;
17+
inherit runTests;
18+
}) (
19+
# GHC version to cache and whether to run the tests against them.
20+
# This list of GHC versions should include everything for which we
21+
# have a ./materialized/ghcXXX directory containing the materialized
22+
# cabal-install and nix-tools plans. When removing a ghc version
23+
# from here (so that is no longer cached) also remove ./materialized/ghcXXX.
24+
# Update supported-ghc-versions.md to reflect any changes made here.
25+
{
26+
ghc865 = true;
27+
} // nixpkgs.lib.optionalAttrs (nixpkgsName == "R2003") {
28+
ghc883 = false;
29+
ghc884 = true;
30+
ghc8101 = false;
31+
ghc8102 = true;
32+
});
2233
systems = nixpkgs: nixpkgs.lib.filterAttrs (_: v: builtins.elem v supportedSystems) {
2334
# I wanted to take these from 'lib.systems.examples', but apparently there isn't one for linux!
2435
linux = "x86_64-linux";
@@ -28,7 +39,7 @@
2839
# We need to use the actual nixpkgs version we're working with here, since the values
2940
# of 'lib.systems.examples' are not understood between all versions
3041
let lib = nixpkgs.lib;
31-
in lib.optionalAttrs (system == "x86_64-linux" && compiler-nix-name != "ghc8102") {
42+
in lib.optionalAttrs (system == "x86_64-linux" && compiler-nix-name != "ghc8101" && compiler-nix-name != "ghc8102") {
3243
# Windows cross compilation is currently broken on macOS
3344
inherit (lib.systems.examples) mingwW64;
3445
} // lib.optionalAttrs (system == "x86_64-linux") {
@@ -41,7 +52,7 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
4152
let pinnedNixpkgsSrc = sources.${nixpkgs-pin};
4253
# We need this for generic nixpkgs stuff at the right version
4354
genericPkgs = import pinnedNixpkgsSrc {};
44-
in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: nixpkgsArgs:
55+
in dimension "GHC version" (compilerNixNames nixpkgsName genericPkgs) (compiler-nix-name: {nixpkgsArgs, runTests}:
4556
dimension "System" (systems genericPkgs) (systemName: system:
4657
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system; });
4758
build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
@@ -50,8 +61,10 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
5061
# Native builds
5162
# TODO: can we merge this into the general case by picking an appropriate "cross system" to mean native?
5263
native = pkgs.recurseIntoAttrs ({
53-
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
64+
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
5465
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
66+
} // pkgs.lib.optionalAttrs runTests {
67+
inherit (build) tests tools maintainer-scripts maintainer-script-cache;
5568
} // pkgs.lib.optionalAttrs (ifdLevel >= 1) {
5669
iserv-proxy = pkgs.ghc-extra-packages."${compiler-nix-name}".iserv-proxy.components.exes.iserv-proxy;
5770
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {
@@ -63,21 +76,17 @@ dimension "Nixpkgs version" nixpkgsVersions (nixpkgsName: nixpkgs-pin:
6376
# Cross builds
6477
let pkgs = import pinnedNixpkgsSrc (nixpkgsArgs // { inherit system crossSystem; });
6578
build = import ./build.nix { inherit pkgs ifdLevel compiler-nix-name; };
66-
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) {
67-
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
68-
# TODO: look into cross compiling ghc itself
69-
# ghc = pkgs.haskell-nix.compiler."${compiler-nix-name}";
70-
# TODO: look into making tools work when cross compiling
71-
# inherit (build) tools;
72-
# Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
73-
tests =
74-
if (crossSystemName != "aarch64-multiplatform")
75-
then build.tests
76-
else pkgs.recurseIntoAttrs {
77-
# Even on aarch64 we still want to build the pinned files
78-
inherit (build.tests) roots;
79-
};
80-
} // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
79+
in pkgs.recurseIntoAttrs (pkgs.lib.optionalAttrs (ifdLevel >= 1) ({
80+
roots = pkgs.haskell-nix.roots' compiler-nix-name ifdLevel;
81+
ghc = pkgs.buildPackages.haskell-nix.compiler."${compiler-nix-name}";
82+
# TODO: look into cross compiling ghc itself
83+
# ghc = pkgs.haskell-nix.compiler."${compiler-nix-name}";
84+
# TODO: look into making tools work when cross compiling
85+
# inherit (build) tools;
86+
} // pkgs.lib.optionalAttrs (runTests && crossSystemName != "aarch64-multiplatform") {
87+
# Tests are broken on aarch64 cross https://github.com/input-output-hk/haskell.nix/issues/513
88+
inherit (build) tests;
89+
}) // pkgs.lib.optionalAttrs (ifdLevel >= 2) {
8190
remote-iserv = pkgs.ghc-extra-packages."${compiler-nix-name}".remote-iserv.components.exes.remote-iserv;
8291
iserv-proxy = pkgs.ghc-extra-packages."${compiler-nix-name}".iserv-proxy.components.exes.iserv-proxy;
8392
} // pkgs.lib.optionalAttrs (ifdLevel >= 3) {

docs/adding-new-ghc.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ you update the `spec.sha256` or the other versions source will be used.
88
Check the LLVM version that should be used in the
99
[ghc wiki](https://gitlab.haskell.org/ghc/ghc/-/wikis/commentary/compiler/backends/llvm/installing).
1010

11+
## Update the list of cached GHC versions in `ci.nix`
1112

12-
## Update the materialized files
13+
## Update [supported ghc versions](supported-ghc-versions.md) document
14+
15+
## Add the materialized files
1316

1417
In the haskell.nix repo run:
1518

docs/supported-ghc-versions.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Supported GHC Versions
2+
3+
The following versions of GHC built on the CI servers and should be included
4+
in the cache (for the default haskell.nix `nixpkgs`).
5+
6+
* 8.6.5 `compiler-nix-name = "ghc865";`
7+
* 8.8.3 `compiler-nix-name = "ghc883";`
8+
* 8.8.4 `compiler-nix-name = "ghc884";`
9+
* 8.10.1 `compiler-nix-name = "ghc8101";`
10+
* 8.10.2 `compiler-nix-name = "ghc8102";`
11+
12+
Full test suite is run against 8.6.5, 8.8.4 and 8.10.2.
13+
14+
See [ci.nix](https://github.com/input-output-hk/haskell.nix/blob/master/ci.nix)
15+
for the list of tested GHC versions.
16+
17+
The following GHC versions are not included in CI and will not be cached:
18+
19+
* 8.4.4 `compiler-nix-name = "ghc844";`
20+
* 8.6.1 `compiler-nix-name = "ghc861";`
21+
* 8.6.2 `compiler-nix-name = "ghc862";`
22+
* 8.6.3 `compiler-nix-name = "ghc863";`
23+
* 8.6.4 `compiler-nix-name = "ghc864";`
24+
* 8.8.1 `compiler-nix-name = "ghc881";`
25+
* 8.8.2 `compiler-nix-name = "ghc882";`
26+
27+
See [overlays/bootstrap.nix](https://github.com/input-output-hk/haskell.nix/blob/master/overlays/bootstrap.nix)
28+
for a list of all the valid `compiler-nix-names`.
29+
30+
See also:
31+
32+
* [Instructions on adding new ghc versions](adding-new-ghc.md).

test/default.nix

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,7 @@ let
214214
# - input ifdLevel is 3 or greater: return allTests
215215
optionalIfdTests = ifdLevel:
216216
pkgs.lib.optionalAttrs (ifdLevel > 1) (allTestsWithIfdInputs ifdLevel);
217-
in
218-
219-
pkgs.recurseIntoAttrs {
220-
roots = haskell-nix.roots' compiler-nix-name ifdLevel;
221-
} // optionalIfdTests ifdLevel
217+
in pkgs.recurseIntoAttrs (optionalIfdTests ifdLevel)
222218

223219
## more possible test cases
224220
# 1. fully static linking

0 commit comments

Comments
 (0)