nix(refactor): Add withEnv to checked-shell-script
This commit is contained in:
committed by
Wolfgang Walther
parent
40b1dccc54
commit
39d4646a4c
@@ -9,8 +9,14 @@
|
||||
, stdenv
|
||||
, writeTextFile
|
||||
}:
|
||||
{ name, docs, inRootDir ? false, redirectTixFiles ? true, withTmpDir ? false }: text:
|
||||
# TODO: do something sensible with docs, e.g. provide automated --help
|
||||
{ name
|
||||
, docs
|
||||
, inRootDir ? false
|
||||
, redirectTixFiles ? true
|
||||
, withEnv ? null
|
||||
, withTmpDir ? false
|
||||
}: text:
|
||||
let
|
||||
bin =
|
||||
writeTextFile {
|
||||
@@ -46,6 +52,10 @@ let
|
||||
# remove the tmpdir when cancelled (postgrest-watch)
|
||||
trap 'rm -rf "$tmpdir"' SIGINT SIGTERM
|
||||
''
|
||||
+ lib.optionalString (withEnv != null) ''
|
||||
env="$(cat ${withEnv})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
''
|
||||
+ "(${text})"
|
||||
+ lib.optionalString withTmpDir ''
|
||||
|
||||
|
||||
+5
-14
@@ -24,11 +24,9 @@ let
|
||||
name = "postgrest-test-spec";
|
||||
docs = "Run the Haskell test suite";
|
||||
inRootDir = true;
|
||||
withEnv = postgrest.env;
|
||||
}
|
||||
''
|
||||
env="$(cat ${postgrest.env})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
|
||||
${withTools.latest} ${cabal-install}/bin/cabal v2-test ${devCabalOptions}
|
||||
'';
|
||||
|
||||
@@ -38,11 +36,9 @@ let
|
||||
name = "postgrest-test-spec-idempotence";
|
||||
docs = "Check that the Haskell tests can be run multiple times against the same db.";
|
||||
inRootDir = true;
|
||||
withEnv = postgrest.env;
|
||||
}
|
||||
''
|
||||
env="$(cat ${postgrest.env})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
|
||||
${withTools.latest} ${runtimeShell} -c " \
|
||||
${cabal-install}/bin/cabal v2-test ${devCabalOptions} && \
|
||||
${cabal-install}/bin/cabal v2-test ${devCabalOptions}"
|
||||
@@ -64,11 +60,9 @@ let
|
||||
name = "postgrest-test-io";
|
||||
docs = "Run the pytest-based IO tests.";
|
||||
inRootDir = true;
|
||||
withEnv = postgrest.env;
|
||||
}
|
||||
''
|
||||
env="$(cat ${postgrest.env})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
|
||||
${cabal-install}/bin/cabal v2-build ${devCabalOptions}
|
||||
${cabal-install}/bin/cabal v2-exec ${withTools.latest} \
|
||||
${ioTestPython}/bin/pytest -- -v test/io-tests "$@"
|
||||
@@ -93,11 +87,9 @@ let
|
||||
name = "postgrest-dump-schema";
|
||||
docs = "Dump the loaded schema's DbStructure as a yaml file.";
|
||||
inRootDir = true;
|
||||
withEnv = postgrest.env;
|
||||
}
|
||||
''
|
||||
env="$(cat ${postgrest.env})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
|
||||
${withTools.latest} \
|
||||
${cabal-install}/bin/cabal v2-run ${devCabalOptions} --verbose=0 -- \
|
||||
postgrest --dump-schema \
|
||||
@@ -111,11 +103,10 @@ let
|
||||
docs = "Run spec and io tests while collecting hpc coverage data.";
|
||||
inRootDir = true;
|
||||
redirectTixFiles = false;
|
||||
withEnv = postgrest.env;
|
||||
withTmpDir = true;
|
||||
}
|
||||
''
|
||||
env="$(cat ${postgrest.env})"
|
||||
export PATH="$env/bin:$PATH"
|
||||
export LOCALE_ARCHIVE="${glibcLocales}/lib/locale/locale-archive"
|
||||
|
||||
# clean up previous coverage reports
|
||||
|
||||
Reference in New Issue
Block a user