Last active
June 7, 2019 11:30
-
-
Save yoavram/05a3c04ddcf317a517d5 to your computer and use it in GitHub Desktop.
Build and deploy conda packages to Anaconda.org from Travis-CI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
language: python | |
python: | |
- 2.7 | |
- 3.4 | |
# Setup anaconda | |
before_install: | |
- wget http://repo.continuum.io/miniconda/Miniconda-latest-Linux-x86_64.sh -O miniconda.sh | |
- chmod +x miniconda.sh | |
- ./miniconda.sh -b | |
- export PATH=$HOME/miniconda2/bin:$PATH | |
- conda update --yes -q conda | |
- conda config --set always_yes true | |
- conda config --set anaconda_upload no | |
# Install packages | |
install: | |
- conda install -q python=$TRAVIS_PYTHON_VERSION pip requests conda-build jinja2 anaconda-client | |
# install additional packages with conda and pip | |
- conda build conda-recipe # this assumes that the conda recipe folder is called conda-recipe and is at the current workind dir | |
- conda install --use-local $PACKAGENAME | |
# Run test | |
script: | |
- nosetests tests | |
after_success: | |
# Change permissions for Anaconda deployment script | |
- chmod +x ./deploy_anaconda.sh | |
deploy: | |
# Deploy to Anaconda.org | |
- provider: script | |
script: ./deploy_anaconda.sh | |
on: | |
tags: true | |
skip_cleanup: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# this script uses the ANACONDA_TOKEN env var. | |
# to create a token: | |
# >>> anaconda login | |
# >>> anaconda auth -c -n travis --max-age 307584000 --url https://anaconda.org/USERNAME/PACKAGENAME --scopes "api:write api:read" | |
set -e | |
echo "Converting conda package..." | |
conda convert --platform all $HOME/miniconda2/conda-bld/linux-64/PACKAGENAME-*.tar.bz2 --output-dir conda-bld/ | |
echo "Deploying to Anaconda.org..." | |
anaconda -t $ANACONDA_TOKEN upload conda-bld/**/PACKAGENAME-*.tar.bz2 | |
echo "Successfully deployed to Anaconda.org." | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Probably could shorten the deploy to
anaconda -t $ANACONDA_TOKEN upload conda-bld/**/PACKAGENAME-*.tar.bz2
.