ci: fix jobs for macos: tests-examples, tests-integration-d2n-flakes

This commit is contained in:
DavHau 2023-07-04 18:56:20 +02:00
parent 41ef2e7b71
commit fddf4b321f
2 changed files with 23 additions and 1 deletions

View File

@ -6,8 +6,10 @@
coreutils, coreutils,
git, git,
gnugrep, gnugrep,
gnused,
jq, jq,
parallel, parallel,
moreutils,
nix, nix,
pkgs, pkgs,
framework, framework,
@ -23,7 +25,9 @@
coreutils coreutils
git git
gnugrep gnugrep
gnused
jq jq
moreutils
nix nix
] ]
'' ''
@ -37,6 +41,11 @@
if [ -n "''${NIX:-}" ]; then if [ -n "''${NIX:-}" ]; then
PATH="$(dirname $NIX):$PATH" PATH="$(dirname $NIX):$PATH"
fi fi
# Override `systems` in the flake.nix to only contain the current one.
# We don't want to expose multiple systems to reduce evaluation overhead.
sed "s/x86_64-linux/$NIX_SYSTEM/g" flake.nix | sponge flake.nix
nix flake lock --override-input dream2nix ${../../.} nix flake lock --override-input dream2nix ${../../.}
if nix flake show | grep -q resolveImpure; then if nix flake show | grep -q resolveImpure; then
nix run .#resolveImpure --show-trace nix run .#resolveImpure --show-trace
@ -45,7 +54,7 @@
# write to store at eval time # write to store at eval time
evalBlockList=("haskell_cabal-plan" "haskell_stack-lock") evalBlockList=("haskell_cabal-plan" "haskell_stack-lock")
if [[ ! ((''${evalBlockList[*]} =~ "$dir")) ]] \ if [[ ! ((''${evalBlockList[*]} =~ "$dir")) ]] \
&& [ "$(nix flake show --json | jq 'select(.packages."x86_64-linux".default.name)')" != "" ]; then && [ "$(nix flake show --json | jq 'select(.packages."$NIX_SYSTEM".default.name)')" != "" ]; then
nix eval --read-only --no-allow-import-from-derivation .#default.name nix eval --read-only --no-allow-import-from-derivation .#default.name
fi fi
nix flake check "$@" nix flake check "$@"
@ -58,10 +67,12 @@ in
framework.utils.writePureShellScript framework.utils.writePureShellScript
[ [
coreutils coreutils
nix
parallel parallel
] ]
'' ''
export STATS_FILE=$(mktemp) export STATS_FILE=$(mktemp)
export NIX_SYSTEM=$(nix eval --impure --expr builtins.currentSystem --raw)
if [ -z ''${1+x} ]; then if [ -z ''${1+x} ]; then
JOBS=''${JOBS:-$(nproc)} JOBS=''${JOBS:-$(nproc)}
parallel --halt now,fail=1 -j$JOBS -a <(ls ${examples}) ${testScript} parallel --halt now,fail=1 -j$JOBS -a <(ls ${examples}) ${testScript}

View File

@ -5,7 +5,9 @@
bash, bash,
coreutils, coreutils,
git, git,
gnused,
parallel, parallel,
moreutils,
nix, nix,
framework, framework,
... ...
@ -19,6 +21,8 @@
bash bash
coreutils coreutils
git git
gnused
moreutils
nix nix
] ]
'' ''
@ -29,6 +33,11 @@
start_time=$(date +%s) start_time=$(date +%s)
cp -r ${tests}/$dir/* . cp -r ${tests}/$dir/* .
chmod -R +w . chmod -R +w .
# Override `systems` in the flake.nix to only contain the current one.
# We don't want to expose multiple systems to reduce evaluation overhead.
sed "s/x86_64-linux/$NIX_SYSTEM/g" flake.nix | sponge flake.nix
nix flake lock --override-input dream2nix ${../../.} nix flake lock --override-input dream2nix ${../../.}
nix run .#resolveImpure || echo "no resolveImpure probably?" nix run .#resolveImpure || echo "no resolveImpure probably?"
nix build nix build
@ -42,10 +51,12 @@ in
framework.utils.writePureShellScript framework.utils.writePureShellScript
[ [
coreutils coreutils
nix
parallel parallel
] ]
'' ''
export STATS_FILE=$(mktemp) export STATS_FILE=$(mktemp)
export NIX_SYSTEM=$(nix eval --impure --expr builtins.currentSystem --raw)
if [ -z ''${1+x} ]; then if [ -z ''${1+x} ]; then
JOBS=''${JOBS:-$(nproc)} JOBS=''${JOBS:-$(nproc)}
parallel --halt now,fail=1 -j$JOBS -a <(ls ${tests}) ${testScript} parallel --halt now,fail=1 -j$JOBS -a <(ls ${tests}) ${testScript}