-
Notifications
You must be signed in to change notification settings - Fork 5
/
.gitlab-ci.yml
115 lines (106 loc) · 3.8 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# Optimising CI speed by using tips from https://blog.nimbleways.com/let-s-make-faster-gitlab-ci-cd-pipelines/
image: adinapoli/gargantext:v3.4
variables:
STACK_ROOT: "${CI_PROJECT_DIR}/.stack-root"
STACK_OPTS: "--system-ghc"
CABAL_STORE_DIR: "${CI_PROJECT_DIR}/.cabal"
CORENLP: "4.5.4"
FF_USE_FASTZIP: "true"
ARTIFACT_COMPRESSION_LEVEL: "fast"
CACHE_COMPRESSION_LEVEL: "fast"
stages:
- cabal
- stack
- bench
- test
stack:
stage: stack
cache:
key: stack.yaml
paths:
- .stack-root/
- .stack-work/
script:
- echo "Building the project from '$CI_PROJECT_DIR'"
- nix-shell --run "stack build --no-terminal --fast --dry-run"
allow_failure: false
cabal:
stage: cabal
cache:
key: cabal.project
paths:
- dist-newstyle/
- .cabal/
policy: pull-push
script:
- 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'"
allow_failure: false
bench:
stage: bench
when: manual # trigger it manually, as it causes full recompilation with optimisations enabled.
cache:
key: cabal.project
paths:
- dist-newstyle/
- .cabal/
policy: pull-push
script:
- 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'"
allow_failure: true
test:
stage: test
cache:
key: cabal.project
paths:
- dist-newstyle/
- .cabal/
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:
- |
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 $CABAL_STORE_DIR
export CABAL=$(nix-shell --run "which cabal")
export TEST_NIX_PATH=$(nix-shell --run "echo -n \$PATH")
echo $CABAL
echo $TEST_NIX_PATH
git config --global --add safe.directory '*'
nix-shell --run "./bin/update-project-dependencies $CABAL_STORE_DIR"
mkdir -p /root/.cache/cabal/logs
chown -R test:test /root/.cache/cabal/logs/
chown -R test:test /root/.cache/cabal/packages/hackage.haskell.org/
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/
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'\""
chown -R root:root dist-newstyle/
chown -R root:root /root/
chown -R root:root $CABAL_STORE_DIR
chown -R root:root /root/.cache/cabal/logs/
chown -R root:root /root/.cache/cabal/packages/hackage.haskell.org/
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