-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy path.gitlab-ci.yml
More file actions
123 lines (111 loc) · 3.74 KB
/
Copy path.gitlab-ci.yml
File metadata and controls
123 lines (111 loc) · 3.74 KB
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
116
117
118
119
120
121
122
123
variables:
# Set `CCACHE_BASEDIR` and `CCACHE_DIR` to point `ccache` towards the cached
# path on the gitlab-runner. This enables to cache the output of `ccache`
# between various runs.
CCACHE_BASEDIR: "${CI_PROJECT_DIR}"
CCACHE_DIR: "${CI_PROJECT_DIR}/ccache"
# Set `ccache` to `content` to prevent rebuilding of the CI/CD containers to
# trigger a recreate of the cache. By using `content` the compiler's `mtime`
# is not considered as part of the hash.
CCACHE_COMPILERCHECK: "content"
# Enable caching for `apt-get`.
APT_CACHE_DIR: "${CI_PROJECT_DIR}/apt-cache"
# Export `noninteractive` frontend to prevent requesting user input.
DEBIAN_FRONTEND: "noninteractive"
# Define pipeline trigger behaviour. The pipeline is triggered by:
# - a merge request: run a merge request pipeline
# - a change to a branch, but an open merge reqeust: no branch pipeline
# - a change to a branch, but no open merge request: run branch pipeline
workflow:
rules:
- if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
- if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
when: never
- if: '$CI_COMMIT_BRANCH'
# Tests are separated into stages `test` and `validation`, where the latter
# should only consider explitit validation tests as defined in the
# `Validation.*` test suite.
stages:
- build
- test
- validation
- documentation
# Template for setting up HemoCell for each job:
# - initialising cache directories;
# - installing dependencies in the container;
# - defining the shared cache, most predominantly for `ccache`.
.job-template: &job-template
before_script:
# setup the environment and dependencies
- mkdir -pv $APT_CACHE_DIR ccache
- apt-get update --yes -qq
- apt-get -o dir::cache::archives="$APT_CACHE_DIR" install --yes -qq git g++ gcc cmake make libopenmpi-dev libhdf5-mpi-dev libhdf5-dev patch wget ccache
# setup hemocell, e.g. patch `palabos`
- ./setup.sh > /dev/null
# ensure compiler commands use `ccache`
- mkdir -p build && cd build
- cmake .. -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache
cache:
# Cache is shared between branches, but has a unique cache per job.
key: "$CI_JOB_NAME"
paths:
# Note: directories should align with `$APT_CACHE_DIR` and `$CCACHE_DIR`.
- apt-cache/
- ccache/
.build-template: &build-template
stage: build
script:
# Ensure all example binaries successfully compile.
- >
while read target; do
cmake --build . --target ${target}
done < <(cut -d '"' -f2 < ../examples/CMakeLists.txt)
- ccache --show-stats
# Excludes validation tests
.test-template: &test-template
stage: test
script:
- cmake --build . --target hemocell_test
- ccache --show-stats
- GTEST_FILTER="-Validation.*" ctest --output-on-failure
# Only validation tests
.validation-template: &validation-template
stage: validation
script:
- cmake --build . --target hemocell_test
- ccache --show-stats
- GTEST_FILTER="Validation.*" ctest -V
Ubuntu-build:
image: ubuntu:20.04
<<: *job-template
<<: *build-template
Ubuntu-test:
image: ubuntu:20.04
needs: [Ubuntu-build]
<<: *job-template
<<: *test-template
Debian-build:
image: debian:9
<<: *job-template
<<: *build-template
Debian-test:
image: debian:9
needs: [Debian-build]
<<: *job-template
<<: *test-template
Debian-validate:
needs: [Debian-test, Ubuntu-test]
image: debian:9
<<: *job-template
<<: *validation-template
Documentation:
image: python:3.9-alpine
stage: documentation
needs: [Debian-validate]
script:
- apk update && apk add make doxygen graphviz ttf-freefont
- pip install -r doc/requirements.txt
- cd doc/user_guide && make html
artifacts:
paths:
- doc/user_guide/_build