Skip to content
Snippets Groups Projects
Commit c3440c72 authored by Henrik tom Wörden's avatar Henrik tom Wörden
Browse files

Merge branch 'f-int-tests' into 'dev'

TST: Add CI infrastructure for integration testing

See merge request !3
parents 96fca3b0 da47a89a
No related branches found
No related tags found
1 merge request!3TST: Add CI infrastructure for integration testing
Pipeline #10481 failed
FROM julia:1.6
RUN echo 'deb http://deb.debian.org/debian buster-backports main' > /etc/apt/sources.list.d/buster-backports.list
RUN apt-get update && apt-get install -y git python3-pip
RUN apt-get update
RUN apt-get install -y cmake/buster-backports
RUN apt-get install -y git
RUN apt-get install -y python3-pip
RUN apt-get install -y curl
# Dirty workaround for java not linking to the correct manpage directory (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199)
RUN mkdir -p /usr/share/man/man1
RUN apt-get install -y openjdk-11-jdk-headless
RUN pip3 install conan
......@@ -2,7 +2,13 @@
git clone https://gitlab.indiscale.com/caosdb/src/caosdb-cpplib.git
cd caosdb-cpplib
git checkout f-extern-c
# check if there is a crooesponding cpp branch. Use the default branch
# if there isn't.
if (git show-ref --verify --quiet refs/heads/$CI_COMMIT_REF_NAME) ; then
git checkout $CI_COMMIT_REF_NAME
else
git checkout $CPP_DEFAULT_BRANCH
fi
git submodule update --init --recursive
mkdir build
cd build
......
......@@ -16,14 +16,39 @@
variables:
JULIALIB_REGISTRY_IMAGE: $CI_REGISTRY/caosdb/src/caosdb-julialib/testenv:$CI_COMMIT_REF_NAME
JULIAINTTEST_PIPELINE: https://gitlab.indiscale.com/api/v4/projects/120/trigger/pipeline
JULIAINTTEST_BRANCHES: https://gitlab.indiscale.com/api/v4/projects/120/repository/branches
GIT_SUBMODULE_STRATEGY: normal
TRIGGERED_BY_REPO: JULIALIB
TRIGGERED_BY_REF: $CI_COMMIT_REF_NAME
TRIGGERED_BY_HASH: $CI_COMMIT_SHORT_SHA
# The defalt branch to use with caosdb-cpplib
CPP_DEFAULT_BRANCH: f-extern-c
image: $JULIALIB_REGISTRY_IMAGE
stages:
- info
- code-style
- setup
- test
- deploy
# Print debugging info
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 "$JULIALIB_REGISTRY_IMAGE"
- echo "$JULIAINTTEST_PIPELINE"
- echo "$JULIAINTTEST_BRANCHES"
- echo "$GIT_SUBMODULE_STRATEGY"
# Only check style for Julia 1.6 since support for 1.0 may be dropped anyway
code-style:
stage: code-style
......@@ -98,7 +123,11 @@ test:
# parsing` textfield.
# Example documentation deployment
pages:
# Prepare documentation for deployment but only deploy it when run on
# main branch
.pages_prepare: &pages_prepare
tags: [ docker ]
stage: deploy
script:
......@@ -106,11 +135,53 @@ pages:
- julia -e 'using Pkg; import CaosDB; Pkg.add("Documenter")' # install Documenter
- julia --color=yes docs/make.jl # make documentation
- mv docs/build public # move to the directory picked up by Gitlab pages
pages:
<<: *pages_prepare
artifacts:
paths:
- public
only:
- main
refs:
- main
test_pages:
<<: *pages_prepare
except:
refs:
- main
# trigger the integration tests
trigger_inttest:
tags: [ docker ]
stage: deploy
script:
## Determine the juliainttest branch...
# ... use an f-branch if posible...
- if echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
JULIAINT_REF=$CI_COMMIT_REF_NAME ;
fi;
# ... or use main if possible...
- if [[ "$CI_COMMIT_REF_NAME" == "main" ]] ; then
JULIAINT_REF=main ;
fi
# ... and fall-back to dev
- JULIAINT_REF=${JULIAINT_REF:-dev}
- F_BRANCH=$CI_COMMIT_REF_NAME
- echo "Triggering caosdb-juliainttest@${JULIAINT_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[JULIALIB_REGISTRY_IMAGE]=$JULIALIB_REGISTRY_IMAGE"
-F "variables[F_BRANCH]=${F_BRANCH}"
-F ref=${JULIAINT_REF} $JULIAINTTEST_PIPELINE 2>HTTPCODE
# fail if the request failed
- grep -c "HTTPCODE=2" HTTPCODE
# WARNING: This template is using the `julia` images from [Docker
# Hub][3]. One can use custom Julia images and/or the official ones
......
......@@ -6,7 +6,7 @@ library.
Manually add a docstring here:
```@docs
CaosDB.Utility.get_env_var(var, default)
CaosDB.Utility.get_env_var(::AbstractString, ::AbstractString)
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment