Skip to content

feature/build riscv64 wheel #32

feature/build riscv64 wheel

feature/build riscv64 wheel #32

name: Build, test and create release packages.
on:
workflow_dispatch:
pull_request:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+rc[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+dev[0-9]+"
jobs:
test_linux:
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
- 3.13
- 3.14-dev
- pypy-3.8
- pypy-3.9
- pypy-3.10
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install tox
run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
- name: Install mypy
run: python -m pip install "mypy==1.18.1; python_version >= '3.9'"
- name: Test with tox
run: python -m tox
- name: Store partial coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
test_linux_riscv64:
name: Test (${{ matrix.os }} riscv64-${{ matrix.python-version.tox_e }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- {
"python_image": 3.9.23,
"tox_e": "py39, py39-without-extensions, py39-install-extensions, py39-disable-extensions",
}
- {
"python_image": 3.10.18,
"tox_e": "py310, py310-without-extensions, py310-install-extensions, py310-disable-extensions",
}
- {
"python_image": 3.11.13,
"tox_e": "py311, py311-without-extensions, py311-install-extensions, py311-disable-extensions",
}
- {
"python_image": 3.12.11,
"tox_e": "py312, py312-without-extensions, py312-install-extensions, py312-disable-extensions",
}
- {
"python_image": 3.13.7,
"tox_e": "py313, py313-without-extensions, py313-install-extensions, py313-disable-extensions",
}
- {
"python_image": 3.14.0rc2,
"tox_e": "py314, py314-without-extensions, py314-install-extensions, py314-disable-extensions",
}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Setup docker/setup-qemu-action
uses: docker/setup-qemu-action@v3
- name: start python_rv64
run: docker run --platform linux/riscv64 -d --name python_rv64 -v ./:/src python:${{ matrix.python-version.python_image }} bash -c "while true; do sleep 30; done"
- name: show uname
run: docker exec python_rv64 uname -a
- name: setup venv
run: docker exec python_rv64 python -m venv /src/venv
- name: Update pip
run: docker exec python_rv64 bash -c "source /src/venv/bin/activate && python -m pip install -U pip wheel setuptools"
- name: Install tox
run: docker exec python_rv64 bash -c "source /src/venv/bin/activate && python -m pip install 'tox<4.0.0' 'tox-gh-actions<3.0.0'"
- name: Install mypy
run: docker exec python_rv64 bash -c "source /src/venv/bin/activate && python -m pip install 'mypy==1.18.1'"
- name: Test with tox
run: docker exec python_rv64 bash -c "source /src/venv/bin/activate && cd /src && python -m tox -e '${{ matrix.python-version.tox_e }}'"
- name: ls -al
run: ls -al | grep .coverage
- name: Store partial coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version.python_image }}
path: .coverage.*
include-hidden-files: true
test_linux_no_gil:
name: Test - NO GIL (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
matrix:
os:
- ubuntu-latest
python-version:
- 3.13
- 3.14-dev
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Python ${{ matrix.python-version }}
uses: deadsnakes/action@v3.2.0
with:
python-version: ${{ matrix.python-version }}
nogil: true
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install tox
run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
- name: Install mypy
run: python -m pip install "mypy==1.18.1; python_version >= '3.9'"
- name: Test with tox
run: python -m tox
- name: Store partial coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-no-gil-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
test_macos:
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- macos-latest
python-version:
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
- 3.13
- 3.14-dev
- pypy-3.8
- pypy-3.9
- pypy-3.10
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install tox
run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
- name: Install mypy
run: python -m pip install "mypy==1.18.1; python_version >= '3.9'"
- name: Test with tox
run: python -m tox
- name: Store partial coverage reports
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}-${{ matrix.python-version }}
path: .coverage.*
test_windows:
name: Test (${{ matrix.os }}, ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os:
- windows-latest
- windows-11-arm
python-version:
- 3.8
- 3.9
- "3.10"
- 3.11
- 3.12
- 3.13
- 3.14-dev
- pypy-3.8
- pypy-3.9
- pypy-3.10
exclude:
# setup-python only support 3.11+ for windows arm
- os: windows-11-arm
python-version: 3.8
- os: windows-11-arm
python-version: 3.9
- os: windows-11-arm
python-version: "3.10"
- os: windows-11-arm
python-version: pypy-3.8
- os: windows-11-arm
python-version: pypy-3.9
- os: windows-11-arm
python-version: pypy-3.10
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Update pip
run: python -m pip install -U pip wheel setuptools
- name: Install tox
run: python -m pip install "tox<4.0.0" "tox-gh-actions<3.0.0"
- name: Install mypy
run: python -m pip install "mypy==1.18.1; python_version >= '3.9'"
- name: Test with tox
run: python -m tox
sdist:
name: Build source distribution
needs:
- test_linux
- test_macos
- test_windows
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build full source distribution as tar.gz
run: python setup.py sdist
- name: Install the wheel package
run: pip install wheel
- name: Build pure Python source wheel
run: WRAPT_INSTALL_EXTENSIONS=false python setup.py bdist_wheel
- name: Store built wheels
uses: actions/upload-artifact@v4
with:
name: sdist
path: dist/*
bdist_wheel_py38:
name: Build wheels (3.8) on ${{ matrix.os }} for ${{ matrix.arch }}
needs:
- test_linux
- test_linux_no_gil
#- test_aarch64_linux
- test_macos
- test_windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-14]
arch: [auto]
include:
- os: ubuntu-latest
arch: aarch64
- os: macos-13
arch: universal2
- os: macos-14
arch: universal2
steps:
- uses: actions/checkout@v3
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' }}
uses: docker/setup-qemu-action@v2
- name: Build wheels
uses: pypa/cibuildwheel@v3.1.1
with:
output-dir: dist
env:
WRAPT_INSTALL_EXTENSIONS: true
CIBW_SKIP: pp*
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_FREE_THREADED_SUPPORT: 1
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.8,<3.9"
- uses: actions/upload-artifact@v4
with:
name: dist-py3.8-${{ matrix.os }}-${{ matrix.arch }}
path: dist/*.whl
bdist_wheel:
name: Build wheels (3.9+) on ${{ matrix.os }} for ${{ matrix.arch }}
needs:
- test_linux
- test_linux_no_gil
#- test_aarch64_linux
- test_macos
- test_windows
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, windows-11-arm, macos-13, macos-14]
arch: [auto]
include:
- os: ubuntu-latest
arch: aarch64
- os: macos-13
arch: universal2
- os: macos-14
arch: universal2
- os: ubuntu-latest
arch: riscv64
steps:
- uses: actions/checkout@v5
- name: Set up QEMU
if: ${{ matrix.arch == 'aarch64' || matrix.arch == 'riscv64' }}
uses: docker/setup-qemu-action@v3
- name: Build wheels
uses: pypa/cibuildwheel@v3.1.4
with:
output-dir: dist
env:
WRAPT_INSTALL_EXTENSIONS: true
CIBW_BUILD_VERBOSITY: 1
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_ENABLE: cpython-freethreading
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9"
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}
path: dist/*.whl
# coveralls:
# name: Generate code coverage report
# if: ${{ false }} # disable for now
# needs:
# - test_linux
# - test_linux_no_gil
# - test_macos
# - test_windows
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3
# - name: Setup Python 3.9
# uses: actions/setup-python@v4
# with:
# python-version: 3.9
# - name: Install coverage package
# run: python -m pip install -U coverage
# - name: Download partial coverage reports
# uses: actions/download-artifact@v3
# with:
# name: coverage
# - name: Combine coverage
# run: python -m coverage combine
# - name: Report coverage
# run: python -m coverage report
# - name: Export coverage to XML
# run: python -m coverage xml
# - name: Upload coverage statistics to Coveralls
# uses: AndreMiras/coveralls-python-action@develop