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
6.1 KiB
title
| title |
|---|
| Setup |
Azure Pipelines [linux/mac/windows] {: #azure-pipelines}
Using Azure pipelines, you can build all three platforms on the same service. Create a azure-pipelines.yml file in your repo.
azure-pipelines.yml
jobs:
- job: linux
pool: {vmImage: 'Ubuntu-16.04'}
steps:
- task: UsePythonVersion@0
- bash: |
python -m pip install --upgrade pip
pip install cibuildwheel==1.0.0
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}
- job: macos
pool: {vmImage: 'macOS-10.13'}
steps:
- task: UsePythonVersion@0
- bash: |
python -m pip install --upgrade pip
pip install cibuildwheel==1.0.0
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}
- job: windows
pool: {vmImage: 'vs2017-win2016'}
steps:
- task: UsePythonVersion@0
- script: choco install vcpython27 -f -y
displayName: Install Visual C++ for Python 2.7
- bash: |
python -m pip install --upgrade pip
pip install cibuildwheel==1.0.0
cibuildwheel --output-dir wheelhouse .
- task: PublishBuildArtifacts@1
inputs: {pathtoPublish: 'wheelhouse'}
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.
Travis CI [linux/mac/windows] {: #travis-ci}
To build Linux, Mac, and Windows wheels on Travis CI, create a .travis.yml file in your repo.
.travis.yml
language: python
jobs:
include:
# perform a linux build
- services: docker
# and a mac build
- os: osx
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:
# 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.
Commit this file, enable building of your repo on Travis CI, and push.
Then setup a deployment method by following the Travis CI deployment docs, or see Delivering to PyPI. For more info on .travis.yml, check out the docs.
CircleCI [linux/mac] {: #circleci}
To build Linux and Mac wheels on CircleCI, create a .circleci/config.yml file in your repo,
.circleci/config.yml
version: 2
jobs:
linux-wheels:
working_directory: ~/linux-wheels
docker:
- image: circleci/python:3.6
steps:
- checkout
- setup_remote_docker
- run:
name: Build the Linux wheels.
command: |
pip install --user cibuildwheel==1.0.0
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
osx-wheels:
working_directory: ~/osx-wheels
macos:
xcode: "10.0.0"
steps:
- checkout
- run:
name: Build the OS X wheels.
command: |
pip install --user cibuildwheel==1.0.0
cibuildwheel --output-dir wheelhouse
- store_artifacts:
path: wheelhouse/
workflows:
version: 2
all-tests:
jobs:
- linux-wheels
- osx-wheels
Commit this file, enable building of your repo on CircleCI, and push.
!!! note CircleCI doesn't enable free macOS containers for open source by default, but you can ask for access. See here for more information.
CircleCI will store the built wheels for you - you can access them from the project console. Check out the CircleCI docs for more info on this config file.
AppVeyor [linux/windows] {: #appveyor}
To build Linux and Windows wheels on AppVeyor, create an appveyor.yml file in your repo.
appveyor.yml
image:
- Ubuntu
- Visual Studio 2015
build_script:
# windows
- cmd: pip install cibuildwheel==1.0.0
- cmd: cibuildwheel --output-dir wheelhouse
# linux
- sh: "${HOME}/.localpython3.7.4/bin/python3 -m pip install cibuildwheel==1.0.0"
- sh: "${HOME}/.localpython3.7.4/bin/python3 -m cibuildwheel --output-dir wheelhouse"
artifacts:
- path: "wheelhouse\\*.whl"
name: Wheels
Commit this file, enable building of your repo on AppVeyor, and push.
AppVeyor will store the built wheels for you - you can access them from the project console. Alternatively, you may want to store them in the same place as the Travis CI build. See AppVeyor deployment docs for more info, or see Delivering to PyPI below.
For more info on this config file, check out the docs.
<script> document.addEventListener('DOMContentLoaded', function() { $('.toctree-l2 a, .rst-content h1').each(function(i, el) { var text = $(el).text() var match = text.match(/(.*) \[([a-z/]+)\]/); if (match) { var iconHTML = $.map(match[2].split('/'), function(ident) { switch (ident) { case 'linux': return '' case 'windows': return '' case 'mac': return '' } }).join(' '); $(el).append( $('⚠️ Got an error? Check the FAQ.