Skip to content

Commit

Permalink
Merge pull request #7 from brianhelba/multi-platform
Browse files Browse the repository at this point in the history
Build wheels for macOS
  • Loading branch information
brianhelba committed Feb 24, 2021
2 parents bbd78e2 + b519e6e commit f87c805
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 12 deletions.
47 changes: 41 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,63 @@ on:
types: [published]
jobs:
publish:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.6", "3.7", "3.8", "3.9"]
# Linux builds don't need to run across different Python versions,
# they will all be installed under the manylinux action
exclude:
- os: ubuntu-latest
python-version: "3.6"
- os: ubuntu-latest
python-version: "3.7"
- os: ubuntu-latest
python-version: "3.8"
- os: ubuntu-latest
python-version: "3.9"
# Use the latest Python version as a base for Linux builds
include:
- os: ubuntu-latest
python-version: "3.x"
steps:
- uses: actions/checkout@v2
with:
lfs: true
submodules: true
# Tags are needed to compute the current version number
fetch-depth: 0
- name: Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: "3.x"
python-version: ${{ matrix.python-version }}
- name: Install tox and pypa-build
run: |
pip install --upgrade pip
pip install tox build
- name: Build sdist
# Do this before the manylinux build, so the output directory doesn't get created by Docker
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
pyproject-build --sdist
- name: Build manylinux wheels
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2014_x86_64
with:
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39'
# Necessary for setuptools_scm to read the version from Git
system-packages: 'git-lfs'
- name: Install tox
- name: Remove non-manylinux wheels
if: ${{ matrix.os == 'ubuntu-latest' }}
# Those are built as intermediate artifacts, but should not be published
# Since these are built by Docker, they must be removed with sudo
run: |
pip install --upgrade pip
pip install tox
sudo rm -f dist/*-linux*.whl
- name: Build non-Linux wheels
if: ${{ matrix.os != 'ubuntu-latest' }}
run: |
pyproject-build --wheel
- name: Publish to PyPI
env:
TWINE_USERNAME: "__token__"
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Extract DEFLATE64 ZIP archives with Python's `zipfile` API.
pip install zipfile-deflate64
```

Python 3.6, 3.7, 3.8, and 3.9 supported, with [manylinux2014 wheels](https://github.com/pypa/manylinux) published to PyPI.
Python 3.6, 3.7, 3.8, and 3.9 are supported,
with [manylinux2014 wheels](https://github.com/pypa/manylinux) and macOS wheels published to PyPI.

## Usage
Anywhere in a Python codebase:
Expand Down
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: Apache Software License',
'Operating System :: MacOS :: MacOS X',
'Operating System :: POSIX :: Linux',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.6',
Expand Down
8 changes: 3 additions & 5 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@ passenv =
TWINE_PASSWORD
TWINE_NON_INTERACTIVE
deps =
build
twine
commands =
# Don't build wheels, as that's done by manylinux
pyproject-build --sdist --outdir {envtmpdir}
twine check {envtmpdir}/* dist/*-manylinux*.whl
twine upload --skip-existing {envtmpdir}/* dist/*-manylinux*.whl
# Don't build any packages, that's done in a more particular way by CI
twine check dist/*
twine upload --skip-existing dist/*

[flake8]
max-line-length = 100
Expand Down

0 comments on commit f87c805

Please sign in to comment.