Skip to content

Commit

Permalink
Build and test wheels using CI
Browse files Browse the repository at this point in the history
  • Loading branch information
anibali committed Mar 22, 2022
1 parent a6f7b40 commit c9c04ba
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 90 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Build and test packages

on: [push]

defaults:
run:
shell: bash

jobs:
build-sdist:
name: Build source distribution
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Build source distribution
run: |
python -m pip install build
python -m build --sdist
- name: Upload source distribution
uses: actions/upload-artifact@v2
with:
name: sdist-${{ github.sha }}
path: ./dist/webp-*.tar.gz
retention-days: 7

test-sdist:
name: Test source distribution
needs: build-sdist
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Fetch source distribution
uses: actions/download-artifact@v2
with:
name: sdist-${{ github.sha }}
path: dist/
- name: Set up Python 3.6
uses: actions/setup-python@v2
with:
python-version: 3.6
- name: Install the package
run: |
python -m pip install dist/webp-*.tar.gz
- name: Test with pytest
run: |
python -m pip install pytest
pytest tests/
build-wheels:
name: Build and test wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-20.04, windows-2019]
env:
CIBW_BUILD: 'cp3*-manylinux_x86_64 cp3*-win_amd64'
CIBW_TEST_REQUIRES: pytest
CIBW_TEST_COMMAND: pytest {package}/tests
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.1
- name: Build wheels
run: python -m cibuildwheel --output-dir wheelhouse
- uses: actions/upload-artifact@v2
with:
name: wheels-${{ github.sha }}
path: ./wheelhouse/*.whl
retention-days: 7
59 changes: 0 additions & 59 deletions .github/workflows/run_tests.yml

This file was deleted.

33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,22 +110,23 @@ with open('anim.webp', 'rb') as f:
$ pytest tests/
```

### Cutting releases

Source release:

```console
$ pip3 install build twine
$ python3 -m build --sdist
$ twine upload dist/webp-*.tar.gz
```

Linux binary wheel release (repeat for different Python versions and architectures):

```console
$ docker run -it -v `pwd`:/io -w /io quay.io/pypa/manylinux2014_x86_64 ./build_manylinux_wheels.sh
$ twine upload dist/webp-*-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
```
### Cutting a new release

1. Ensure that tests are passing and everything is ready for release.
2. Create and push a Git tag:
```console
$ git tag -a v0.1.4
$ git push --tags
```
3. Download the artifacts from GitHub Actions, which will include the source distribution tarball and binary wheels.
4. Create a new release on GitHub from the tagged commit and upload the packages as attachments to the release.
5. Also upload the packages to PyPI using Twine:
```console
$ twine upload webp-*.tar.gz webp-*.whl
```
6. Bump the version number in `setup.cfg` and create a commit, signalling the start of development on the next version.

These files should also be added to a GitHub release.

## Known issues

Expand Down
15 changes: 0 additions & 15 deletions build_manylinux_wheels.sh

This file was deleted.

0 comments on commit c9c04ba

Please sign in to comment.