Newer
Older
#
# 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>
# Copyright (C) 2021 Timm Fitschen <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:
# this is the image where cpplib repo is present (artifact from pipeline in
# caosdb-cpplib)
CPPLIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv
OCTAVE_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/testenv:$CI_COMMIT_REF_NAME
OCTAVEINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/121/trigger/pipeline
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
script:
- DOCKER_BASE_IMAGE="${CPPLIB_REGISTRY_IMAGE}:${CPPLIB_BRANCH}"
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
- docker pull "$OCTAVE_REGISTRY_IMAGE" || true
- docker build
--pull
--cache-from "$OCTAVE_REGISTRY_IMAGE"
- docker push "$OCTAVE_REGISTRY_IMAGE"
# Formatting with miss_hit
tags: [ docker ]
stage: test
script:
code_style_cpp:
tags: [ docker ]
stage: test
script:
- clang-format-11 --dry-run --verbose --Werror $(find test/ src/ -type f -iname "*.cpp" -o -iname "*.h" -o -iname "*.h.in")
allow_failure: true
tags: [ docker ]
stage: test
script:
package_tests:
tags: [ docker ]
stage: test
script:
- octave -v
- make pkg-test
tags: [ docker ]
stage: test
script:
- mh_lint --octave ./
# linting with clang-tidy and include-what-you-use
linting_cpp:
tags: [ docker ]
stage: test
script:
- cd src
- ./configure
- cd ../build
- cmake -D LINTING=On ..
- cmake --build .
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
# trigger the integration tests
trigger_inttest:
tags: [ docker ]
stage: deploy
script:
## Determine the octaveinttest branch...
# ... use an f-branch if posible...
- if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
OCTAVEINT_REF=$CI_COMMIT_REF_NAME ;
fi;
# ... or use main if possible...
- if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
OCTAVEINT_REF=main ;
fi
# ... and fall-back to dev
- OCTAVEINT_REF=${OCTAVEINT_REF:-dev}
- F_BRANCH=$CI_COMMIT_REF_NAME
- echo "Triggering caosdb-octaveinttest@${OCTAVEINT_REF} (F_BRANCH=$F_BRANCH)"
- 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[OCTAVELIB_REGISTRY_IMAGE]=$OCTAVELIB_REGISTRY_IMAGE"
-F "variables[F_BRANCH]=${F_BRANCH}"
-F ref=${OCTAVEINT_REF} $OCTAVEINTTEST_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:
- make doc
- cp -r build/doc/html ./public
test_pages:
<<: *pages_prepare
except:
refs:
- main
artifacts:
paths:
- public
pages:
<<: *pages_prepare
only:
refs:
- main
artifacts:
paths:
- public