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

[data/gitlab-ci] Apply DRY on build templates

parent af819a29
Pipeline #33066 passed with stages
in 28 minutes and 11 seconds
......@@ -15,81 +15,67 @@ stages:
- deploy
# Build targets
.build_template: &build_job
stage: build
script:
- yum -y install dejavu-sans-fonts
# All stages are prepared the same, with a base set of commands
.bootstrap:
before_script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci docs -vv packages.txt
- bdt ci clean -vv
cache: &build_caches
cache:
paths:
- miniconda.sh
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
.build_linux_template: &linux_build_job
<<: *build_job
tags:
- docker
image: continuumio/conda-concourse-ci
artifacts:
expire_in: 1 week
paths:
- ${CONDA_ROOT}/conda-bld/linux-64/*.tar.bz2
cache:
<<: *build_caches
key: "linux-cache"
build_linux_37:
<<: *linux_build_job
# Build target
build:
extends: .bootstrap
stage: build
variables:
GITLAB_CHECKOUT_STRATEGY: "https://gitlab-ci-token:${CI_BUILD_TOKEN}@gitlab.idiap.ch/"
PYTHON_VERSION: "3.7"
BUILD_EGG: "true"
script:
- yum -y install dejavu-sans-fonts
- bdt ci docs -vv packages.txt
- bdt ci clean -vv
artifacts:
expire_in: 1 week
paths:
- sphinx
- ${CONDA_ROOT}/conda-bld/linux-64/*.tar.bz2
tags:
- docker
image: continuumio/conda-concourse-ci
cache:
key: "build"
# Deploy targets
.deploy_template: &deploy_job
# Deploy target
.deploy:
extends: .bootstrap
stage: deploy
script:
- 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_37
- build
tags:
- docker
cache: &build_caches
paths:
- miniconda.sh
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
image: continuumio/conda-concourse-ci
cache:
key: "deploy"
deploy_beta:
<<: *deploy_job
extends: .deploy
environment: beta
only:
- master
deploy_stable:
<<: *deploy_job
extends: .deploy
environment: stable
only:
- /^v\d+\.\d+\.\d+([abc]\d*)?$/ # PEP-440 compliant version (tags)
......
......@@ -14,32 +14,39 @@ stages:
- cleanup
# Build targets
.build_template:
stage: build
variables:
CONDA_ROOT: "${CI_PROJECT_DIR}/miniconda"
PYTHONUNBUFFERED: 1
script:
# All stages are prepared the same, with a base set of commands
.bootstrap:
before_script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci nightlies -vv order.txt
- bdt ci clean -vv
cache:
key: "$CI_JOB_NAME"
paths:
- miniconda.sh
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
# Build targets
.build_template:
extends: .bootstrap
stage: build
variables:
CONDA_ROOT: "${CI_PROJECT_DIR}/miniconda"
PYTHONUNBUFFERED: 1
script:
- bdt ci nightlies -vv order.txt
- bdt ci clean -vv
build_linux_36:
extends: .build_template
variables:
PYTHON_VERSION: "3.6"
tags:
- docker
cache:
key: 'build-py36'
build_linux_37:
extends: .build_template
......@@ -47,6 +54,9 @@ build_linux_37:
PYTHON_VERSION: "3.7"
tags:
- docker
cache:
key: 'build-py37'
build_macosx_36:
extends: .build_template
......@@ -54,6 +64,8 @@ build_macosx_36:
PYTHON_VERSION: "3.6"
tags:
- macosx
cache:
key: 'build-py36'
build_macosx_37:
extends: .build_template
......@@ -61,33 +73,27 @@ build_macosx_37:
PYTHON_VERSION: "3.7"
tags:
- macosx
cache:
key: 'build-py37'
# Periodic cleanup of beta packages
.cleanup_template:
extends: .bootstrap
stage: cleanup
tags:
- docker
image: continuumio/conda-concourse-ci
script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci clean-betas -vv
cache:
key: "linux-cache"
paths:
- miniconda.sh
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
key: 'cleanup'
# The automatic clean-up takes place when the nightly successfuly runs
cleanup:
extends: .cleanup_template
manual_cleanup:
extends: .cleanup_template
when: manual
......
......@@ -16,18 +16,13 @@ stages:
- pypi
# Build targets
.build_template:
stage: build
script:
# All stages are prepared the same, with a base set of commands
.bootstrap:
before_script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci build -vv
- bdt ci clean -vv
artifacts:
expire_in: 1 week
cache:
paths:
- miniconda.sh
......@@ -35,6 +30,17 @@ stages:
- ${CONDA_ROOT}/pkgs/urls.txt
# Build targets
.build_template:
extends: .bootstrap
stage: build
script:
- bdt ci build -vv
- bdt ci clean -vv
artifacts:
expire_in: 1 week
.build_linux_template:
extends: .build_template
tags:
......@@ -43,8 +49,6 @@ stages:
artifacts:
paths:
- ${CONDA_ROOT}/conda-bld/linux-64/*.tar.bz2
cache:
key: "linux-cache"
.build_macosx_template:
......@@ -54,24 +58,28 @@ stages:
artifacts:
paths:
- ${CONDA_ROOT}/conda-bld/osx-64/*.tar.bz2
cache:
key: "macosx-cache"
build_macosx_36:
extends: .build_macosx_template
variables:
PYTHON_VERSION: "3.6"
cache:
key: "build-py36"
build_macosx_37:
extends: .build_macosx_template
variables:
PYTHON_VERSION: "3.7"
cache:
key: "build-py37"
build_linux_36:
extends: .build_linux_template
variables:
PYTHON_VERSION: "3.6"
cache:
key: "build-py36"
build_linux_37:
extends: .build_linux_template
......@@ -79,10 +87,6 @@ build_linux_37:
PYTHON_VERSION: "3.7"
BUILD_EGG: "true"
script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci build -vv
- bdt ci readme -vv dist/*.zip
- bdt ci clean -vv
......@@ -91,16 +95,15 @@ build_linux_37:
- dist/*.zip
- sphinx
- ${CONDA_ROOT}/conda-bld/linux-64/*.tar.bz2
cache:
key: "build-py37"
# Test targets (not normally used)
.test_template:
extends: .bootstrap
stage: test
script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci test -vv
- bdt ci clean -vv
cache:
......@@ -115,26 +118,19 @@ build_linux_37:
tags:
- docker
image: continuumio/conda-concourse-ci
cache:
key: "linux-cache"
.test_macosx_template:
extends: .test_template
tags:
- macosx
cache:
key: "macosx-cache"
# Deploy targets
.deploy_template:
extends: .bootstrap
stage: deploy
script:
- 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:
......@@ -149,6 +145,8 @@ build_linux_37:
- miniconda.sh
- ${CONDA_ROOT}/pkgs/*.tar.bz2
- ${CONDA_ROOT}/pkgs/urls.txt
cache:
key: "deploy"
deploy_beta:
......@@ -168,6 +166,7 @@ deploy_stable:
pypi:
extends: .bootstrap
stage: pypi
environment: pypi
only:
......@@ -175,10 +174,6 @@ pypi:
except:
- branches
script:
- curl --silent "${BOOTSTRAP}" --output "bootstrap.py"
- python3 bootstrap.py -vv channel base
- source ${CONDA_ROOT}/etc/profile.d/conda.sh
- conda activate base
- bdt ci pypi -vv dist/*.zip
- bdt ci clean -vv
dependencies:
......@@ -188,3 +183,5 @@ pypi:
- build_macosx_37
tags:
- docker
cache:
key: "pypi"
Markdown is supported
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