From 190b013c61d66f6ef5817f268bfb53cc14e7a34b Mon Sep 17 00:00:00 2001 From: Seth Morton Date: Mon, 25 Nov 2019 12:43:26 -0800 Subject: [PATCH] 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 --- README.md | 32 ++++++++++++++++---------------- docs/setup.md | 42 ++++++++++++++++++++++-------------------- 2 files changed, 38 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 050b8a55..818d2a32 100644 --- a/README.md +++ b/README.md @@ -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). diff --git a/docs/setup.md b/docs/setup.md index fd387a32..05a4523c 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -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.