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