Commit c484458e authored by André Anjos's avatar André Anjos 💬
Browse files

[ci] Updated CI to remove the use of isolated sh scripts

parent 0b59b0a7
Pipeline #27333 failed with stage
in 13 minutes and 31 seconds
# This build file uses template features from YAML so it is generic enough for
# any Bob project. Don't modify it unless you know what you're doing.
# Definition of global variables (all stages)
variables:
CONDA_ROOT: "${CI_PROJECT_DIR}/miniconda"
DOCKER_REGISTRY: docker.idiap.ch
TEST_PREFIX_PATH_FILE: 'test_prefix_$CI_JOB_ID.txt'
BOOTSTRAP: "https://gitlab.idiap.ch/bob/bob.devtools/raw/master/bob/devtools/bootstrap.py"
# Definition of our build pipeline order
# This build does not deploy to PyPI
stages:
- build
- deploy
# Build targets
.build_template: &build_job
build_linux_36:
stage: build
before_script:
- mkdir _ci
- curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > _ci/install.sh
- chmod 755 _ci/install.sh
- ./_ci/install.sh _ci master #installs ci support scripts
- ./_ci/before_build.sh
- docker info
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN docker.idiap.ch
variables:
PYTHON_VERSION: "3.6"
TEST_PREFIX_PATH_FILE: 'test_prefix_$CI_JOB_ID.txt'
tags:
- docker-build
script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- export BEAT_TEST_PREFIX=`mktemp -d --tmpdir=/var/tmp beat_test_prefix.XXXXXXXXX`
- echo $BEAT_TEST_PREFIX > $TEST_PREFIX_PATH_FILE
- ./scripts/before_build.sh
script:
- ./scripts/build.sh
after_script:
- ./scripts/after_build.sh
- ./_ci/after_build.sh
- conda env create -f dev.yml
- conda activate beat-web
- buildout
- export COVERAGE_FILE=.coverage.django
- ./bin/coverage run --source=${CI_PROJECT_NAME} ./bin/django test --settings=beat.web.settings.ci -v 2
- export BEAT_CMDLINE_TEST_PLATFORM=django://beat.web.settings.ci
- export COVERAGE_FILE=.coverage.cmdline
- export NOSE_WITH_COVERAGE=1
- export NOSE_COVER_PACKAGE=beat.web
- ./bin/coverage run --source=beat.cmdline ./bin/nosetests -sv beat.cmdline
- unset COVERAGE_FILE
- ./bin/coverage combine .coverage.django .coverage.cmdline
- ./bin/coverage report
- ./bin/sphinx-apidoc --separate -d 2 --output=doc/api ${CI_PROJECT_NAMESPACE} beat/web/*/migrations beat/web/*/tests
- ./bin/sphinx-build doc/api sphinx/api
- ./bin/sphinx-build doc/admin sphinx/admin
- ./bin/sphinx-build doc/user sphinx/user
- conda deactivate beat-web
- export BEAT_TEST_PREFIX=`cat $TEST_PREFIX_PATH_FILE`
- rm -rf ${BEAT_TEST_PREFIX} ${TEST_PREFIX_PATH_FILE}
- conda activate base
- bdt ci clean -vv
artifacts:
expire_in: 1 week
paths:
- sphinx
cache: &build_caches
key: "linux-cache"
paths:
- miniconda.sh
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
.build_linux_template: &linux_build_job
<<: *build_job
tags:
- docker-build
cache:
<<: *build_caches
key: "linux-cache"
build_linux_36:
<<: *linux_build_job
variables:
PYTHON_VERSION: "3.6"
artifacts:
expire_in: 1 week
paths:
- _ci/
- dist/*.zip
- sphinx
# Deploy targets
.deploy_template: &deploy_job
stage: deploy
before_script:
- ./_ci/install.sh _ci master #updates ci support scripts
script:
- ./_ci/deploy.sh
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci deploy -vv
- bdt ci clean -vv
dependencies:
- build_linux_36
cache:
<<: *build_caches
tags:
- deployer
- docker
deploy_beta:
......
#!/usr/bin/env bash
source _ci/functions.sh
BEAT_TEST_PREFIX=`cat $TEST_PREFIX_PATH_FILE`
export_env BEAT_TEST_PREFIX
log_info "Deleting BEAT test prefix $BEAT_TEST_PREFIX"
run_cmd rm -rf ${BEAT_TEST_PREFIX} ${TEST_PREFIX_PATH_FILE}
#!/usr/bin/env bash
source _ci/functions.sh
# Makes sure we activate the base environment if available
run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh
run_cmd conda activate base
export_env PATH
# installs the base conda environment
run_cmd conda env create -f dev.yml
conda activate beat-web
# runs buildout
run_cmd buildout
# pull docker images
thisdir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
run_cmd ${thisdir}/docker_pull.sh master
#!/usr/bin/env bash
source _ci/functions.sh
# Makes sure we activate the base environment if available
run_cmd source ${CONDA_ROOT}/etc/profile.d/conda.sh
run_cmd conda activate beat-web
export_env PATH
COVERAGE_FILE=.coverage.django
export_env COVERAGE_FILE
run_cmd ./bin/coverage run --source=${CI_PROJECT_NAME} ./bin/django test --settings=beat.web.settings.ci -v 2
BEAT_CMDLINE_TEST_PLATFORM=django://beat.web.settings.ci
COVERAGE_FILE=.coverage.cmdline
NOSE_WITH_COVERAGE=1
NOSE_COVER_PACKAGE=beat.web
export_env BEAT_CMDLINE_TEST_PLATFORM
export_env COVERAGE_FILE
export_env NOSE_WITH_COVERAGE
export_env NOSE_COVER_PACKAGE
run_cmd ./bin/coverage run --source=beat.cmdline ./bin/nosetests -sv beat.cmdline
unset COVERAGE_FILE
run_cmd ./bin/coverage combine .coverage.django .coverage.cmdline
run_cmd ./bin/coverage report
run_cmd ./bin/sphinx-apidoc --separate -d 2 --output=doc/api ${CI_PROJECT_NAMESPACE} beat/web/*/migrations beat/web/*/tests
run_cmd ./bin/sphinx-build doc/api sphinx/api
run_cmd ./bin/sphinx-build doc/admin sphinx/admin
run_cmd ./bin/sphinx-build doc/user sphinx/user
# Builds a zip file that can be uploaded to PyPI
python setup.py sdist --formats=zip
#!/usr/bin/env bash
if [ $# == 0 ]; then
echo "usage: $0 <beat-core-branch>"
exit 1
fi
basedir=`pwd`
if [ ! -e ${basedir}/_ci/functions.sh ]; then
# this will happen when executing buildout for the first time
mkdir ${basedir}/_ci
curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > ${basedir}/_ci/install.sh
chmod 755 ${basedir}/_ci/install.sh
${basedir}/_ci/install.sh ${basedir}/_ci master #installs ci support scripts
else
${basedir}/_ci/install.sh ${basedir}/_ci master #updates ci support scripts
fi
if [ "${BUILDOUT}" == "true" ]; then
# when executing in the context of buildout, define dummies
export CI_PROJECT_URL=https://gitlab.idiap.ch/beat/beat.web
export CI_PROJECT_DIR=beat
export CI_PROJECT_PATH=beat/beat.web
export CI_PROJECT_NAME=beat.web
export CI_COMMIT_REF_NAME=master
export PYPIUSER=pypiuser
export PYPIPASS=pypipass
export DOCUSER=docuser
export DOCPASS=docpass
export CONDA_ROOT=${basedir}/miniconda
export DOCKER_REGISTRY=docker.idiap.ch
export DOCSERVER=https://www.idiap.ch/software/bob
fi
source ${basedir}/_ci/functions.sh
branch=$1
check_env branch
destdir="$(cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd)"
check_env destdir
run_cmd curl -o ${destdir}/_core_docker_pull.sh --silent "https://gitlab.idiap.ch/beat/beat.core/raw/${branch}/scripts/docker_pull.sh"
run_cmd chmod 755 ${destdir}/_core_docker_pull.sh
run_cmd ${destdir}/_core_docker_pull.sh
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment