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

MAINT: add env setup to pipeline

parent 9f452450
No related branches found
No related tags found
2 merge requests!89ENH: JsonSchemaExporter accepts do_not_create parameter.,!80F simple schema export
Pipeline #42303 canceled
......@@ -33,6 +33,107 @@ stages:
- integrationtest
- deploy
.env: &env
- PYLIB=${TMP_PYLIB:-$PYLIB}
- PYINT=${TMP_PYINT:-$PYINT}
- CPPINT=${TMP_CPPINT:-$CPPINT}
- CPPLIB=${TMP_CPPLIB:-$CPPLIB}
- SERVER=${TMP_SERVER:-$SERVER}
- WEBUI=${TMP_WEBUI:-$WEBUI}
- MYSQLBACKEND=${TMP_MYSQLBACKEND:-$MYSQLBACKEND}
- echo "F_BRANCH = $F_BRANCH"
- echo "SERVER = $SERVER"
- echo "MYSQLBACKEND = $MYSQLBACKEND"
- echo "CPPINT = $CPPINT"
- echo "CPPLIB = $CPPLIB"
- echo "PYINT = $PYINT"
- echo "PYLIB = $PYLIB"
- echo "ADVANCEDUSERTOOLS = $ADVANCEDUSERTOOLS"
setup-env:
stage: setup
tags: [ cached-dind ]
needs: [ ]
image: python:3
script:
# Calculate the values first.
- *env
- pip install requests
- if [ "${CI_COMMIT_REF_NAME:0:8}" == release- ] ; then
echo "Release branch detected, setting default F_BRANCH to 'main'.";
F_BRANCH="${F_BRANCH:-main}";
fi
- F_BRANCH=${F_BRANCH:-$CI_COMMIT_REF_NAME}
- if [ "$F_BRANCH" == "main" ] && [ "$CI_COMMIT_REF_NAME" != "main" ] ; then
DEFAULT_BRANCH=main
F_BRANCH=;
REFTAG="${CI_COMMIT_REF_NAME}_F_main";
elif [ "$F_BRANCH" != "$CI_COMMIT_REF_NAME" ] && echo "$F_BRANCH" | grep -c "^f-" ; then
REFTAG="${CI_COMMIT_REF_NAME}_F_${F_BRANCH}";
elif echo "$CI_COMMIT_REF_NAME" | grep -c "^f-" ; then
F_BRANCH="${CI_COMMIT_REF_NAME}";
REFTAG="${CI_COMMIT_REF_NAME}";
else
F_BRANCH=;
REFTAG="${CI_COMMIT_REF_NAME}";
fi
- if [ "${CI_COMMIT_REF_NAME}" == "main" ]; then
DEFAULT_BRANCH=main;
fi
- DEFAULT_BRANCH=${DEFAULT_BRANCH:-dev}
# if this is main, default to other main branches.
- echo "DEFAULT_BRANCH = $DEFAULT_BRANCH"
- echo "CI_COMMIT_REF_NAME = $CI_COMMIT_REF_NAME"
- echo "REFTAG = $REFTAG"
- echo "F_BRANCH = $F_BRANCH"
# determine branch for caosdb-pylib (specific branch, f-branch or dev)
- echo "PYLIB REF = $PYLIB"
- if [ "$PYLIB" == "" ] && [ "$F_BRANCH" != "" ] && ./utils/branch_exists.py PYLIB "$F_BRANCH" ; then
PYLIB="$F_BRANCH";
fi
- PYLIB=${PYLIB:-$DEFAULT_BRANCH}
- if [ "$PYLIB" != "$DEFAULT_BRANCH" ] && [ "$PYLIB" != "$F_BRANCH" ] ; then
REFTAG="${REFTAG}_P_${PYLIB}";
fi
- echo "PYLIB REF = $PYLIB"
# convert branch to commit
- PYLIB=`./utils/ref_to_commit.py PYLIB $PYLIB`;
- echo "PYLIB COMMIT = $PYLIB"
# determine branch for caosdb-pyinttest (specific branch, f-branch or dev)
- echo "PYINT REF = $PYINT"
- if [ "$PYINT" == "" ] && [ "$F_BRANCH" != "" ] && ./utils/branch_exists.py PYINT "$F_BRANCH" ; then
PYINT="$F_BRANCH";
fi
- PYINT=${PYINT:-$DEFAULT_BRANCH}
- if [ "$PYINT" != "$DEFAULT_BRANCH" ] && [ "$PYINT" != "$F_BRANCH" ] ; then
REFTAG="${REFTAG}_IP_${PYINT}";
fi
- echo "PYINT REF = $PYINT"
- echo "REFTAG = $REFTAG"
########################################
# Exporting values to environment file
####
- echo "DEFAULT_BRANCH=${DEFAULT_BRANCH}" >> "$DOTENV"
- echo "F_BRANCH=${F_BRANCH}" >> "$DOTENV"
- echo "REFTAG=${REFTAG}" >> "$DOTENV"
- echo "PYLIB=${PYLIB}" >> "$DOTENV"
- echo "TMP_PYLIB=${PYLIB}" >> "$DOTENV"
- echo "PYINT=${PYINT}" >> "$DOTENV"
- echo "TMP_PYINT=${PYINT}" >> "$DOTENV"
- cat "$DOTENV"
artifacts:
reports:
dotenv: "$DOTENV"
test:
tags: [docker]
services:
......@@ -127,8 +228,9 @@ unittest_py39:
tags: [docker]
stage: unittest
image: $CI_REGISTRY_IMAGE
needs: [build-testenv]
needs: [build-testenv, setup-env]
script:
- *env
# First verify that system Python actually is 3.9
- python3 -c "import sys; assert sys.version.startswith('3.9')"
- python3 -c "import linkahead; print('LinkAhead Version:', linkahead.__version__)"
......@@ -140,7 +242,7 @@ unittest_py37:
image: python:3.7
script: &python_test_script
- pip install nose pandas pytest pytest-cov gitignore-parser openpyxl>=3.0.7 xlrd==1.2 h5py
- pip install git+https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git@dev
- pip install git+https://gitlab.indiscale.com/caosdb/src/caosdb-pylib.git@$PYLIB
- pip install .
- pytest --cov=caosadvancedtools unittests
......
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