Newer
Older
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
151
152
153
154
155
156
157
158
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2021 Indiscale GmbH <info@indiscale.com>
# Copyright (C) 2021 Daniel Hornung <d.hornung@indiscale.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
variables:
OCTAVE_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/testenv:$CI_COMMIT_REF_NAME
# CPPINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/111/trigger/pipeline
# CPPINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/111/repository/branches
# GIT_SUBMODULE_STRATEGY: normal
# ## FOR DEBUGGING
# TRIGGERED_BY_REPO: CPPLIB
# TRIGGERED_BY_REF: $CI_COMMIT_REF_NAME
# TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA
image: $OCTAVE_REGISTRY_IMAGE
stages:
- setup
- test
- deploy
######## Setup ########
# Build a docker image in which tests for this repository can run
build-testenv:
tags: [ cached-dind ]
stage: setup
image: docker:20.10
only:
- main
- schedules
- f-pipeline
script:
- cd .docker
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# Attempt to reuse the previously stored image.
- docker pull "$OCTAVE_REGISTRY_IMAGE" || true
- docker build
--pull
--cache-from "$OCTAVE_REGISTRY_IMAGE"
-t "$OCTAVE_REGISTRY_IMAGE" .
- docker push "$OCTAVE_REGISTRY_IMAGE"
# info:
# tags: [cached-dind]
# image: docker:20.10
# stage: info
# needs: []
# script:
# - echo "Pipeline triggered by $TRIGGERED_BY_REPO@$TRIGGERED_BY_REF ($TRIGGERED_BY_HASH)"
# - echo "$CPPLIB_REGISTRY_IMAGE"
# - echo "$CPPINTTEST_PIPELINE"
# - echo "$CPPINTTEST_BRANCHES"
# - echo "$GIT_SUBMODULE_STRATEGY"
# Build a docker image in which tests for this repository can run
# build-testenv:
# tags: [ cached-dind ]
# image: docker:20.10
# stage: setup
# script:
# - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
# # use here general latest or specific branch latest...
# - docker pull $CPPLIB_REGISTRY_IMAGE|| true
# - docker build
# --file .docker/Dockerfile
# --pull
# --cache-from $CPPLIB_REGISTRY_IMAGE
# --tag $CPPLIB_REGISTRY_IMAGE .
# - docker push $CPPLIB_REGISTRY_IMAGE
# Formatting with miss_hit
code_style:
tags: [ docker ]
stage: test
script:
- make style
allow_failure: true
# Unit tests
test:
tags: [ docker ]
stage: test
script:
- make test
# trigger the integration tests
# trigger_inttest:
# tags: [ docker ]
# stage: deploy
# script:
# ## Determine the cppinttest branch...
# # ... use an f-branch if posible...
# - if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
# CPPINT_REF=$CI_COMMIT_REF_NAME ;
# fi;
# # ... or use main if possible...
# - if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
# CPPINT_REF=main ;
# fi
# # ... and fall-back to dev
# - CPPINT_REF=${CPPINT_REF:-dev}
# - echo "Triggering caosdb-cppinttest@${CPPINT_REF}"
# - curl -w "%{stderr}HTTPCODE=%{http_code}" -X POST
# -F token=$CI_JOB_TOKEN
# -F "variables[TRIGGERED_BY_REPO]=$TRIGGERED_BY_REPO"
# -F "variables[TRIGGERED_BY_REF]=$TRIGGERED_BY_REF"
# -F "variables[TRIGGERED_BY_HASH]=$TRIGGERED_BY_HASH"
# -F "variables[CPPLIB_REGISTRY_IMAGE]=$CPPLIB_REGISTRY_IMAGE"
# -F ref=${CPPINT_REF} $CPPINTTEST_PIPELINE 2>HTTPCODE
# # fail if the request failed
# - grep -c "HTTPCODE=2" HTTPCODE
# Build the sphinx documentation and make it ready for deployment by Gitlab Pages
# Special job for serving a static website. See https://docs.gitlab.com/ee/ci/yaml/README.html#pages
# .pages_prepare: &pages_prepare
# tags: [ cached-dind ]
# stage: deploy
# script:
# - mkdir -p build
# - cd build
# - cmake ..
# - cmake --build . --target doc-sphinx
# - cp -r doc/sphinx_out ../public
# test_pages:
# <<: *pages_prepare
# pages:
# <<: *pages_prepare
# only:
# refs:
# - main
# artifacts:
# paths:
# - public