diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml new file mode 100644 index 0000000..25ce964 --- /dev/null +++ b/.github/workflows/build_and_test.yml @@ -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 diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml deleted file mode 100644 index 0d44af4..0000000 --- a/.github/workflows/run_tests.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: Run tests for PyWebP - -on: [push] - -defaults: - run: - shell: bash - -jobs: - build-sdist: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.6 - uses: actions/setup-python@v2 - with: - python-version: 3.6 - - name: Create source distribution - run: | - pip3 install build - python3 -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: - needs: build-sdist - strategy: - matrix: - python-version: [3.6, 3.7, 3.8, 3.9] - python-arch: [x64] - os: [ubuntu-latest, windows-latest] - include: - - python-version: 3.6 - python-arch: x86 - os: windows-latest - runs-on: ${{ matrix.os }} - 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 ${{ matrix.python-version }} - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} - architecture: ${{ matrix.python-arch }} - - name: Install the package - run: | - pip3 install dist/webp-*.tar.gz - - name: Test with pytest - run: | - pip3 install pytest==5.4.3 - pytest tests/ diff --git a/README.md b/README.md index 53534b8..5f27f6c 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/build_manylinux_wheels.sh b/build_manylinux_wheels.sh deleted file mode 100755 index c68c864..0000000 --- a/build_manylinux_wheels.sh +++ /dev/null @@ -1,15 +0,0 @@ -#!/usr/bin/bash -e -# -# This script generates manylinux wheels of pywebp for multiple different Python versions. It is -# meant to be run inside a `quay.io/pypa/manylinux2014_x86_64` Docker container, like so: -# -# $ docker run -it -v `pwd`:/io -w /io quay.io/pypa/manylinux2014_x86_64 ./build_manylinux_wheels.sh - -for PYVER in cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 -do - /opt/python/$PYVER/bin/python setup.py bdist_wheel - /opt/python/$PYVER/bin/pip install dist/webp-*-$PYVER-linux_x86_64.whl - /opt/python/$PYVER/bin/pip install pytest==5.4.3 - /opt/python/$PYVER/bin/pytest tests - auditwheel repair dist/webp-*-$PYVER-linux_x86_64.whl -w dist -done