Skip to content
Snippets Groups Projects
Commit 1e95b86d authored by Paul McCarthy's avatar Paul McCarthy :mountain_bicyclist:
Browse files

CI for conda. Only building 3.6 because conda is a complete pain in the

arse. Tweaks to other CI scripts
parent 29e9d944
No related branches found
No related tags found
No related merge requests found
Pipeline #
#!/usr/bin/env bash #!/usr/bin/env bash
conda update conda set -e
conda install setuptools conda-build
mkdir -p dist name=$1
version=$2
cd .conda
# get version and name. We call # add any extra channels that are needed
# setup.py beforehand because it for channel in $CONDA_CHANNELS; do
# will install a bunch of deps, conda config --append channels $channel
# and output a bunch of stuff. done
python ../setup.py -V &> /dev/null
version=`python ../setup.py -V`
name=`python ../setup.py --name`
# invoking setup.py causes it to # insert project name/version into meta.yaml
# install deps, which conda will
# incklude in thye build
rm -rf .eggs
# insert name/version into meta.yaml
echo "{% set name = '$name' %}" > vars.txt echo "{% set name = '$name' %}" > vars.txt
echo "{% set version = '$version' %}" >> vars.txt echo "{% set version = '$version' %}" >> vars.txt
cat vars.txt .conda/meta.yaml > tempfile
cat vars.txt meta.yaml > tempfile mv tempfile .conda/meta.yaml
mv tempfile meta.yaml
rm vars.txt rm vars.txt
# do the build mkdir -p dist
conda build --output-folder=../dist .
conda update conda setuptools conda-build
conda build --output-folder=dist .conda
# tar it up # tar it up
cd ../dist cd dist
tar czf "$name"-"$version"-conda.tar.gz * tar czf "$name"-"$version"-conda.tar.gz *
cd ..
#!/usr/bin/env /bash #!/usr/bin/env /bash
set -e
python setup.py doc python setup.py doc
mv doc/html doc/"$CI_COMMIT_REF_NAME" mv doc/html doc/"$CI_COMMIT_REF_NAME"
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
pip install wheel pip install wheel
python setup.py sdist python setup.py sdist
python setup.py bdist_wheel python setup.py bdist_wheel
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
rsync -rv dist/*conda.tar.gz "condadeploy:" rsync -rv dist/*conda.tar.gz "condadeploy:"
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
rsync -rv doc/"$CI_COMMIT_REF_NAME" "docdeploy:" rsync -rv doc/"$CI_COMMIT_REF_NAME" "docdeploy:"
#!/usr/bin/env BASH #!/usr/bin/env BASH
set -e
pip install setuptools wheel twine pip install setuptools wheel twine
twine upload dist/* twine upload dist/*
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
if [[ "x$CI_COMMIT_TAG" != "x" ]]; then if [[ "x$CI_COMMIT_TAG" != "x" ]]; then
echo "Release detected - patching version - $CI_COMMIT_REF_NAME"; echo "Release detected - patching version - $CI_COMMIT_REF_NAME";
python -c "import fsl.version as v; v.patchVersion('fsl/version.py', '$CI_COMMIT_REF_NAME')"; python -c "import fsl.version as v; v.patchVersion('fsl/version.py', '$CI_COMMIT_REF_NAME')";
......
#!/usr/bin/env /bash #!/usr/bin/env /bash
set -e
########################################################## ##########################################################
# The setup_ssh script does the following: # The setup_ssh script does the following:
# #
...@@ -29,7 +31,8 @@ if [[ -f /.dockerenv ]]; then ...@@ -29,7 +31,8 @@ if [[ -f /.dockerenv ]]; then
echo "$SSH_PRIVATE_KEY_FSL_DOWNLOAD" > $HOME/.ssh/id_fsl_download; echo "$SSH_PRIVATE_KEY_FSL_DOWNLOAD" > $HOME/.ssh/id_fsl_download;
if [[ "$CI_PROJECT_PATH" == "$UPSTREAM_PROJECT" ]]; then if [[ "$CI_PROJECT_PATH" == "$UPSTREAM_PROJECT" ]]; then
echo "$SSH_PRIVATE_KEY_DOC_DEPLOY" > $HOME/.ssh/id_doc_deploy; echo "$SSH_PRIVATE_KEY_DOC_DEPLOY" > $HOME/.ssh/id_doc_deploy;
echo "$SSH_PRIVATE_KEY_CONDA_DEPLOY" > $HOME/.ssh/id_conda_deploy;
fi; fi;
chmod go-rwx $HOME/.ssh/id_*; chmod go-rwx $HOME/.ssh/id_*;
...@@ -39,6 +42,7 @@ if [[ -f /.dockerenv ]]; then ...@@ -39,6 +42,7 @@ if [[ -f /.dockerenv ]]; then
if [[ "$CI_PROJECT_PATH" == "$UPSTREAM_PROJECT" ]]; then if [[ "$CI_PROJECT_PATH" == "$UPSTREAM_PROJECT" ]]; then
ssh-add $HOME/.ssh/id_doc_deploy; ssh-add $HOME/.ssh/id_doc_deploy;
ssh-add $HOME/.ssh/id_conda_deploy;
fi fi
echo "$SSH_SERVER_HOSTKEYS" > $HOME/.ssh/known_hosts; echo "$SSH_SERVER_HOSTKEYS" > $HOME/.ssh/known_hosts;
...@@ -54,6 +58,11 @@ if [[ -f /.dockerenv ]]; then ...@@ -54,6 +58,11 @@ if [[ -f /.dockerenv ]]; then
echo " User ${DOC_HOST%@*}" >> $HOME/.ssh/config; echo " User ${DOC_HOST%@*}" >> $HOME/.ssh/config;
echo " IdentityFile $HOME/.ssh/id_doc_deploy" >> $HOME/.ssh/config; echo " IdentityFile $HOME/.ssh/id_doc_deploy" >> $HOME/.ssh/config;
echo "Host condadeploy" >> $HOME/.ssh/config;
echo " HostName ${CONDA_HOST##*@}" >> $HOME/.ssh/config;
echo " User ${CONDA_HOST%@*}" >> $HOME/.ssh/config;
echo " IdentityFile $HOME/.ssh/id_conda_deploy" >> $HOME/.ssh/config;
echo "Host fsldownload" >> $HOME/.ssh/config; echo "Host fsldownload" >> $HOME/.ssh/config;
echo " HostName ${FSL_HOST##*@}" >> $HOME/.ssh/config; echo " HostName ${FSL_HOST##*@}" >> $HOME/.ssh/config;
echo " User ${FSL_HOST%@*}" >> $HOME/.ssh/config; echo " User ${FSL_HOST%@*}" >> $HOME/.ssh/config;
......
#!/usr/bin/env bash #!/usr/bin/env bash
set -e
# Install $PY_VERSION, xvfb, and all # Install $PY_VERSION, xvfb, and all
# of the wxpython dependencies. # of the wxpython dependencies.
apt-get update -y || true apt-get update -y || true
......
python:
- 3.6
\ No newline at end of file
...@@ -13,7 +13,7 @@ source: ...@@ -13,7 +13,7 @@ source:
requirements: requirements:
build: build:
- python - python {{ python }}
- setuptools - setuptools
- six 1.* - six 1.*
- deprecation 1.* - deprecation 1.*
......
########################################################################### #############################################################################
# This file defines the build process for fslpy, as hosted at: # This file defines the build process for fslpy, as hosted at:
# #
# https://git.fmrib.ox.ac.uk/fsl/fslpy # https://git.fmrib.ox.ac.uk/fsl/fslpy
...@@ -11,10 +11,10 @@ ...@@ -11,10 +11,10 @@
# #
# 3. doc: Building API documentation # 3. doc: Building API documentation
# #
# 4. build: Building source distributions and wheels # 4. build: Building source, wheel and conda distributions
# #
# 5. deploy: Uploading the build outputs to pypi, and the documentation # 5. deploy: Uploading the build outputs to pypi/hosting servers, and the
# to a hosting server. # documentation to a hosting server.
# #
# The test and style stages are executed on all branches of upstream and fork # The test and style stages are executed on all branches of upstream and fork
# repositories. # repositories.
...@@ -22,11 +22,14 @@ ...@@ -22,11 +22,14 @@
# The doc stage, and the deploy-doc job, is executed on all branches of the # The doc stage, and the deploy-doc job, is executed on all branches of the
# upstream repository. # upstream repository.
# #
# The build stage, and the remaining jobs in the deploy stage, are only # The build stage, and the remaining jobs in the deploy stage, are only
# executed on the upstream repository, and only for release tags. # executed on the upstream repository, and only for release tags.
# #
# The deploy stages are manually instantiated. # The deploy stages are manually instantiated.
########################################################################### #
# Most of the logic for each job is defined in shell scripts in the .ci
# sub-directory.
#############################################################################
stages: stages:
...@@ -56,6 +59,9 @@ stages: ...@@ -56,6 +59,9 @@ stages:
# - SSH_PRIVATE_KEY_DOC_DEPLOY - private key for rsyncing documentation # - SSH_PRIVATE_KEY_DOC_DEPLOY - private key for rsyncing documentation
# to remote host (DOC_HOST) # to remote host (DOC_HOST)
# #
# - SSH_PRIVATE_KEY_CONDA_DEPLOY - private key for rsyncing conda builds
# to remote host (CONDA_HOST)
#
# - SSH_SERVER_HOSTKEYS - List of trusted SSH hosts # - SSH_SERVER_HOSTKEYS - List of trusted SSH hosts
# #
# - DOC_HOST: - Username@host to upload documentation to # - DOC_HOST: - Username@host to upload documentation to
...@@ -64,6 +70,12 @@ stages: ...@@ -64,6 +70,12 @@ stages:
# - FSL_HOST: - Username@host to download FSL data from # - FSL_HOST: - Username@host to download FSL data from
# (e.g. "paulmc@jalapeno.fmrib.ox.ac.uk") # (e.g. "paulmc@jalapeno.fmrib.ox.ac.uk")
# #
# - CONDA_HOST: - Username@host to upload conda build to
# (e.g. "paulmc@jalapeno.fmrib.ox.ac.uk")
#
# - CONDA_CHANNELS - List of additional conda channels to
# use for conda build.
#
# - TWINE_USERNAME: - Username to use when uploading to pypi # - TWINE_USERNAME: - Username to use when uploading to pypi
# #
# - TWINE_PASSWORD: - Password to use when uploading to pypi # - TWINE_PASSWORD: - Password to use when uploading to pypi
...@@ -262,19 +274,18 @@ build-conda-dist: ...@@ -262,19 +274,18 @@ build-conda-dist:
<<: *patch_version <<: *patch_version
stage: build stage: build
image: continuumio/minconda image: continuumio/miniconda3
tags: tags:
- docker - docker
script: script:
- bash ./.ci/build_conda_dist.sh fslpy "$CI_COMMIT_REF_NAME"
- bash ./.ci/build_conda_dist.sh
artifacts: artifacts:
expire_in: 1 day expire_in: 1 day
paths: paths:
- dist/* - dist/*conda.tar.gz
############## ##############
...@@ -314,3 +325,21 @@ deploy-pypi: ...@@ -314,3 +325,21 @@ deploy-pypi:
script: script:
- bash ./.ci/deploy_pypi.sh - bash ./.ci/deploy_pypi.sh
deploy-conda:
<<: *only_releases
<<: *setup_ssh
stage: deploy
when: manual
image: python:3.5
tags:
- docker
dependencies:
- build-conda-dist
script:
- bash ./.ci/deploy_conda.sh
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