From 82c6ce0a52cec9c383c631d7297445c2704ecd39 Mon Sep 17 00:00:00 2001 From: Andre Anjos <andre.dos.anjos@gmail.com> Date: Sat, 24 Sep 2016 07:42:36 +0200 Subject: [PATCH] Move script update to outside before_*.sh scripts; Clean-up CI templates --- gitlab/after_build.sh | 1 - gitlab/before_deploy.sh | 3 -- gitlab/before_docs.sh | 5 ++- gitlab/before_test.sh | 3 -- gitlab/before_wheels.sh | 5 ++- templates/ci-for-cxx-extensions.yml | 49 ++++++++++++++++------------- templates/ci-for-python-only.yml | 49 ++++++++++++++++------------- 7 files changed, 58 insertions(+), 57 deletions(-) diff --git a/gitlab/after_build.sh b/gitlab/after_build.sh index 972ef31..4bc1579 100755 --- a/gitlab/after_build.sh +++ b/gitlab/after_build.sh @@ -3,5 +3,4 @@ source $(dirname ${0})/functions.sh -run_cmd rm -rf ${CI_PROJECT_DIR}/install.sh run_cmd rm -rf ${PREFIX} diff --git a/gitlab/before_deploy.sh b/gitlab/before_deploy.sh index 5ca7626..1fd16d3 100755 --- a/gitlab/before_deploy.sh +++ b/gitlab/before_deploy.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash # Wed 21 Sep 2016 13:08:05 CEST -# Refreshes build scripts if necessary -$(dirname ${0})/install.sh $(dirname ${0}) - source $(dirname ${0})/functions.sh run_cmd rm -f ${HOME}/.pypirc diff --git a/gitlab/before_docs.sh b/gitlab/before_docs.sh index 2871d3e..8bed7e3 100755 --- a/gitlab/before_docs.sh +++ b/gitlab/before_docs.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash # Thu 22 Sep 2016 18:23:57 CEST -# Refreshes build scripts if necessary -$(dirname ${0})/install.sh $(dirname ${0}) - source $(dirname ${0})/functions.sh + +log_info "Not implemented" diff --git a/gitlab/before_test.sh b/gitlab/before_test.sh index 6181d97..3709c10 100755 --- a/gitlab/before_test.sh +++ b/gitlab/before_test.sh @@ -1,9 +1,6 @@ #!/usr/bin/env bash # Wed 21 Sep 2016 13:08:05 CEST -# Refreshes build scripts if necessary -$(dirname ${0})/install.sh $(dirname ${0}) - source $(dirname ${0})/functions.sh run_cmd $(dirname ${0})/before_build.sh diff --git a/gitlab/before_wheels.sh b/gitlab/before_wheels.sh index 2871d3e..8bed7e3 100755 --- a/gitlab/before_wheels.sh +++ b/gitlab/before_wheels.sh @@ -1,7 +1,6 @@ #!/usr/bin/env bash # Thu 22 Sep 2016 18:23:57 CEST -# Refreshes build scripts if necessary -$(dirname ${0})/install.sh $(dirname ${0}) - source $(dirname ${0})/functions.sh + +log_info "Not implemented" diff --git a/templates/ci-for-cxx-extensions.yml b/templates/ci-for-cxx-extensions.yml index 6d9778f..d37e083 100644 --- a/templates/ci-for-cxx-extensions.yml +++ b/templates/ci-for-cxx-extensions.yml @@ -1,13 +1,8 @@ -# This build file is defined in two parts: 1) a generic set of instructions you -# probably **don't** need to change and 2) a part you may have to tune to your -# project. It heavily uses template features from YAML to help you in only -# changing a minimal part of it and avoid code duplication to a maximum while -# still providing a nice pipeline display on your package. +# This build file heavily 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. -# 1) Generic instructions (only change if you know what you're doing) -# ------------------------------------------------------------------- - # Definition of our build pipeline stages: - build @@ -17,33 +12,39 @@ stages: - deploy +# --------- +# Templates +# --------- + # Template for the build stage # Needs to run on all supported architectures, platforms and python versions .build_template: &build_job stage: build before_script: - git clean -ffdx - - curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > install.sh - - chmod 755 ./install.sh - - ./install.sh _ci + - 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 #updates - ./_ci/before_build.sh script: - ./_ci/build.sh after_script: - ./_ci/after_build.sh artifacts: - expire_in: 1 day + expire_in: 1 week paths: - _ci/ - dist/ - sphinx/ -# Template for the test stage - re-install from uploaded wheels +# Template for the test stage - re-installs from uploaded wheels # Needs to run on all supported architectures, platforms and python versions .test_template: &test_job stage: test before_script: + - ./_ci/install.sh #updates - ./_ci/before_test.sh script: - ./_ci/test.sh @@ -52,9 +53,7 @@ stages: # Template for the wheel uploading stage -# Needs to run against one combination of python 2.x and 3.x if it is a python -# only package, otherwise, needs to run in both pythons to all supported -# architectures (Linux and Mac OSX 64-bit) +# Needs to run against all combinations of python and operating systems .wheels_template: &wheels_job stage: wheels environment: intranet @@ -62,6 +61,7 @@ stages: - master - /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags) before_script: + - ./_ci/install.sh #updates - ./_ci/before_wheels.sh script: - ./_ci/wheels.sh @@ -77,6 +77,7 @@ stages: only: - master before_script: + - ./_ci/install.sh #updates - ./_ci/before_docs.sh script: - ./_ci/docs.sh @@ -84,8 +85,10 @@ stages: - ./_ci/after_docs.sh -# Template for the pypi stage - re-install from uploaded wheels -# Needs to run on a single architecture +# Template for the deployment stage - re-installs from uploaded wheels +# Needs to run on a single architecture only +# Will deploy your package to PyPI and other required services +# Only runs for tags .deploy_template: &deploy_job stage: deploy environment: internet @@ -94,6 +97,7 @@ stages: except: - branches before_script: + - ./_ci/install.sh #updates - ./_ci/before_deploy.sh script: - ./_ci/deploy.sh @@ -101,10 +105,11 @@ stages: - ./_ci/after_deploy.sh -# 2) Package specific instructions (you may tune this if needed) -# -------------------------------------------------------------- +# ------------- +# Build Targets +# ------------- -# Linux + Python 2.7: Builds, tests, uploads wheel +# Linux + Python 2.7: Builds, tests, uploads wheel and deploys (if needed) build_linux_27: <<: *build_job variables: &linux_27_build_variables @@ -162,7 +167,7 @@ wheels_linux_34: - conda-linux -# Linux + Python 3.5: Builds, tests, uploads wheel and deploys +# Linux + Python 3.5: Builds, tests and uploads wheel build_linux_35: <<: *build_job variables: &linux_35_build_variables diff --git a/templates/ci-for-python-only.yml b/templates/ci-for-python-only.yml index 0dbde6c..47da9ed 100644 --- a/templates/ci-for-python-only.yml +++ b/templates/ci-for-python-only.yml @@ -1,13 +1,8 @@ -# This build file is defined in two parts: 1) a generic set of instructions you -# probably **don't** need to change and 2) a part you may have to tune to your -# project. It heavily uses template features from YAML to help you in only -# changing a minimal part of it and avoid code duplication to a maximum while -# still providing a nice pipeline display on your package. +# This build file heavily 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. -# 1) Generic instructions (only change if you know what you're doing) -# ------------------------------------------------------------------- - # Definition of our build pipeline stages: - build @@ -17,33 +12,39 @@ stages: - deploy +# --------- +# Templates +# --------- + # Template for the build stage # Needs to run on all supported architectures, platforms and python versions .build_template: &build_job stage: build before_script: - git clean -ffdx - - curl --silent "https://gitlab.idiap.ch/bob/bob.admin/raw/master/gitlab/install.sh" > install.sh - - chmod 755 ./install.sh - - ./install.sh _ci + - 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 #updates - ./_ci/before_build.sh script: - ./_ci/build.sh after_script: - ./_ci/after_build.sh artifacts: - expire_in: 1 day + expire_in: 1 week paths: - _ci/ - dist/ - sphinx/ -# Template for the test stage - re-install from uploaded wheels +# Template for the test stage - re-installs from uploaded wheels # Needs to run on all supported architectures, platforms and python versions .test_template: &test_job stage: test before_script: + - ./_ci/install.sh #updates - ./_ci/before_test.sh script: - ./_ci/test.sh @@ -52,9 +53,7 @@ stages: # Template for the wheel uploading stage -# Needs to run against one combination of python 2.x and 3.x if it is a python -# only package, otherwise, needs to run in both pythons to all supported -# architectures (Linux and Mac OSX 64-bit) +# Needs to run against one supported architecture, platform and python version .wheels_template: &wheels_job stage: wheels environment: intranet @@ -62,6 +61,7 @@ stages: - master - /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags) before_script: + - ./_ci/install.sh #updates - ./_ci/before_wheels.sh script: - ./_ci/wheels.sh @@ -77,6 +77,7 @@ stages: only: - master before_script: + - ./_ci/install.sh #updates - ./_ci/before_docs.sh script: - ./_ci/docs.sh @@ -84,8 +85,10 @@ stages: - ./_ci/after_docs.sh -# Template for the pypi stage - re-install from uploaded wheels -# Needs to run on a single architecture +# Template for the deployment stage - re-installs from uploaded wheels +# Needs to run on a single architecture only +# Will deploy your package to PyPI and other required services +# Only runs for tags .deploy_template: &deploy_job stage: deploy environment: internet @@ -94,6 +97,7 @@ stages: except: - branches before_script: + - ./_ci/install.sh #updates - ./_ci/before_deploy.sh script: - ./_ci/deploy.sh @@ -101,10 +105,11 @@ stages: - ./_ci/after_deploy.sh -# 2) Package specific instructions (you may tune this if needed) -# -------------------------------------------------------------- +# ------------- +# Build Targets +# ------------- -# Linux + Python 2.7: Builds, tests, uploads wheel +# Linux + Python 2.7: Builds, tests, uploads wheel and deploys (if needed) build_linux_27: <<: *build_job variables: &linux_27_build_variables @@ -156,7 +161,7 @@ test_linux_34: - conda-linux -# Linux + Python 3.5: Builds, tests, uploads wheel and deploys +# Linux + Python 3.5: Builds, tests and uploads wheel build_linux_35: <<: *build_job variables: &linux_35_build_variables -- GitLab