on master help sign in
Merge pull request #534 from obsidiansystems/ci-profiled

CI profiled builds too

commitd224f5016920cd180c40792573066302b9a16cba authorElliot Cameron <3noch@users.noreply.github.com> dateFri 10 Jan 2020, 21:51 (7 years ago) parent5c29c50254a08c
3 files changed+72−50
all-builds.nix+59−39 default.nix+11−9 dep/reflex-platform/github.json+2−2
all-builds.nix+59−39
@@ -3,7 +3,10 @@
33 iosSdkVersion = "10.2";
44 }
55, local-self ? import ./. self-args
6−, supportedSystems ? [ "x86_64-linux" "x86_64-darwin" ]
6+, supportedSystems ? [
7+ "x86_64-linux"
8+ "x86_64-darwin"
9+ ]
710}:
811
912let
@@ -48,46 +51,63 @@ let
4851 in pkgAttrs: builtins.concatLists (map extractDeps (builtins.attrValues pkgAttrs));
4952
5053 perPlatform = lib.genAttrs cacheBuildSystems (system: let
51− obelisk = import ./. (self-args // { inherit system; });
52− reflex-platform = obelisk.reflex-platform;
53− ghc = pnameToAttrs
54− obelisk.haskellPackageSets.ghc
55− obeliskPackagesBackend;
56− ghcjs = pnameToAttrs
57− obelisk.haskellPackageSets.ghcjs
58− obeliskPackagesCommon;
59− cachePackages = builtins.concatLists [
60− (builtins.attrValues ghc)
61− (builtins.attrValues ghcjs)
62− (concatDepends ghc)
63− (concatDepends ghcjs)
64− (lib.optional reflex-platform.androidSupport androidSkeleton)
65− (lib.optional reflex-platform.iosSupport iosSkeleton)
66− [ command serverSkeletonExe serverSkeletonShell ]
67− ];
68− command = obelisk.command;
69− skeleton = import ./skeleton { inherit obelisk; };
70− serverSkeletonExe = skeleton.exe;
71− # TODO fix nixpkgs so it doesn't try to run the result of haskell shells as setup hooks.
72− serverSkeletonShell = local-self.nixpkgs.runCommand "shell-safe-for-dep" {} ''
73− touch "$out"
74− echo "return" >> "$out"
75− cat "${skeleton.shells.ghc}" >> "$out"
76− '';
77− androidSkeleton = (import ./skeleton { inherit obelisk; }).android.frontend;
78− iosSkeleton = (import ./skeleton { inherit obelisk; }).ios.frontend;
54+ reflex-platform = import ./dep/reflex-platform { inherit system; };
55+ perProfiling = profiling: let
56+ obelisk = import ./. (self-args // { inherit system profiling; });
57+ ghc = pnameToAttrs
58+ obelisk.haskellPackageSets.ghc
59+ obeliskPackagesBackend;
60+ ghcjs = pnameToAttrs
61+ obelisk.haskellPackageSets.ghcjs
62+ obeliskPackagesCommon;
63+ cachePackages = builtins.concatLists [
64+ (builtins.attrValues ghc)
65+ (lib.optionals (!profiling) (builtins.attrValues ghcjs))
66+ (concatDepends ghc)
67+ (lib.optionals (!profiling) (concatDepends ghcjs))
68+ (lib.optional reflex-platform.androidSupport androidSkeleton)
69+ (lib.optional reflex-platform.iosSupport iosSkeleton)
70+ (lib.optionals (!profiling) [
71+ command
72+ serverSkeletonExe
73+ serverSkeletonShell
74+ ])
75+ ];
76+ command = obelisk.command;
77+ skeleton = import ./skeleton { inherit obelisk; };
78+ serverSkeletonExe = skeleton.exe;
79+ # TODO fix nixpkgs so it doesn't try to run the result of haskell shells as setup hooks.
80+ serverSkeletonShell = local-self.nixpkgs.runCommand "shell-safe-for-dep" {} ''
81+ touch "$out"
82+ echo "return" >> "$out"
83+ cat "${skeleton.shells.ghc}" >> "$out"
84+ '';
85+ androidSkeleton = (import ./skeleton { inherit obelisk; }).android.frontend;
86+ iosSkeleton = (import ./skeleton { inherit obelisk; }).ios.frontend;
87+ nameSuffix = if profiling then "profiled" else "unprofiled";
88+ in {
89+ inherit
90+ ghc
91+ ;
92+ cache = reflex-platform.pinBuildInputs "obelisk-${system}-${nameSuffix}" cachePackages;
93+ } // lib.optionalAttrs (!profiling) {
94+ inherit
95+ command
96+ ghcjs
97+ serverSkeletonExe
98+ serverSkeletonShell
99+ ;
100+ } // lib.optionalAttrs reflex-platform.androidSupport {
101+ inherit androidSkeleton;
102+ } // lib.optionalAttrs reflex-platform.iosSupport {
103+ inherit iosSkeleton;
104+ };
105+ profiled = perProfiling true;
106+ unprofiled = perProfiling false;
107+ cachePackages = map (p: p.cache) [ profiled unprofiled ];
79108 in {
80− inherit
81− command
82− ghc ghcjs
83− serverSkeletonExe
84− serverSkeletonShell
85− ;
109+ inherit profiled unprofiled;
86110 cache = reflex-platform.pinBuildInputs "obelisk-${system}" cachePackages;
87− } // lib.optionalAttrs reflex-platform.androidSupport {
88− inherit androidSkeleton;
89− } // lib.optionalAttrs reflex-platform.iosSupport {
90− inherit iosSkeleton;
91111 });
92112
93113 metaCache = local-self.reflex-platform.pinBuildInputs
default.nix+11−9
@@ -155,6 +155,7 @@ in rec {
155155 compressedJs = frontend: optimizationLevel: pkgs.runCommand "compressedJs" {} ''
156156 mkdir $out
157157 cd $out
158+ # TODO profiling + static shouldn't break and need an ad-hoc workaround like that
158159 ln -s "${haskellLib.justStaticExecutables frontend}/bin/frontend.jsexe/all.js" all.unminified.js
159160 ${if optimizationLevel == null then ''
160161 ln -s all.unminified.js all.js
@@ -237,7 +238,7 @@ in rec {
237238 pkgs.runCommand "serverExe" {} ''
238239 mkdir $out
239240 set -eux
240− ln -s "${haskellLib.justStaticExecutables backend}"/bin/* $out/
241+ ln -s "${if profiling then backend else haskellLib.justStaticExecutables backend}"/bin/* $out/
241242 ln -s "${mkAssets assets}" $out/static.assets
242243 ln -s ${mkAssets (compressedJs frontend optimizationLevel)} $out/frontend.jsexe.assets
243244 echo ${version} > $out/version
@@ -335,18 +336,19 @@ in rec {
335336 passthru = { inherit android ios packages overrides tools shellToolOverrides withHoogle staticFiles staticFilesImpure __closureCompilerOptimizationLevel processedStatic __iosWithConfig __androidWithConfig; };
336337 };
337338 in mkProject (projectDefinition args));
338− serverOn = sys: version: serverExe
339− (projectOut sys).ghc.backend
340− (projectOut system).ghcjs.frontend
341− (projectOut sys).passthru.staticFiles
342− (projectOut sys).passthru.__closureCompilerOptimizationLevel
339+ mainProjectOut = projectOut system;
340+ serverOn = projectInst: version: serverExe
341+ projectInst.ghc.backend
342+ mainProjectOut.ghcjs.frontend
343+ projectInst.passthru.staticFiles
344+ projectInst.passthru.__closureCompilerOptimizationLevel
343345 version;
344− linuxExe = serverOn "x86_64-linux";
346+ linuxExe = serverOn (projectOut "x86_64-linux");
345347 dummyVersion = "Version number is only available for deployments";
346− in projectOut system // {
348+ in mainProjectOut // {
347349 linuxExeConfigurable = linuxExe;
348350 linuxExe = linuxExe dummyVersion;
349− exe = serverOn system dummyVersion;
351+ exe = serverOn mainProjectOut dummyVersion;
350352 server = args@{ hostName, adminEmail, routeHost, enableHttps, version }:
351353 server (args // { exe = linuxExe version; });
352354 obelisk = import (base + "/.obelisk/impl") {};
dep/reflex-platform/github.json+2−2
@@ -2,6 +2,6 @@
22 "owner": "reflex-frp",
33 "repo": "reflex-platform",
44 "branch": "develop",
5− "rev": "d3e7dcda076b6a2360fcc57fa808549e34c17540",
6− "sha256": "0bxzs9w1xcgyr6c7xarwn5kx5nwjcgs67dmrjvjdja2h1m140jf2"
5+ "rev": "90351bdb2c99d416ea95fd5b8b474e8f9fab2942",
6+ "sha256": "0bbzz4ckdx0ilhhpd3drfbsc0zdb2rnhw2m3nls9villbs3lz3lh"
77}