Skip to content

Commit

Permalink
Fix PyPI wheel builds (#229)
Browse files Browse the repository at this point in the history
* Allow run on push for v0.6.5

* Fixes to build process

- Install brew on MacOS
- Use strings for Python versions (avoid cutting off 0 in 3.10)
- Use setup-miniconda instead of setup-python action (3.6 no longer
  available in setup-python)

* Use login mode in shells

This is to allow automatic login of the miniconda environment,
see the setup-miniconda action documentation

* Update manylinux action

* Run only on Ubuntu

* Downgrade manylinux action

* Try Git ownership fix

* Try cibuildwheel

* Only upload on release

* Remove run on push and specific version checkout

* Update checkout to v3

* Fix release testing

* Run release tests in specific branch rather than release

If there are errors in the test files on a specific tag,
this means that we can never get these tests to pass for
that release. Instead run the tests present in whatever
is checked out, but against a specific release version
of Euphonic.

* Install llvm on Mac
  • Loading branch information
rebeccafair authored Jul 8, 2022
1 parent 1dafb5e commit e9a4d7a
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 27 deletions.
47 changes: 26 additions & 21 deletions .github/workflows/build_upload_pypi_wheels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ name: Build and upload PyPI wheels and source dist
on:
release:
types: [published]
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
architecture: [x64]
python-version: [3.6, 3.7, 3.8, 3.9, 3.10]
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
include:
- os: windows-latest
wheelname: win
Expand All @@ -20,78 +20,83 @@ jobs:
wheelname: manylinux
# Build wheels against the lowest compatible Numpy version
- python-version: 3.6
manylinux-version-tag: cp36-cp36m
manylinux-version-tag: cp36
numpy-version: 1.12.1
- python-version: 3.7
manylinux-version-tag: cp37-cp37m
manylinux-version-tag: cp37
numpy-version: 1.14.6
- python-version: 3.8
manylinux-version-tag: cp38-cp38
manylinux-version-tag: cp38
numpy-version: 1.17.3
- python-version: 3.9
manylinux-version-tag: cp39-cp39
manylinux-version-tag: cp39
numpy-version: 1.19.3
- python-version: 3.10
manylinux-version-tag: cp310-cp310
manylinux-version-tag: cp310
numpy-version: 1.21.3
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Ensure tags are fetched for versioning
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
- name: Setup Python ${{ matrix.python-version }} with Conda
uses: conda-incubator/setup-miniconda@v2
with:
architecture: ${{ matrix.architecture }}
python-version: ${{ matrix.python-version }}
- name: Update Python pip, wheel, and twine
shell: bash -l {0}
run: |
python -m pip install --upgrade pip wheel twine
shell: bash
- name: Install llvm on Macos
if: startsWith(matrix.os, 'macos')
run: brew install llvm

- name: Build Python wheel
if: matrix.os != 'ubuntu-latest'
shell: bash -l {0}
env:
NUMPY_VERSION: ${{ matrix.numpy-version }}
run: |
# Build against lowest required Numpy version
python -m pip install numpy==${NUMPY_VERSION}
python -m pip wheel . -w wheelhouse --no-deps
shell: bash
- name: Build manylinux Python wheel
if: matrix.os == 'ubuntu-latest'
uses: RalfG/[email protected]_x86_64
uses: pypa/[email protected]
env:
CIBW_BUILD: ${{ matrix.manylinux-version-tag}}-manylinux*
CIBW_BEFORE_BUILD: python -mpip install numpy==${{ matrix.numpy-version }}
CIBW_ARCHS: x86_64
with:
python-versions: ${{ matrix.manylinux-version-tag }}
build-requirements: numpy==${{ matrix.numpy-version }}
pip-wheel-args: '--no-deps -w wheelhouse'
output-dir: wheelhouse

- name: Create source distribution
if: matrix.os == 'windows-latest' && matrix.python-version == '3.10'
shell: bash -l {0}
run: |
python setup.py sdist
shell: bash
- name: Upload as build artifacts
uses: actions/upload-artifact@v2
with:
name: wheels
path: wheelhouse/*-${{ matrix.wheelname }}*.whl
- name: Upload source dist to PyPI
if: matrix.os == 'windows-latest' && matrix.python-version == '3.10'
if: github.event_name == 'release' && matrix.os == 'windows-latest' && matrix.python-version == '3.10'
shell: bash -l {0}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python -m twine upload dist/*.tar.gz
shell: bash
- name: Upload wheel to PyPI
if: github.event_name == 'release'
shell: bash -l {0}
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
WHEEL_NAME: ${{ matrix.wheelname }}
run: |
python -m twine upload wheelhouse/*-${WHEEL_NAME}*.whl
shell: bash
2 changes: 1 addition & 1 deletion .github/workflows/create-landing-page.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
update-landing-page:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
with:
ref: gh-pages
- uses: actions/setup-python@v1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.6
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ jobs:
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
ref: v${{ github.event.inputs.version }}
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.6
- name: Install llvm on Macos
if: startsWith(matrix.os, 'macos')
run: brew install llvm
- name: Update pip and install dependencies
shell: bash -l {0}
run: |
Expand Down
2 changes: 1 addition & 1 deletion release_tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ commands =
python run_tests.py --report

# Test PyPI source distribution
[testenv:pypisource-py36,py310]
[testenv:pypisource-{py36,py310}]
install_command = python -m pip install {opts} {packages}
deps =
numpy
Expand Down

0 comments on commit e9a4d7a

Please sign in to comment.