Merge pull request #149 from salty-horse/cleanup #86
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: PyPi wheel and sdist | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
jobs: | |
sdist: | |
runs-on: ubuntu-latest | |
name: Python 3.11 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
architecture: x64 | |
- name: Install test dependencies | |
run: pip install wheel flake8 pytest | |
- name: Flake8 | |
# stop the build if there are Python syntax errors or undefined names | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
run: | | |
flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Generate source distribution | |
run: python setup.py sdist | |
- name: Install python-snappy sdist | |
run: pip install dist/python-snappy*.tar.gz | |
- name: Pytest | |
run: pytest --verbose test_snappy.py | |
- name: Archive sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: wheels | |
path: dist/python-snappy*.tar.gz | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, macos-12, windows-2019] | |
architecture: ["x64"] | |
linux_archs: ["auto s390x"] | |
include: | |
- os: windows-2019 | |
architecture: "x86" | |
skip: "*2*win* *win_amd64" | |
environment_windows: INCLUDE="C:/Program Files (x86)/Snappy/include" LIB="C:/Program Files (x86)/Snappy/lib" | |
- os: windows-2019 | |
architecture: "x64" | |
skip: "*2*win* *win32" | |
environment_windows: INCLUDE="C:/Program Files/Snappy/include" LIB="C:/Program Files/Snappy/lib" | |
- os: ubuntu-20.04 | |
architecture: "x64" | |
linux_archs: aarch64 ppc64le | |
name: Python ${{ matrix.os }} | |
env: | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: "python -m pytest --verbose {project}/test_snappy.py" | |
CIBW_BEFORE_ALL_LINUX: yum install -y snappy-devel | |
MACOSX_DEPLOYMENT_TARGET: "10.9" | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}" | |
CIBW_BEFORE_ALL: "bash {project}/build_snappy.sh" | |
CIBW_SKIP: ${{ matrix.skip }} | |
CIBW_ENVIRONMENT_WINDOWS: ${{ matrix.environment_windows }} | |
CIBW_ARCHS_LINUX: ${{ matrix.linux_archs }} | |
CIBW_ARCHS_MACOS: x86_64 universal2 | |
CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
architecture: ${{ matrix.architecture }} | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v1 | |
with: | |
platforms: all | |
- name: Add msbuild to PATH | |
if: runner.os == 'Windows' | |
uses: microsoft/setup-msbuild@v1.0.2 | |
- name: delvewheel install | |
if: runner.os == 'Windows' | |
run: | | |
python -m pip install delvewheel==0.0.9 | |
- name: Build wheels | |
run: | | |
python -m pip wheel -w ./wheelhouse . | |
- uses: actions/upload-artifact@v4 | |
with: | |
path: ./wheelhouse/*.whl | |
name: wheels | |
upload: | |
runs-on: ubuntu-latest | |
name: upload wheels | |
needs: ["sdist", "build"] | |
if: startsWith(github.ref, 'refs/tags/0.') | |
steps: | |
- name: Download test data | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: wheels | |
- name: Publish wheels to PyPI | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
twine upload dist/*.whl |