[nix] some attempt to make tests work

parent ac6ce3c0
Pipeline #7745 failed with stages
in 56 minutes and 33 seconds
......@@ -107,3 +107,44 @@ test:
chown -R root:root /root/
chown -R root:root $STORE_DIR
chown -R root:root /root/.cache/cabal/logs/
test-flake:
stage: test
# The tests needs to run as the 'test' user, because they leverage the
# initdb utility from postgres that cannot be run by 'root'.
before_script:
- echo "Creating test user..."
- mkdir -p /home/test
- mkdir -p /root/.config
- useradd -U test
- chown -R test:test dist-newstyle/
- chown -R test:test /root/
- chown -R test:test $STORE_DIR
- chown -R test:test ${CABAL_DIR}
- mkdir -p "$XDG_CACHE_HOME/nix"
- chown -R test:test "$XDG_CACHE_HOME/nix"
cache:
key: cabal.project
paths:
- dist-newstyle/
- .cabal/
policy: pull-push
script:
- |
git config --global --add safe.directory $XDG_CACHE_HOME/nix/tarball-cache
git config --global --add safe.directory '*'
export TEST_TMPDIR="${CI_PROJECT_DIR}/tmp"
mkdir -p "$TEST_TMPDIR"
nix-shell --run "./bin/update-project-dependencies $STORE_DIR"
mkdir -p /root/.cache/cabal/logs
chown -R test:test /root/.cache/cabal/logs/
chown -R test:test "$TEST_TMPDIR"
chown -R test:test /root/.config/
su -m test -c "export TMPDIR=$TEST_TMPDIR && cd /builds/gargantext/haskell-gargantext; nix run .#gargantext:test:garg-test"
chown -R root:root dist-newstyle/
chown -R root:root /root/
chown -R root:root $STORE_DIR
chown -R root:root /root/.cache/cabal/logs/
......@@ -209,12 +209,12 @@
# Preserve rev for the inputMap
passthru.rev = src.rev;
};
applyPatches = inputName: patches: pkgs.buildPackages.applyPatches
{
name = "${inputName}-patched";
src = inputs.${inputName};
inherit patches;
} // { inherit (inputs.${inputName}) rev; };
# applyPatches = inputName: patches: pkgs.buildPackages.applyPatches
# {
# name = "${inputName}-patched";
# src = inputs.${inputName};
# inherit patches;
# } // { inherit (inputs.${inputName}) rev; };
in
{
#"https://github.com/AccelerateHS/accelerate-llvm.git" = inputs.accelerate-llvm;
......@@ -295,6 +295,9 @@
};
packages.llvm-hs.components.library.build-tools = lib.mkOverride 49 [ pkgs.llvmPackages_12.llvm ];
#packages.gargantext.components.tests.garg-test.systemDepends = [ pkgs.postgresql_14 ];
packages.postgresql-simple.components.library.libs = [ pkgs.postgresql_14 ];
})
];
......@@ -541,31 +544,17 @@
'';
};
};
# For garg-test-hspec
coreNLP = pkgs.callPackage ./nix/corenlp.nix { };
# # Avoid recompiling openjdk due to any overlay used in the common pkgs.
# let pkgs = import inputs.nixpkgs { inherit system; }; in
# inputs.flake-utils.lib.mkApp {
# drv = pkgs.writeShellApplication {
# name = "coreNLP";
# text = ''
# set -x
# exec ${pkgs.openjdk}/bin/java -mx4g -cp '${inputs.coreNLP}/*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000 -timeout 15000
# '';
# };
# };
};
# For running all checks (very slow):
# $ nix -L flake check
#
# For building a specific check of the project:
# $ nix -L build .#project.hsPkgs.gargantext.components.tests.garg-test-tasty
# $ result/bin/garg-test-tasty
# $ nix -L build .#project.hsPkgs.gargantext.components.tests.garg-test
# $ result/bin/garg-test
#
# Alternatively, but slower:
# $ nix -L build .#checks.x86_64-linux.gargantext:test:garg-test-tasty
# $ nix -L build .#checks.x86_64-linux.gargantext:test:garg-test
# $ bat result/test-stdout
#
# See names from:
......
This diff is collapsed.
......@@ -74,7 +74,7 @@ killProcessTree :: (Handle, Handle, ProcessHandle) -> IO ()
killProcessTree (_, _, ph) = do
pid <- getPid ph
case pid of
Nothing -> putText "Process already terminated"
Nothing -> putText "[killProcessTree] Process already terminated"
Just p -> do
pgid <- getProcessGroupIDOf p
signalProcessGroup keyboardSignal pgid
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment