Packaging #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Packaging | |
on: | |
release: | |
types: [published] | |
workflow_dispatch: | |
env: | |
PROJECT: buvar | |
jobs: | |
package_sdist: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- run: python -m pip install setuptools | |
- name: Build source distribution | |
run: | | |
python setup.py sdist | |
ls -la ./dist | |
- name: archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: buvar-${{ github.ref }} | |
path: | | |
./dist/${PROJECT}*.tar.gz | |
package_wheels: | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- manylinux2014_x86_64 | |
version: | |
- cp312-cp312 | |
- cp311-cp311 | |
- cp310-cp310 | |
- cp39-cp39 | |
- cp38-cp38 | |
# - cp37-cp37m | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/pypa/manylinux2014_x86_64:latest | |
steps: | |
# XXX FIXME see checkout@v4 not working with container | |
# https://github.com/actions/checkout/issues/1487 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: build wheels | |
run: | | |
export PATH="/opt/python/${{ matrix.version }}/bin:${PATH}" | |
pip wheel -w ./wheelhouse cython pip | |
pip install -U cython pip -f ./wheelhouse | |
python setup.py bdist_wheel -d wheels | |
auditwheel repair ./wheels/${PROJECT}*${{ matrix.version }}*.whl \ | |
--plat ${{ matrix.platform }} -w ./dist | |
pip install ./dist/${PROJECT}*${{ matrix.version }}*.whl | |
pip install "${PROJECT}[tests]" -f ./dist -f ./wheelhouse | |
pytest tests | |
- name: archive artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: buvar-${{ matrix.version }}-${{ matrix.platform }} | |
path: | | |
./dist/${PROJECT}*${{ matrix.version }}*.whl | |
upload: | |
needs: | |
- package_sdist | |
- package_wheels | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: buvar-${{ github.ref }} | |
- name: Upload to pypi.org | |
run: | | |
pip install twine | |
ls -la ./dist/${PROJECT}* |