Skip to content
Snippets Groups Projects
.gitlab-ci.yml 2.13 KiB
Newer Older
Timm Fitschen's avatar
Timm Fitschen committed
#
# This file is a part of the CaosDB Project.
#
# Copyright (C) 2018 Research Group Biomedical Physics,
# Max-Planck-Institute for Dynamics and Self-Organization Göttingen
# Copyright (C) 2019 Henrik tom Wörden
# Copyright (C) 2021 Timm Fitschen <t.fitschen@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/>.

Timm Fitschen's avatar
Timm Fitschen committed
variables:
Timm Fitschen's avatar
Timm Fitschen committed
  CI_REGISTRY_IMAGE_CPPLIB: $CI_REGISTRY/caosdb/src/caosdb-cpplib/testenv:latest
  CI_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-cppinttest/testenv:latest
Timm Fitschen's avatar
Timm Fitschen committed
  TRIGGERED_BY_REPO: CPPINTTEST
Timm Fitschen's avatar
Timm Fitschen committed
  TRIGGERED_BY_REF: $CI_COMMIT_REF_NAME
  TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA
Timm Fitschen's avatar
Timm Fitschen committed
  CPPLIB_VERSION: 0.0.1
Timm Fitschen's avatar
Timm Fitschen committed

Timm Fitschen's avatar
Timm Fitschen committed
stages:
  - setup
Timm Fitschen's avatar
Timm Fitschen committed
  - test
Timm Fitschen's avatar
Timm Fitschen committed

Timm Fitschen's avatar
Timm Fitschen committed
# Build a docker image in which tests for this repository can run
Timm Fitschen's avatar
Timm Fitschen committed
build-testenv:
  tags: [cached-dind]
  image: docker:20.10.6
  stage: setup
  timeout: 2h
  needs: []
  script:
    - echo "Pipeline triggered by $TRIGGERED_BY_REPO@$TRIGGERED_BY_REF ($TRIGGERED_BY_HASH)"
Timm Fitschen's avatar
Timm Fitschen committed
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
Timm Fitschen's avatar
Timm Fitschen committed
    - docker pull $CI_REGISTRY_IMAGE_CPPLIB|| true
Timm Fitschen's avatar
Timm Fitschen committed
    - docker build
Timm Fitschen's avatar
Timm Fitschen committed
      --build-arg CI_REGISTRY_IMAGE=$CI_REGISTRY_IMAGE_CPPLIB
Timm Fitschen's avatar
Timm Fitschen committed
      --file .docker/Dockerfile
      --pull
      --cache-from $CI_REGISTRY_IMAGE
      --tag $CI_REGISTRY_IMAGE .
    - docker push $CI_REGISTRY_IMAGE


# run integration tests
test:
Timm Fitschen's avatar
Timm Fitschen committed
  image: $CI_REGISTRY_IMAGE
Timm Fitschen's avatar
Timm Fitschen committed
  dependencies:
    - build-testenv
Timm Fitschen's avatar
Timm Fitschen committed
  tags: [ docker ]
  stage: test
  script:
    - mkdir build
    - cd build
Timm Fitschen's avatar
Timm Fitschen committed
    - cmake -D CMAKE_PREFIX_PATH=/usr/local/lib/libcaosdb-${CPPLIB_VERSION} ..
Timm Fitschen's avatar
Timm Fitschen committed
    - cmake --build .
    - ctest