Skip to content

Instantly share code, notes, and snippets.

@pauldevos
Forked from teddyrendahl/travis.yml
Created July 2, 2019 20:05
Show Gist options
  • Save pauldevos/29ae9ae73ebf3ee4b8b8c79659cbb805 to your computer and use it in GitHub Desktop.
Save pauldevos/29ae9ae73ebf3ee4b8b8c79659cbb805 to your computer and use it in GitHub Desktop.

Revisions

  1. Teddy Rendahl created this gist Jun 27, 2019.
    48 changes: 48 additions & 0 deletions travis.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,48 @@
    language: python

    matrix:
    # This will launch a separate build for each Python version you add
    # Feel free to add extra environment variables as needed
    include:
    - python: 3.5
    - python: 3.6

    before_install:
    # Install the latest version of Miniconda
    - 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/travis/miniconda/bin:$PATH
    - conda update --yes conda # Update CONDA without command line prompt

    install:
    - conda install conda-build
    # You can add any CONDA channels you may need here. CONDA supports
    # both the commands add and append. The only difference is that
    # the add command places the channel at the front of the priority
    # list, while append does the opposite.
    - conda config --add channels conda-forge

    # Build the conda recipe for this package
    - conda build -q conda-recipe --python=$TRAVIS_PYTHON_VERSION --output-folder bld-dir
    # Add the built package as a channel with highest priority
    - conda config --add channels "file://`pwd`/bld-dir"

    # Create and activate the test environment
    - conda create -q -n test-environment python=$TRAVIS_PYTHON_VERSION pkg_name --file dev-requirements.txt
    - source activate test-environment

    script:
    # Run any test suite you may have
    - py.test -v

    after_success:
    # Install the command line API for CONDA uploads
    - conda install anaconda-client
    - |
    # Only upload builds from tags
    if [[ $TRAVIS_PULL_REQUEST == false && $TRAVIS_REPO_SLUG == "org/pkgname"
    && $TRAVIS_BRANCH == $TRAVIS_TAG && $TRAVIS_TAG != '' ]]; then
    export ANACONDA_API_TOKEN=$CONDA_UPLOAD_TOKEN
    anaconda upload bld-dir/**/PACKAGENAME-*.tar.bz2
    fi