.gitlab-ci.yml 4.25 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
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 31
  only:
    - web # activate through 'Run pipeline' only.
32 33 34 35 36 37 38
  tags:
    - dind
  image: docker:stable
  services:
    - docker:dind
  variables:
    DOCKER_DRIVER: overlay2
39
  before_script:
40
    - $DOCKER_LOGIN
41
  script:
42
    - docker build -f docker/dune-env.dockerfile
43
      --build-arg PROCNUM=$CPUS_DIND
44
      -t $DUNE_ENV_IMAGE .
45
    - docker push $DUNE_ENV_IMAGE
46 47 48 49 50 51

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

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

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


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

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

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


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

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

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

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

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

160 161

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

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