.gitlab-ci.yml 4.3 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
  CMAKE_FLAGS:
    -DDUNE_PYTHON_VIRTUALENV_SETUP=True
    -DDUNE_PYTHON_ALLOW_GET_PIP=True
13 14

image: $DUNE_ENV_IMAGE
Dion Haefner's avatar
Dion Haefner committed
15 16 17

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

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

26 27

# --- Preparation of Docker Images ---
28
setup:dune-env: &setup
29
  stage: setup
30
  only:
31 32
    variables:
      - $REBUILD_BASE_IMAGE # must be defined and have non-empty value
33 34 35 36 37 38 39
  tags:
    - dind
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_DRIVER: overlay2
40
  before_script:
41
    - $DOCKER_LOGIN
42
  script:
43
    - docker build -f docker/dune-env.dockerfile
44
      --build-arg PROCNUM=$CPUS_DIND
45
      -t $DUNE_ENV_IMAGE .
46
    - docker push $DUNE_ENV_IMAGE
47 48 49 50 51 52

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

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

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


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

96
build:debug: &debug
97
  stage: build
98
  allow_failure: true
99
  script:
Lukas Riedel's avatar
Lukas Riedel committed
100 101 102 103
    - CMAKE_FLAGS="
        $CMAKE_FLAGS
        -DCMAKE_BUILD_TYPE=Debug 
        -DCMAKE_CXX_FLAGS_DEBUG='-Werror'"
104
      $DUNECONTROL --only=dorie configure
105
    - $DUNECONTROL --only=dorie make dorie_mass_conservation
106

107 108 109
build:debug-clang:
  <<: *debug
  image: ${DUNE_ENV_IMAGE}-clang
110 111 112 113 114 115 116 117
  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
118
    - $DUNECONTROL --only=dorie make dorie_mass_conservation
119 120 121


# --- Tests ---
122
test:exec_cmds: &test
Lukas Riedel's avatar
Lukas Riedel committed
123 124 125 126
  stage: test
  dependencies:
    - build:main
  script:
Lukas Riedel's avatar
Lukas Riedel committed
127 128
    - $DUNECONTROL --only=dorie configure
    - $DUNECONTROL --only=dorie make test_dorie_exec
Lukas Riedel's avatar
Lukas Riedel committed
129 130 131 132
  artifacts:
    name: "$CI_JOB_NAME"
    paths:
      - $CI_PROJECT_DIR/build-cmake/Testing
133
    expire_in: 1 day
Lukas Riedel's avatar
Lukas Riedel committed
134 135

test:ode:
136
  <<: *test
137
  script:
138
    - $DUNECONTROL --only=dorie configure
Lukas Riedel's avatar
Lukas Riedel committed
139
    - $DUNECONTROL --only=dorie make test_run_ode
140

141
test:parallel:
142
  <<: *test
143 144
  tags:
    - multicore
145
  script:
146
    - $DUNECONTROL --only=dorie configure
147 148 149
    - $DUNECONTROL --only=dorie make test_run_parallel

test:reference:
150
  <<: *test
151 152 153
  script:
    - $DUNECONTROL --only=dorie configure
    - $DUNECONTROL --only=dorie make test_run_ref
154 155

test:mass_conserve:
156
  <<: *test
157 158 159
  script:
    - $DUNECONTROL --only=dorie configure
    - $DUNECONTROL --only=dorie make test_mass_conservation
160

161 162

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

deploy:dockerhub-stable:
184
  <<: *deploy
185
  only:
186
    - tags@dorie/dorie
187
  script:
188
    - docker build -f docker/dorie.dockerfile
189
      --build-arg DUNE_ENV_IMAGE=$DUNE_ENV_IMAGE --build-arg PROCNUM=$CPUS_DIND
190
      -t dorie/dorie:$CI_COMMIT_TAG .
191
    - docker push dorie/dorie:$CI_COMMIT_TAG