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 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 ```yaml
language: python language: python
matrix: jobs:
include: include:
# perform a linux build # perform a linux build
- sudo: required - services: docker
services:
- docker
env: PIP=pip
# and a mac build # and a mac build
- os: osx - os: osx
language: generic language: shell
env: PIP=pip2 # 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: env:
global: global:
- TWINE_USERNAME=joerick - TWINE_USERNAME=joerick
# Note: TWINE_PASSWORD is set in Travis settings # Note: TWINE_PASSWORD is set in Travis settings
install:
- python -m pip install twine cibuildwheel==1.0.0
script: script:
- $PIP install cibuildwheel==1.0.0
# build the wheels, put them into './wheelhouse' # 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 the release was tagged, upload them to PyPI
- | - if [[ $TRAVIS_TAG ]]; then python -m twine upload wheelhouse/*.whl; fi
if [[ $TRAVIS_TAG ]]; then
python -m pip install twine
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). For more information, including how to build on Appveyor, Azure, CircleCI, check out the [documentation](https://cibuildwheel.readthedocs.org).
+21 -19
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). 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 > .travis.yml
```yaml ```yaml
language: python language: python
matrix: jobs:
include: include:
- sudo: required # perform a linux build
services: - services: docker
- docker # and a mac build
env: PIP=pip
- os: osx - os: osx
language: generic language: shell
env: PIP=pip2 # and a windows build
script:
- $PIP install cibuildwheel==1.0.0
- cibuildwheel --output-dir wheelhouse
```
To build on Windows too, add this matrix entry:
```yaml
- os: windows - os: windows
language: shell language: shell
before_install: before_install:
- choco install python3 --version 3.6.8 --no-progress -y - choco install python --version 3.8.0
- export PATH="/c/Python38:/c/Python38/Scripts:$PATH"
env: env:
- PATH=/c/Python36:/c/Python36/Scripts:$PATH 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. Note that building Windows Python 2.7 wheels on Travis is unsupported.