Skip to content

Commit

Permalink
Add workflow to build and release wheels
Browse files Browse the repository at this point in the history
  • Loading branch information
jobovy committed Mar 7, 2023
1 parent a864d76 commit 2ce9b6c
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 47 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/pypi.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Wheel builder and uploader

# Update on every push and PR to main, and upon release creation
on:
push:
branches:
- main
paths:
- '**'
- '!*'
- '*.py'
- '!tests/**'
- '!.github/**'
- '.github/workflows/wheels.yml'
pull_request:
branches:
- main
release:
types: [created]

jobs:
build_wheels:
name: Build wheel for ${{ matrix.python }}-${{ matrix.buildplat[1] }}-${{ matrix.buildplat[2] }}
runs-on: ${{ matrix.buildplat[0] }}
strategy:
# Ensure that a wheel builder finishes even if another fails
fail-fast: false
matrix:
# Following numpy's setup
buildplat:
- [ubuntu-latest, manylinux, x86_64]
- [macos-latest, macosx, x86_64]
- [macos-latest, macosx, arm64]
- [windows-2019, win, amd64]
python: ["cp38", "cp39", "cp310", "cp311"]
steps:
- uses: actions/checkout@v3
- name: Build wheels
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }}
CIBW_ARCHS_MACOS: ${{ matrix.buildplat[2] }}
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} &&
DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel -v --require-archs {delocate_archs} -w {dest_dir} {wheel}
- uses: actions/upload-artifact@v3
with:
name: ${{ matrix.python }}-${{ matrix.buildplat[1] }}_${{ matrix.buildplat[2] }}
path: ./wheelhouse/*.whl
build_sdist:
name: Build source directory for release
if: github.event_name == 'release' && github.event.action == 'created'
runs-on: ubuntu-latest
steps:
# check-out this repository
- uses: actions/checkout@v3
# Setup python
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Build sdist
run: |
pip install build
python -m build --sdist
- uses: actions/upload-artifact@v3
with:
name: sdist
path: ./dist/*.tar.gz
# Deploy wheels and sdist to PyPI (upon release creation)
deploy_pypi:
name: Deploy to PyPI
needs: [build_wheels, build_sdist]
runs-on: ubuntu-latest
if: github.event_name == 'release' && github.event.action == 'created'
steps:
- uses: actions/checkout@v3
- run: |
mkdir tmp_wheelhouse
mkdir wheelhouse
- uses: actions/download-artifact@v3
with:
path: tmp_wheelhouse/
- run: find tmp_wheelhouse/ -mindepth 2 -type f -exec mv -i '{}' wheelhouse/ ';'
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.pypi_token }}
packages_dir: wheelhouse/
4 changes: 3 additions & 1 deletion HISTORY.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ v1.3 (XXXX-XX-XX)

- Added custom implementation of most of the necessary healpy functions
to avoid the need for healpy as a dependency. This makes it possible
to compile and use mwdust on Windows (where healpy is unavailable)
to compile and use mwdust on Windows (where healpy is unavailable).

- Added binary wheels for all major platforms (Linux, MacOS, Windows).

v1.2 (2023-02-21)
==================
Expand Down

0 comments on commit 2ce9b6c

Please sign in to comment.