Skip to content

Bump pyo3 from 0.20.3 to 0.21.0 #200

Bump pyo3 from 0.20.3 to 0.21.0

Bump pyo3 from 0.20.3 to 0.21.0 #200

Workflow file for this run

# Builds on all branches & PRs
# Deploys to PyPi on new tags.
name: Build, test and publish
on: [ push, pull_request ]
jobs:
test:
runs-on: ubuntu-20.04
name: Runs tests
strategy:
fail-fast: false
matrix:
python-version: [ "3.7", "3.8", "3.9", "3.10", "3.11" , "3.12" ]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Test with tox
run: tox
env:
RUSTUP_TOOLCHAIN: stable
- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Pytest Test Results (Python ${{ matrix.python-version }})
path: pytest.xml
publish-test-results:
name: "Publish Unit Tests Results"
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
files: artifacts/**/*.xml
build_linux:
needs: test
runs-on: ubuntu-latest
name: Linux Wheels
steps:
# For tags we assume the version in pyproject.toml is correct!
- name: Checkout
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
sed -E -i -e "s/version\s*=\s*\"(.*)(\.rc.*|\.a.*|\.post.*)?\"/version = \"\1.dev0+${GITHUB_SHA::8}\"/;" pyproject.toml
- name: Note version
run: |
PACKAGE_VERSION=$(grep "version" ./pyproject.toml | tr -d '"' | awk -F' ' '{print $3}')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
- name: Install cibuildwheel
run: python -m pip install cibuildwheel
- name: Build wheels
run: python -m cibuildwheel --output-dir dist
env:
CIBW_SKIP: "*musllinux*"
CIBW_BEFORE_ALL_LINUX: "curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain stable -y"
CIBW_ENVIRONMENT_LINUX: 'PATH="$PATH:$HOME/.cargo/bin"'
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-linux
path: dist/*.whl
build_macos_windows:
needs: test
runs-on: ${{ matrix.os }}
name: Mac/Win Wheel
strategy:
fail-fast: false
matrix:
os: [ macos-11, windows-2019 ]
python-version: [ '3.7', '3.8', '3.9', '3.10', '3.11', '3.12' ]
arch: [ 'x64', 'x86' ]
exclude:
- os: macos-11
arch: 'x86'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/') && matrix.os == 'macos-11'"
shell: bash
run: |
sed -E -i '' -e "s/version\s*=\s*\"(.*)(\.rc.*|\.a.*|\.post.*)?\"/version = \"\1.dev0+${GITHUB_SHA::8}\"/;" pyproject.toml
- name: Rewrite version for dev if not tag
if: "!startsWith(github.ref, 'refs/tags/') && matrix.os != 'macos-11'"
shell: bash
run: |
sed -E -i -e "s/version\s*=\s*\"(.*)(\.rc.*|\.a.*|\.post.*)?\"/version = \"\1.dev0+${GITHUB_SHA::8}\"/;" pyproject.toml
- name: Note version
shell: bash
run: |
PACKAGE_VERSION=$(grep "version" ./pyproject.toml | tr -d '"' | awk -F' ' '{print $3}')
echo "PACKAGE_VERSION=$PACKAGE_VERSION" >> $GITHUB_ENV
- name: Setup Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
target: "${{ matrix.os == 'windows-2019' && 'i686-pc-windows-msvc' || 'x86_64-apple-darwin' }}"
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: ${{ matrix.arch }}
- name: Upgrade pip, install dev dependencies
run: |
python -m pip install --upgrade pip wheel build
python -m pip install -r requirements.txt
- name: Build Python wheels
run: |
python -m build
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}-py${{ matrix.python-version }}-${{ matrix.arch }}
path: dist/*.whl
deploy:
if: startsWith(github.ref, 'refs/tags/')
needs:
- build_linux
- build_macos_windows
runs-on: ubuntu-latest
name: Deploy wheels to PyPI
steps:
- name: Download wheels
uses: actions/download-artifact@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Upgrade pip
run: |
python -m pip install --upgrade pip
pip install twine
- name: Publish wheels to PyPI
env:
TWINE_USERNAME: ${{ secrets.TWINE_USR }}
TWINE_PASSWORD: ${{ secrets.TWINE_PSW }}
run: |
twine upload wheels-linux/*manylinux*.whl wheels-windows*/*.whl wheels-macos*/*.whl