diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 3485ee074caca5b8fbd4b44562f48804a249baad..8b47e7657c10d2a5d76acf12be3ba73312281a82 100644 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,7 +1,14 @@ 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 diff --git a/.docker/install_cpplib.sh b/.docker/install_cpplib.sh index 0549c77775c19d2fc40bef99b9a059394c20f186..484938f13fde57c48d22cca03eec8af7641d73d9 100755 --- a/.docker/install_cpplib.sh +++ b/.docker/install_cpplib.sh @@ -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 diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0ad54f350f1cee05f108db19cb3685a544423926..6aadde8a1aa4fb0a7c1988aca5d95e7bfeebdcf8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -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 diff --git a/docs/src/index.md b/docs/src/index.md index 2575ee8a627c0854b713aa6b68fd5619bcfe4d1a..2683905a8f4c1cae89d875e57db30cde0afcbd3a 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -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) ```