Skip to content

Commit

Permalink
ENH: Add cibuildwheel to build wheels (#1267)
Browse files Browse the repository at this point in the history
* update environment to include cibuildwheel

* add cibuildwheel workflow

* add check for history

* fix spacing in wheels workflow

* add setuptools_scm

* add pytest command

* remove requires manifest

* change odd xarray requirements

* add path to tests

* use cibuildwheel example verbatim

* add pip install netcdf4

* Update .github/workflows/wheels.yml

Co-authored-by: Clément Robert <[email protected]>

* Update .github/workflows/wheels.yml

Co-authored-by: Clément Robert <[email protected]>

* Update .github/workflows/wheels.yml

Co-authored-by: Clément Robert <[email protected]>

* update build systems

* Add additional flags

* Only use 3.8 to 3.10 wheels

* Add pip only binary flag

* Remove duplicated statement

* MNT: Test 64 for windows build, not definite.

Co-authored-by: Clément Robert <[email protected]>
Co-authored-by: zssherman <[email protected]>
  • Loading branch information
3 people authored Sep 26, 2022
1 parent bd5e65e commit 082efd6
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 99 deletions.
98 changes: 0 additions & 98 deletions .github/workflows/pypi-release.yml

This file was deleted.

101 changes: 101 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Build CI Wheels

on:
push:
branches:
- main
tags:
- 'v*'
pull_request:
paths:
- '.github/workflows/wheels.yml'
workflow_dispatch:

env:
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: "pytest {project}/tests"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build_wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [
ubuntu-20.04,
windows-2019,
macos-11,
]
fail-fast: false

steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Fetch all history for all tags and branches
run: |
git fetch --prune --unshallow
- name: Build wheels for CPython
uses: pypa/[email protected]
with:
output-dir: dist
env:
CIBW_BUILD: "cp38-* cp39-* cp310-*"
CIBW_SKIP: "*-musllinux_*" # numpy doesn't have wheels for musllinux so we can't build some quickly and without bloating
CIBW_ARCHS_LINUX: "x86_64"
CIBW_ARCHS_MACOS: x86_64 arm64
MACOSX_DEPLOYMENT_TARGET: "10.9" # as of CIBW 2.9, this is the default value, pin it so it can't be bumped silently
CIBW_ARCHS_WINDOWS: "auto64"
CIBW_BUILD_VERBOSITY: 1
CIBW_ENVIRONMENT: PIP_ONLY_BINARY=":all:"

- uses: actions/upload-artifact@v3
with:
name: wheels
path: ./dist/*.whl

build_sdist:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v3

- name: Build sdist
run: pipx run build --sdist

- name: Upload sdist
uses: actions/upload-artifact@v3
with:
name: sdist
path: dist/*.tar.gz

deploy:
name: Publish to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
# upload to PyPI on every tag starting with 'v-'
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v')
steps:
- name: Download sdist
uses: actions/download-artifact@v3
with:
name: sdist
path: dist

- name: Download wheels
uses: actions/download-artifact@v3
with:
name: wheels
path: dist

- name: Publish to PyPI
uses: pypa/[email protected]
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
1 change: 1 addition & 0 deletions continuous_integration/environment-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,6 @@ dependencies:
- shapely<1.8.3
- pip
- pip:
- cibuildwheel
- pooch
- versioneer
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ cftime
Cython
fsspec
s3fs
xarray>=0.21.1
xarray!=0.21.0

0 comments on commit 082efd6

Please sign in to comment.