Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

backport to 1.35: add flake outputs that cicero expects #4769

Merged
merged 2 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GADTs #-}
{-# LANGUAGE ScopedTypeVariables #-}
Expand Down
4 changes: 2 additions & 2 deletions cardano-node-chairman/test/Spec/Network.hs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import qualified System.Random as IO
import qualified UnliftIO.Exception as IO

hprop_isPortOpen_False :: Property
hprop_isPortOpen_False = H.propertyOnce . H.workspace "temp/network" $ \_ -> do
hprop_isPortOpen_False = H.propertyOnce $ do
-- Check multiple random ports and assert that one is closed.
-- Multiple random ports are checked because there is a remote possibility a random
-- port is actually open by another program
Expand All @@ -42,7 +42,7 @@ hprop_isPortOpen_False = H.propertyOnce . H.workspace "temp/network" $ \_ -> do
H.assert (False `L.elem` results)

hprop_isPortOpen_True :: Property
hprop_isPortOpen_True = H.propertyOnce . H.workspace "temp/network" $ \_ -> do
hprop_isPortOpen_True = H.propertyOnce $ do
-- Check first random port from multiple possible ports to be successfully bound is open
-- Multiple random ports are checked because there is a remote possibility a random
-- port is actually open by another program
Expand Down
4 changes: 2 additions & 2 deletions cardano-testnet/test/Spec/Cli/Babbage/LeadershipSchedule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ hprop_leadershipSchedule = H.integration . H.runFinallies . H.workspace "alonzo"

leadershipScheduleDeadline <- H.noteShowM $ DTC.addUTCTime 180 <$> H.noteShowIO DTC.getCurrentTime

H.byDeadlineM 5 leadershipScheduleDeadline $ do
H.byDeadlineM 5 leadershipScheduleDeadline "leadershipSchedule:current:error" $ do
void $ H.execCli' execConfig
[ "query", "leadership-schedule"
, "--testnet-magic", show @Int testnetMagic
Expand Down Expand Up @@ -157,7 +157,7 @@ hprop_leadershipSchedule = H.integration . H.runFinallies . H.workspace "alonzo"

leadershipScheduleDeadline <- H.noteShowM $ DTC.addUTCTime 180 <$> H.noteShowIO DTC.getCurrentTime

H.byDeadlineM 5 leadershipScheduleDeadline $ do
H.byDeadlineM 5 leadershipScheduleDeadline "leadershipSchedule:next:error" $ do
void $ H.execCli' execConfig
[ "query", "leadership-schedule"
, "--testnet-magic", show @Int testnetMagic
Expand Down
30 changes: 19 additions & 11 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -397,9 +397,8 @@
}
);

makeRequired = isPr: extra:
makeRequired = isPr: jobs: extra:
let
jobs = lib.foldl' lib.mergeAttrs { } (lib.attrValues flake.systemHydraJobs);
nonRequiredPaths = map lib.hasPrefix ([ "macos." ] ++ lib.optional isPr "linux.native.membenches");
in with self.legacyPackages.${defaultSystem};
releaseTools.aggregate {
Expand All @@ -412,6 +411,14 @@
jobs) ++ extra;
};

makeOsRequired = isPr: jobs: {
linux = jobs.linux // {
required = makeRequired isPr jobs.linux [];
};
macos = jobs.macos // {
required = makeRequired isPr jobs.macos [];
};
};

hydraJobs =
let
Expand All @@ -422,8 +429,8 @@
build-version = writeText "version.json" (builtins.toJSON {
inherit (self) lastModified lastModifiedDate narHash outPath shortRev rev;
});
required = makeRequired false [ cardano-deployment build-version ];
});
required = makeRequired false jobs [ cardano-deployment build-version ];
}) // makeOsRequired false jobs;

hydraJobsPr =
let
Expand All @@ -432,14 +439,15 @@
"linux.native.workbench-ci-analysis"
"linux.native.workbench-ci-test"
];
in
(lib.mapAttrsRecursiveCond (v: !(lib.isDerivation v))
(path: value:
let stringPath = lib.concatStringsSep "." path; in if lib.isAttrs value && (lib.any (p: p stringPath) nonPrJobs) then { } else value)
hydraJobs) // {
required = makeRequired true [ hydraJobs.cardano-deployment hydraJobs.build-version ];
};

jobs = lib.mapAttrsRecursiveCond (v: !(lib.isDerivation v))
(path: value:
let stringPath = lib.concatStringsSep "." path; in if lib.isAttrs value && (lib.any (p: p stringPath) nonPrJobs) then { } else value)
hydraJobs;
in
jobs // {
required = makeRequired true jobs [ hydraJobs.cardano-deployment hydraJobs.build-version ];
} // makeOsRequired true jobs;
in
builtins.removeAttrs flake [ "systemHydraJobs" ] // {

Expand Down