Skip to content

Commit

Permalink
Added GitHub Action that builds Python wheels on push with new tag
Browse files Browse the repository at this point in the history
* We only run this on a git push with a new tag. If we wanted this to run with every push (we easily could), it would be good to change the version to e.g. the commit sha, so that we're not building wheels with e.g. version 1.4.0 that are really not 1.4.0 anymore.
* We build wheels for all platforms, but I am not sure how universally usable the ubuntu and macos wheels are. The Ubuntu wheels will work on other Ubuntu installations (it did on mine), but pip might try to install them on other Linux distributions that they're not compatible with. It would be safer to use a proper manylinux build here. For macOS, at least the Python3.11 wheels have "universal" in their name, but I don't know how universal they are. So to be safe, we should only ever upload the sdist and Windows wheels to pypi.
patrikhuber committed Apr 11, 2023
1 parent 450f17f commit 1fa5d90
Showing 1 changed file with 63 additions and 0 deletions.
63 changes: 63 additions & 0 deletions .github/workflows/build_wheels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Build Python wheels

on:
push:
tags:
- '*'

jobs:
build_wheels:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, ubuntu-20.04, macos-latest, macos-11]
python-version: ['3.8', '3.9', '3.10', '3.11']

name: ${{matrix.os}}, python-${{matrix.python-version}}

runs-on: ${{matrix.os}}

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build Wheel
run: |
python setup.py bdist_wheel
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}-python${{ matrix.python-version }}-whl
path: dist/*.whl

build_sdist:
name: sdist
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
- name: Build sdist
run: |
python setup.py sdist
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Source distribution (sdist)
path: dist/*.*

0 comments on commit 1fa5d90

Please sign in to comment.