-
Notifications
You must be signed in to change notification settings - Fork 6
/
.gitlab-ci.yml
150 lines (136 loc) · 4.71 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# GitLab CI configuration file for building SCHISM-ESMF docker
# images based on ubuntu
#
# SPDX-FileCopyrightText: 2022 Helmholtz-Zentrum hereon
# SPDX-License-Identifier: CC0-1.0
# SPDX-FileContributor Carsten Lemmen <[email protected]
# Stages are here defined as categorical only, as the CI/CD makes
# use of directed acyclic graph technique with the needs job keyword
stages:
- lint
- build
- deploy
- test
variables:
DOCKER_HOST: tcp://docker:2376
DOCKER_TLS_CERTDIR: "/certs"
VERSION: v8.4.0
CONTAINER_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/schism-esmf:${VERSION}-${COMMUNICATOR}
#CONTAINER_REGISTRY_BASEIMAGE: registry.hzdr.de/mossco/esmf-docker/esmf:${VERSION}-${COMMUNICATOR}
CONTAINER_REGISTRY_BASEIMAGE: platipodium/esmf:${VERSION}-${COMMUNICATOR}
SCHISM_DIR: "/builds/schism/schism-esmf/devel/schism"
SCHISM_BUILD_DIR: "/builds/schism/schism-esmf/devel/schism/build"
SCHISM_ESMF_DIR: "/builds/schism/schism-esmf/devel/schism-esmf"
OLDIO: "ON"
TVD_LIM: "SB"
license-compliance:
image: python:3.11
stage: lint
needs: []
before_script:
- pip install --upgrade pip
- pip install poetry
- poetry install
script:
- poetry run reuse lint
allow_failure: true
build-schism:
image: ${CONTAINER_REGISTRY_BASEIMAGE}
stage: build
needs: []
parallel:
matrix:
- COMMUNICATOR: ["openmpi", "mpich"]
before_script:
- git clone --branch master --depth 1 https://github.com/schism-dev/schism ${SCHISM_DIR}
script:
- mkdir -p ${SCHISM_BUILD_DIR}
- cmake -S ${SCHISM_DIR}/src -B ${SCHISM_BUILD_DIR} -DOLDIO=${OLDIO} -DTVD_LIM=${TVD_LIM}
- make -C ${SCHISM_BUILD_DIR} -j8 pschism
- ls -1 ./devel/schism/build/lib/* || true
artifacts:
paths:
- ./devel/schism/build/include/
- ./devel/schism/build/lib/
- ./devel/schism/build/bin/pschis*
expire_in: 20 minutes
allow_failure: false
interruptible: true
build-schism-esmf:
image: ${CONTAINER_REGISTRY_BASEIMAGE}
stage: build
needs:
- build-schism
parallel:
matrix:
- COMMUNICATOR: ["openmpi", "mpich"]
- COMMUNICATOR: ["openmpi"]
before_script:
- git clone --branch master --depth 1 https://github.com/schism-dev/schism-esmf ${SCHISM_ESMF_DIR}
script:
- make -C ${SCHISM_ESMF_DIR} -j1 lib # parallel build fails
- make -C ${SCHISM_ESMF_DIR} -j1 install-esmf
- make -C ${SCHISM_ESMF_DIR} -j1 install-nuopc
- make -C ${SCHISM_ESMF_DIR} -j1 install
allow_failure: true
interruptible: true
build-docker:
image: docker:20.10.22
services:
- docker:20.10.22-dind
parallel:
matrix:
- COMMUNICATOR: ["openmpi", "mpich"]
allow_failure: true
interruptible: true
stage: deploy
needs: []
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker build -t ${CONTAINER_REGISTRY_IMAGE} --build-arg VERSION=${VERSION} --build-arg COMMUNICATOR=${COMMUNICATOR} .
- docker push ${CONTAINER_REGISTRY_IMAGE}
test-docker:
image: docker:20.10.22
services:
- docker:20.10.22-dind
parallel:
matrix:
- COMMUNICATOR: ["openmpi", "mpich"]
allow_failure: true
interruptible: true
stage: test
needs:
- build-docker
before_script:
- docker login -u $CI_REGISTRY_USER -p $CI_JOB_TOKEN $CI_REGISTRY
script:
- docker pull ${CONTAINER_REGISTRY_IMAGE}
- docker run ${CONTAINER_REGISTRY_IMAGE} /usr/local/bin/ESMF_PrintInfo
pages:
image: python:3.11
stage: deploy
needs: []
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PAGES_BRANCH: gl-pages
HTTPS_REMOTE: https://gitlab-ci-token:${ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git
before_script:
- pip install --upgrade pip
- pip install mkdocs-material mkdocs mike
- git config --local user.name $GITLAB_USER_NAME
- git config --local user.email $GITLAB_USER_EMAIL
- git fetch origin $PAGES_BRANCH && git checkout -b $PAGES_BRANCH origin/$PAGES_BRANCH || echo "Pages branch not deployed yet."
- git checkout $CI_COMMIT_SHA
script:
- mike deploy --rebase --prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH -u $CI_COMMIT_TAG latest
- mike set-default --rebase --prefix public -r $HTTPS_REMOTE -p -b $PAGES_BRANCH latest
- git checkout $PAGES_BRANCH -- public/
artifacts:
paths:
- public/
only:
paths:
- doc/*.md'
- mkdocs.yml
allow_failure: true