Skip to content

Instantly share code, notes, and snippets.

@glostis
Created November 26, 2019 10:12
Show Gist options
  • Save glostis/59f7732e3404ff93a78e9e82e332c01a to your computer and use it in GitHub Desktop.
Save glostis/59f7732e3404ff93a78e9e82e332c01a to your computer and use it in GitHub Desktop.
Example of a .travis.yml with addons, several stages, and PyPI deploy
os: linux
dist: xenial
language: python
python: 3.7
addons:
apt:
sources:
- sourceline: 'ppa:ubuntugis/ppa'
packages:
- gdal-bin
- geographiclib-tools
- libfftw3-dev
- libgdal-dev
- libgeographic-dev
homebrew:
packages:
# GDAL is already included on osx images
- geographiclib
- fftw
install:
- |
if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
# Work in a virtual environment to avoid having to do
# "pip3 install --user"
python3 -m venv venv
source venv/bin/activate
fi
- pip install -e ".[test]"
script: pytest tests
jobs:
include:
- stage: formatting
name: black
install:
- pip install black
script:
- black --check .
- stage: formatting
name: isort
install:
- pip install "isort[pyproject]"
script:
- isort --check-only
- stage: packaging
name: "Python sdist installation"
install: skip
script:
- python setup.py sdist
- pip install dist/*.tar.gz
- stage: test
- stage: test
os: osx
# The default osx image (xcode9.4 as of 2019-09-30) has a very old brew,
# which crashes with the `addons` feature, so we use a non-default more recent one
# (see https://github.com/Homebrew/homebrew-bundle/issues/540#issuecomment-518301382)
osx_image: xcode10.2
language: generic
- stage: deploy
if: repo = glostis/plyflatten # remove and uncomment line below to only deploy on tags
# if: tag IS present AND repo = glostis/s2p
install: skip
script: skip
deploy:
- provider: pypi
user: glostis
password:
secure: ""
distributions: sdist
server: https://test.pypi.org/legacy/ # remove to deploy on real PyPI
on:
branch: develop # remove and uncomment line below to only deploy on tags
# tags: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment