Skip to content
Snippets Groups Projects
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
.gitlab-ci.yml 4.68 KiB
#
# 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
  OCTAVELIB_REGISTRY_IMAGE: $CI_REGISTRY_IMAGE/testenv:$CI_COMMIT_REF_NAME
  CPPLIB_BRANCH: dev

  OCTAVEINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/121/repository/branches

  # For storing cross-job values
  DOTENV: custom.env


image: $OCTAVELIB_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:
    - if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
         CPPLIB_BRANCH=main ;
      fi
    - DOCKER_BASE_IMAGE="${CPPLIB_REGISTRY_IMAGE}:${CPPLIB_BRANCH}"
    - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
    - docker pull "$OCTAVELIB_REGISTRY_IMAGE" || true
    - docker build
      --build-arg DOCKER_BASE_IMAGE=$DOCKER_BASE_IMAGE
      --file .docker/Dockerfile
      --pull
      --cache-from "$OCTAVELIB_REGISTRY_IMAGE"
      --tag "$OCTAVELIB_REGISTRY_IMAGE" .
    - docker push "$OCTAVELIB_REGISTRY_IMAGE"


# Formatting with miss_hit
code_style_octave:
  tags: [ docker ]
  stage: test
  script:
    - mh_style -v