Commit b58a0cce authored by Alfredo Di Napoli's avatar Alfredo Di Napoli

Try to override XDG_CACHE_DIR

parent cbb64888
...@@ -6,10 +6,12 @@ variables: ...@@ -6,10 +6,12 @@ variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root" STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root"
STACK_OPTS: "--system-ghc" STACK_OPTS: "--system-ghc"
STORE_DIR: "${CI_PROJECT_DIR}/.cabal" STORE_DIR: "${CI_PROJECT_DIR}/.cabal"
CABAL_DIR: "${CI_PROJECT_DIR}/.cabal"
CORENLP: "4.5.4" CORENLP: "4.5.4"
FF_USE_FASTZIP: "true" FF_USE_FASTZIP: "true"
ARTIFACT_COMPRESSION_LEVEL: "fast" ARTIFACT_COMPRESSION_LEVEL: "fast"
CACHE_COMPRESSION_LEVEL: "fast" CACHE_COMPRESSION_LEVEL: "fast"
XDG_CACHE_HOME: "/builds/gargantext/.cache"
stages: stages:
- cabal - cabal
...@@ -26,6 +28,8 @@ stack: ...@@ -26,6 +28,8 @@ stack:
- .stack-work/ - .stack-work/
script: script:
- echo "Building the project from '$CI_PROJECT_DIR'" - echo "Building the project from '$CI_PROJECT_DIR'"
- git config --global --add safe.directory $XDG_CACHE_HOME/nix/tarball-cache
- git config --global --add safe.directory '*'
- nix-shell --run "stack build --no-terminal --fast --dry-run" - nix-shell --run "stack build --no-terminal --fast --dry-run"
allow_failure: false allow_failure: false
...@@ -38,6 +42,8 @@ cabal: ...@@ -38,6 +42,8 @@ cabal:
- .cabal/ - .cabal/
policy: pull-push policy: pull-push
script: script:
- git config --global --add safe.directory $XDG_CACHE_HOME/nix/tarball-cache
- git config --global --add safe.directory '*'
- nix-shell --run "./bin/update-project-dependencies $STORE_DIR && cabal --store-dir=$STORE_DIR v2-build all --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'" - nix-shell --run "./bin/update-project-dependencies $STORE_DIR && cabal --store-dir=$STORE_DIR v2-build all --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'"
allow_failure: false allow_failure: false
...@@ -56,64 +62,50 @@ bench: ...@@ -56,64 +62,50 @@ bench:
test: test:
stage: test 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: cache:
key: cabal.project key: cabal.project
paths: paths:
- dist-newstyle/ - dist-newstyle/
- .cabal/ - .cabal/
policy: pull-push policy: pull-push
# The tests needs to run as the 'test' user, because they leverage the
# initdb utility from postgres that cannot be run by 'root'.
script: script:
- | - |
echo "Creating test user..." git config --global --add safe.directory $XDG_CACHE_HOME/nix/tarball-cache
mkdir -p /home/test git config --global --add safe.directory '*'
mkdir -p /root/.config export TEST_TMPDIR="${CI_PROJECT_DIR}/tmp"
useradd -U test mkdir -p "$TEST_TMPDIR"
chown -R test:test dist-newstyle/
chown -R test:test /root/
chown -R test:test $STORE_DIR
chown -R test:test /root/.cache/nix/tarball-cache
export CABAL=$(nix-shell --run "which cabal") export CABAL=$(nix-shell --run "which cabal")
echo "Found cabal at ${CABAL}" echo "Found cabal at ${CABAL}"
export TEST_NIX_PATH=$(nix-shell --run "echo -n \$PATH") export TEST_NIX_PATH=$(nix-shell --run "echo -n \$PATH")
echo "Found test nix path at ${TEST_NIX_PATH}" echo "Found test nix path at ${TEST_NIX_PATH}"
git config --global --add safe.directory '*'
nix-shell --run "./bin/update-project-dependencies $STORE_DIR" nix-shell --run "./bin/update-project-dependencies $STORE_DIR"
mkdir -p /root/.cache/cabal/logs mkdir -p /root/.cache/cabal/logs
chown -R test:test /root/.cache/cabal/logs/ chown -R test:test /root/.cache/cabal/logs/
chown -R test:test /root/.cache/cabal/packages/hackage.haskell.org/ chown -R test:test /root/.cache/cabal/packages/hackage.haskell.org/
chown -R test:test "$TEST_TMPDIR"
mkdir -p /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current mkdir -p /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current
cp -R /root/devops/coreNLP/stanford-corenlp-${CORENLP}/* /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current/ cp -R /root/devops/coreNLP/stanford-corenlp-${CORENLP}/* /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current/
nix-shell --run "chown -R test:test /root/.config/ && su -m test -c \"export PATH=$PATH:$TEST_NIX_PATH && cd /builds/gargantext/haskell-gargantext; $CABAL --store-dir=$STORE_DIR v2-test --test-show-details=streaming --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'\"" nix-shell --run "chown -R test:test /root/.config/ && su -m test -c \"export PATH=$PATH:$TEST_NIX_PATH && export TMPDIR=$TEST_TMPDIR && cd /builds/gargantext/haskell-gargantext; $CABAL --store-dir=$STORE_DIR v2-test --test-show-details=streaming --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'\""
chown -R root:root dist-newstyle/ chown -R root:root dist-newstyle/
chown -R root:root /root/ chown -R root:root /root/
chown -R root:root $STORE_DIR chown -R root:root $STORE_DIR
chown -R root:root /root/.cache/cabal/logs/ chown -R root:root /root/.cache/cabal/logs/
chown -R root:root /root/.cache/cabal/packages/hackage.haskell.org/ chown -R root:root /root/.cache/cabal/packages/hackage.haskell.org/
chown -R root:root /root/.cache/nix/tarball-cache
chown -Rh root:root /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current chown -Rh root:root /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current
#docs:
# stage: docs
# cache:
# key: stack.yaml
# paths:
# - .stack-root/
# - .stack-work/
# policy: pull
# script:
# - nix-shell --run "stack build --no-terminal --haddock --no-haddock-deps --fast --dry-run"
# - cp -R "$(stack path --local-install-root)"/doc ./output
# # FIXME(adinapoli) Currently Gitlab 11.x doesn't support the 'rules' keyword.
# # rules:
# # - if: '$CI_MERGE_REQUEST_IID' # Run job on Merge Requests
# only:
# - merge_requests
# artifacts:
# paths:
# - ./output
# expire_in: 1 week
# allow_failure: true
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