Update Travis CI examples

For a more granular view of why each of these changes were made, please
see https://github.com/joerick/cibuildwheel-autopypi-example/pull/5.

High-level overview:
 - Adding Windows support
 - Remove "sudo: required" for linux
 - Use "python -m pip" instead of using an environment variable
 - Add "install:" and "after_success:" steps so that errors get handled
   and reported properly
 - Rename "matrix:" to "jobs:" as this is the now preferred keyword
This commit is contained in:
Seth Morton
2019-11-25 15:08:18 -08:00
parent d2700bc3b4
commit 190b013c61
2 changed files with 38 additions and 36 deletions
+16 -16
View File
@@ -48,40 +48,40 @@ Usage
Example setup
-------------
To build manylinux and macOS wheels on Travis CI, and upload them to PyPI whenever you tag a version, you could use this `.travis.yml`:
To build manylinux, macOS, and Windows wheels on Travis CI and upload them to PyPI whenever you tag a version, you could use this `.travis.yml`:
```yaml
language: python
matrix:
jobs:
include:
# perform a linux build
- sudo: required
services:
- docker
env: PIP=pip
- services: docker
# and a mac build
- os: osx
language: generic
env: PIP=pip2
language: shell
# and a windows build
- os: windows
language: shell
before_install:
- choco install python --version 3.8.0
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
env:
global:
- TWINE_USERNAME=joerick
# Note: TWINE_PASSWORD is set in Travis settings
install:
- python -m pip install twine cibuildwheel==1.0.0
script:
- $PIP install cibuildwheel==1.0.0
# build the wheels, put them into './wheelhouse'
- cibuildwheel --output-dir wheelhouse
- python -m cibuildwheel --output-dir wheelhouse
after_success:
# if the release was tagged, upload them to PyPI
- |
if [[ $TRAVIS_TAG ]]; then
python -m pip install twine
python -m twine upload wheelhouse/*.whl
fi
- if [[ $TRAVIS_TAG ]]; then python -m twine upload wheelhouse/*.whl; fi
```
For more information, including how to build on Appveyor, Azure, CircleCI, check out the [documentation](https://cibuildwheel.readthedocs.org).
+22 -20
View File
@@ -47,37 +47,39 @@ Commit this file, enable building of your repo on Azure Pipelines, and push.
Wheels will be stored for you and available through the Pipelines interface. For more info on this file, check out the [docs](https://docs.microsoft.com/en-us/azure/devops/pipelines/yaml-schema).
# Travis CI [linux/mac] {: #travis-ci}
# Travis CI [linux/mac/windows] {: #travis-ci}
To build Linux and Mac wheels on Travis CI, create a `.travis.yml` file in your repo.
To build Linux, Mac, and Windows wheels on Travis CI, create a `.travis.yml` file in your repo.
> .travis.yml
```yaml
language: python
matrix:
jobs:
include:
- sudo: required
services:
- docker
env: PIP=pip
# perform a linux build
- services: docker
# and a mac build
- os: osx
language: generic
env: PIP=pip2
script:
- $PIP install cibuildwheel==1.0.0
- cibuildwheel --output-dir wheelhouse
```
To build on Windows too, add this matrix entry:
```yaml
language: shell
# and a windows build
- os: windows
language: shell
before_install:
- choco install python3 --version 3.6.8 --no-progress -y
env:
- PATH=/c/Python36:/c/Python36/Scripts:$PATH
- choco install python --version 3.8.0
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
env:
global:
- TWINE_USERNAME=joerick
# Note: TWINE_PASSWORD is set in Travis settings
install:
- python -m pip install twine cibuildwheel==1.0.0
script:
# build the wheels, put them into './wheelhouse'
- python -m cibuildwheel --output-dir wheelhouse
```
Note that building Windows Python 2.7 wheels on Travis is unsupported.