Apply suggestions by pyupgrade #834
Workflow file for this run
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: Python wheels | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the main branch | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} (${{ matrix.arch }}) | |
runs-on: ${{ matrix.os }} | |
# Only build wheels when tagging (typically a release) | |
if: startsWith(github.event.ref, 'refs/tags') | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
arch: [x86_64, aarch64] | |
exclude: | |
- os: windows-latest | |
arch: aarch64 | |
- os: macos-latest | |
arch: aarch64 | |
steps: | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
# - uses: conda-incubator/setup-miniconda@v2 | |
# with: | |
# auto-update-conda: true | |
# python-version: ${{ matrix.python-version }} | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.8' | |
- name: Set up QEMU | |
if: ${{ matrix.arch == 'aarch64' }} | |
uses: docker/setup-qemu-action@v2 | |
- name: Install Ninja | |
uses: seanmiddleditch/gha-setup-ninja@master | |
- name: Install MSVC amd64 | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-build.txt | |
python -m pip install -r requirements-test-wheels.txt | |
python -m pip install -r requirements-runtime.txt | |
- name: Build wheels (Windows) | |
if: runner.os == 'Windows' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_BUILD: 'cp38-win_amd64 cp39-win_amd64 cp310-win_amd64 cp311-win_amd64' | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: python -m pytest -m "not heavy" {project}/tests | |
CIBW_BUILD_VERBOSITY: 1 | |
- name: Build wheels (Linux / Mac OSX) | |
if: runner.os != 'Windows' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install cibuildwheel | |
python -m cibuildwheel --output-dir wheelhouse | |
env: | |
CIBW_BUILD: 'cp38-* cp39-* cp310-* cp311-*' | |
CIBW_SKIP: '*-manylinux*_i686 *-musllinux_* ${{ env.CIBW_SKIP}}' | |
CIBW_ARCHS_LINUX: ${{ matrix.arch }} | |
CIBW_TEST_REQUIRES: pytest | |
CIBW_TEST_COMMAND: python -m pytest -m "not heavy" {project}/tests | |
CIBW_BUILD_VERBOSITY: 1 | |
CIBW_ARCHS_MACOS: "x86_64 arm64" | |
- name: Upload wheels | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build sdist | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
arch: [auto] | |
exclude: | |
- os: [ubuntu-latest] | |
# We don't support 32-bit platforms in python-blosc2 | |
arch: x86 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'recursive' | |
- uses: actions/setup-python@v4 | |
name: Setup Python ${{ matrix.python-version }} | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-build.txt | |
python -m pip install -r requirements-tests.txt | |
python -m pip install -r requirements-runtime.txt | |
- name: Build sdist | |
run: | | |
python -m build --sdist | |
- name: Upload sdist package | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
- name: Build building extension from sdist package | |
run: | | |
cd ./dist | |
tar -xzf blosc2-*.tar.gz | |
cd ./blosc2-*/ | |
python setup.py build_ext --inplace | |
- name: Test sdist package with pytest | |
run: | | |
cd ./dist/blosc2-*/ | |
python -m pytest -m "not heavy" | |
upload_pypi: | |
needs: [ build_wheels, build_sdist ] # last but not least | |
runs-on: ubuntu-latest | |
# Only upload wheels when tagging (typically a release) | |
if: startsWith(github.event.ref, 'refs/tags') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.blosc_pypi_secret }} |