# # 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: - schedules - f-package-docs 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