.gitlab-ci.yml 4.41 KB
Newer Older
Dion Haefner's avatar
Dion Haefner committed
1 2
variables:
  DUNE_CONTROL_PATH: /opt/dune:$CI_PROJECT_DIR
3
  DUNECONTROL: ./dune-common/bin/dunecontrol
Lukas Riedel's avatar
Lukas Riedel committed
4
  CPUS_MULTICORE: 4
5
  CPUS_DIND: 3
6 7
  DOCKER_LOGIN:
    docker login -u $DOCKER_HUB_USER -p $DOCKER_HUB_PW
8
  DUNE_ENV_IMAGE:
9
    dorie/dune-env:2.6
10 11 12 13 14
  CMAKE_FLAGS:
    -DDUNE_PYTHON_VIRTUALENV_SETUP=True
    -DDUNE_PYTHON_ALLOW_GET_PIP=True
  MAKE_FLAGS:
    -j $CPUS_MULTICORE
15 16

image: $DUNE_ENV_IMAGE
Dion Haefner's avatar
Dion Haefner committed
17 18 19

before_script:
  - cd /opt/dune
Dion Haefner's avatar
Dion Haefner committed
20

Dion Haefner's avatar
Dion Haefner committed
21
stages:
22
  - setup
Lukas Riedel's avatar
Lukas Riedel committed
23
  - prep
24
  - build
25
  - test
26 27
  - deploy

28 29

# --- Preparation of Docker Images ---
30
setup:dune-env: &setup
31
  stage: setup
32 33
  only:
    - web # activate through 'Run pipeline' only.
34 35 36 37 38 39 40
  tags:
    - dind
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_DRIVER: overlay2
41
  before_script:
42
    - $DOCKER_LOGIN
43
  script:
44
    - docker build -f docker/dune-env.dockerfile
45
      --build-arg PROCNUM=$CPUS_DIND
46
      -t $DUNE_ENV_IMAGE .
47
    - docker push $DUNE_ENV_IMAGE
48 49 50 51 52 53

setup:dune-env-clang:
  <<: *setup
  script:
    - docker build -f docker/dune-env.dockerfile
      --build-arg CC=clang
54
      --build-arg CXX=clang++
55 56 57
      --build-arg PROCNUM=$CPUS_DIND
      -t ${DUNE_ENV_IMAGE}-clang .
    - docker push ${DUNE_ENV_IMAGE}-clang
Dion Haefner's avatar
Dion Haefner committed
58

59
prep:update-dune: &update
60
  <<: *setup
61
  stage: prep
62 63 64
  only:
    - master
    - tags
65
  script:
66
    - docker build -f docker/dune-env-update.dockerfile
67 68
      --build-arg DUNE_ENV_IMAGE=$DUNE_ENV_IMAGE
      --build-arg PROCNUM=$CPUS_DIND
69
      -t $DUNE_ENV_IMAGE .
70
    - docker push $DUNE_ENV_IMAGE
71

72 73 74 75
prep:update-dune-clang:
  <<: *update
  script:
    - docker build -f docker/dune-env-update.dockerfile
76
      --build-arg DUNE_ENV_IMAGE=${DUNE_ENV_IMAGE}-clang
77 78
      --build-arg CC=clang
      --build-arg CXX=clang++
79
      --build-arg PROCNUM=$CPUS_DIND
80 81
      -t ${DUNE_ENV_IMAGE}-clang .
    - docker push ${DUNE_ENV_IMAGE}-clang
82 83 84


# --- Build jobs ---
85
build:main:
86
  stage: build
87 88
  tags:
    - multicore
Dion Haefner's avatar
Dion Haefner committed
89
  script:
Lukas Riedel's avatar
Lukas Riedel committed
90 91 92
    - CMAKE_FLAGS="$CMAKE_FLAGS"
      MAKE_FLAGS="$MAKE_FLAGS"
      $DUNECONTROL --only=dorie all
93 94
    - MAKE_FLAGS="$MAKE_FLAGS"
      $DUNECONTROL --only=dorie make build_tests
95
  artifacts:
96
    name: "$CI_JOB_NAME"
97
    paths:
