/ .gitlab-ci.yml
.gitlab-ci.yml
1 # Optimising CI speed by using tips from https://blog.nimbleways.com/let-s-make-faster-gitlab-ci-cd-pipelines/ 2 image: adinapoli/gargantext:v3.4 3 4 variables: 5 STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root" 6 STACK_OPTS: "--system-ghc" 7 CABAL_STORE_DIR: "${CI_PROJECT_DIR}/.cabal" 8 CORENLP: "4.5.4" 9 FF_USE_FASTZIP: "true" 10 ARTIFACT_COMPRESSION_LEVEL: "fast" 11 CACHE_COMPRESSION_LEVEL: "fast" 12 13 stages: 14 - cabal 15 - stack 16 - bench 17 - test 18 19 stack: 20 stage: stack 21 cache: 22 key: stack.yaml 23 paths: 24 - .stack-root/ 25 - .stack-work/ 26 script: 27 - echo "Building the project from '$CI_PROJECT_DIR'" 28 - nix-shell --run "stack build --no-terminal --fast --dry-run" 29 allow_failure: false 30 31 cabal: 32 stage: cabal 33 cache: 34 key: cabal.project 35 paths: 36 - dist-newstyle/ 37 - .cabal/ 38 policy: pull-push 39 script: 40 - nix-shell --run "./bin/update-project-dependencies $CABAL_STORE_DIR && cabal --store-dir=$CABAL_STORE_DIR v2-build --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'" 41 allow_failure: false 42 43 bench: 44 stage: bench 45 when: manual # trigger it manually, as it causes full recompilation with optimisations enabled. 46 cache: 47 key: cabal.project 48 paths: 49 - dist-newstyle/ 50 - .cabal/ 51 policy: pull-push 52 script: 53 - nix-shell --run "./bin/update-project-dependencies $CABAL_STORE_DIR && cabal --store-dir=$CABAL_STORE_DIR v2-bench --flags +no-phylo-debug-logs --ghc-options='-O2 -fclear-plugins'" 54 allow_failure: true 55 56 test: 57 stage: test 58 cache: 59 key: cabal.project 60 paths: 61 - dist-newstyle/ 62 - .cabal/ 63 policy: pull-push 64 # The tests needs to run as the 'test' user, because they leverage the 65 # initdb utility from postgres that cannot be run by 'root'. 66 script: 67 - | 68 mkdir -p /home/test 69 mkdir -p /root/.config 70 useradd -U test 71 chown -R test:test dist-newstyle/ 72 chown -R test:test /root/ 73 chown -R test:test $CABAL_STORE_DIR 74 export CABAL=$(nix-shell --run "which cabal") 75 export TEST_NIX_PATH=$(nix-shell --run "echo -n \$PATH") 76 echo $CABAL 77 echo $TEST_NIX_PATH 78 git config --global --add safe.directory '*' 79 nix-shell --run "./bin/update-project-dependencies $CABAL_STORE_DIR" 80 mkdir -p /root/.cache/cabal/logs 81 chown -R test:test /root/.cache/cabal/logs/ 82 chown -R test:test /root/.cache/cabal/packages/hackage.haskell.org/ 83 84 mkdir -p /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current 85 cp -R /root/devops/coreNLP/stanford-corenlp-${CORENLP}/* /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current/ 86 87 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=$CABAL_STORE_DIR v2-test --test-show-details=streaming --flags 'test-crypto no-phylo-debug-logs' --ghc-options='-O0 -fclear-plugins'\"" 88 chown -R root:root dist-newstyle/ 89 chown -R root:root /root/ 90 chown -R root:root $CABAL_STORE_DIR 91 chown -R root:root /root/.cache/cabal/logs/ 92 chown -R root:root /root/.cache/cabal/packages/hackage.haskell.org/ 93 chown -Rh root:root /builds/gargantext/haskell-gargantext/devops/coreNLP/stanford-corenlp-current 94 95 #docs: 96 # stage: docs 97 # cache: 98 # key: stack.yaml 99 # paths: 100 # - .stack-root/ 101 # - .stack-work/ 102 # policy: pull 103 # script: 104 # - nix-shell --run "stack build --no-terminal --haddock --no-haddock-deps --fast --dry-run" 105 # - cp -R "$(stack path --local-install-root)"/doc ./output 106 # # FIXME(adinapoli) Currently Gitlab 11.x doesn't support the 'rules' keyword. 107 # # rules: 108 # # - if: '$CI_MERGE_REQUEST_IID' # Run job on Merge Requests 109 # only: 110 # - merge_requests 111 # artifacts: 112 # paths: 113 # - ./output 114 # expire_in: 1 week 115 # allow_failure: true