98
      - $CI_PROJECT_DIR/build-cmake
Lukas Riedel's avatar
Lukas Riedel committed
99
    expire_in: 1 day
100

101
build:debug: &debug
102
  stage: build
103
  allow_failure: true
104
  script:
Lukas Riedel's avatar
Lukas Riedel committed
105 106 107 108
    - CMAKE_FLAGS="
        $CMAKE_FLAGS
        -DCMAKE_BUILD_TYPE=Debug 
        -DCMAKE_CXX_FLAGS_DEBUG='-Werror'"
109
      $DUNECONTROL --only=dorie configure
110
    - MAKE_FLAGS="$MAKE_FLAGS"
111
      $DUNECONTROL --only=dorie make dorie_mass_conservation
112

113 114 115
build:debug-clang:
  <<: *debug
  image: ${DUNE_ENV_IMAGE}-clang
116 117 118 119 120 121 122 123 124 125
  script:
    - CMAKE_FLAGS="
        $CMAKE_FLAGS
        -DCMAKE_BUILD_TYPE=Debug 
        -DCMAKE_C_COMPILER=clang
        -DCMAKE_CXX_COMPILER=clang++
        -DCMAKE_CXX_FLAGS_DEBUG='-Werror'"
      $DUNECONTROL --only=dorie configure
    - MAKE_FLAGS="$MAKE_FLAGS"
      $DUNECONTROL --only=dorie make dorie_mass_conservation
126 127 128


# --- Tests ---
129
test:exec_cmds: &test
Lukas Riedel's avatar
Lukas Riedel committed
130 131 132 133
  stage: test
  dependencies:
    - build:main
  script:
Lukas Riedel's avatar
Lukas Riedel committed
134 135
    - $DUNECONTROL --only=dorie configure
    - $DUNECONTROL --only=dorie make test_dorie_exec
Lukas Riedel's avatar
Lukas Riedel committed
136 137 138 139
  artifacts:
    name: "$CI_JOB_NAME"
    paths:
      - $CI_PROJECT_DIR/build-cmake/Testing
140
    expire_in: 1 day
Lukas Riedel's avatar
Lukas Riedel committed
141 142

test:ode:
143
  <<: *test
144
  script:
145
    - $DUNECONTROL --only=dorie configure
Lukas Riedel's avatar
Lukas Riedel committed
146
    - $DUNECONTROL --only=dorie make test_run_ode
147

148
test:parallel:
149
  <<: *test
150
  script:
151
    - $DUNECONTROL --only=dorie configure
152 153 154
    - $DUNECONTROL --only=dorie make test_run_parallel

test:reference:
155
  <<: *test
156 157 158
  script:
    - $DUNECONTROL --only=dorie configure
    - $DUNECONTROL --only=dorie make test_run_ref
159 160

test:mass_conserve:
161
  <<: *test
162 163 164
  script:
    - $DUNECONTROL --only=dorie configure
    - $DUNECONTROL --only=dorie make test_mass_conservation
165

166 167

# --- Deploy jobs ---
168
deploy:dockerhub-devel: &deploy
Lukas Riedel's avatar
Lukas Riedel committed
169
  stage: deploy
170
  only:
171
    - master@dorie/dorie
172 173 174 175 176 177 178
  tags:
    - dind
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_DRIVER: overlay2
179
  before_script:
180
    - $DOCKER_LOGIN
181
  script:
182
    - docker build -f docker/dorie.dockerfile
183
      --build-arg DUNE_ENV_IMAGE=$DUNE_ENV_IMAGE --build-arg PROCNUM=$CPUS_DIND
184
      -t dorie/dorie:devel .
185
    - docker push dorie/dorie:devel
186 187

deploy:dockerhub-stable:
188
  <<: *deploy
189
  only:
190
    - tags@dorie/dorie
191
  script:
192
    - docker build -f docker/dorie.dockerfile
193
      --build-arg DUNE_ENV_IMAGE=$DUNE_ENV_IMAGE --build-arg PROCNUM=$CPUS_DIND
194
      -t dorie/dorie:$CI_COMMIT_TAG .
195
    - docker push dorie/dorie:$CI_COMMIT_TAG