ci: drop pypy support, fix mkdocstrings-python v2 config #360
Workflow file for this run
This file contains hidden or 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: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '**' | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| - closed | |
| concurrency: | |
| group: ${{ github.workflow }}/${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| coverage: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: install rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Install cargo-llvm-cov | |
| uses: taiki-e/install-action@cargo-llvm-cov | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: coverage-cargo-ubuntu | |
| continue-on-error: true | |
| - name: Run bindings coverage | |
| run: | | |
| cd bindings | |
| uv sync --group dev | |
| source .venv/bin/activate | |
| source <(cargo llvm-cov show-env --export-prefix) | |
| export CARGO_TARGET_DIR=$CARGO_LLVM_COV_TARGET_DIR | |
| export CARGO_INCREMENTAL=1 | |
| cargo llvm-cov clean --workspace | |
| cargo check | |
| cargo test | |
| uv run maturin develop | |
| uv run pytest tests --cov=powerboxes --cov-report xml -m "not benchmark" | |
| cargo llvm-cov report --lcov --output-path coverage-bindings.lcov | |
| - name: Run powerboxesrs coverage | |
| run: | | |
| cd powerboxesrs | |
| source <(cargo llvm-cov show-env --export-prefix) | |
| export CARGO_TARGET_DIR=$CARGO_LLVM_COV_TARGET_DIR | |
| cargo llvm-cov clean --workspace | |
| cargo check | |
| cargo test | |
| cargo llvm-cov report --lcov --output-path coverage.lcov | |
| - uses: codecov/codecov-action@v4 | |
| env: | |
| TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| with: | |
| files: coverage.lcov, coverage-bindings.lcov,coverage.xml | |
| name: ubuntu | |
| test-python: | |
| name: test ${{ matrix.python-version }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: | |
| - '3.9' | |
| - '3.10' | |
| - '3.11' | |
| - '3.12' | |
| - '3.13' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: install rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: cache rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: test-v4 | |
| - name: set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: install and test | |
| run: | | |
| cd bindings | |
| uv sync --group dev | |
| uv run maturin develop | |
| uv run pytest tests -m "not benchmark" | |
| test-os: | |
| name: test on ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu, macos, windows] | |
| runs-on: ${{ matrix.os }}-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: install rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: cache rust | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| key: ${{ matrix.os }}-v2 | |
| - name: set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - name: install and test | |
| run: | | |
| cd bindings | |
| uv sync --group dev | |
| uv run maturin develop | |
| uv run pytest tests -m "not benchmark" | |
| - run: cd powerboxesrs && cargo test | |
| # https://github.com/marketplace/actions/alls-green#why used for branch protection checks | |
| check: | |
| if: always() | |
| needs: [coverage, test-python, test-os] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Decide whether the needed jobs succeeded or failed | |
| uses: re-actors/alls-green@release/v1 | |
| with: | |
| jobs: ${{ toJSON(needs) }} | |
| allowed-failures: coverage | |
| build-sdist: | |
| name: build sdist | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| rust-toolchain: stable | |
| working-directory: bindings | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pypi_files_sdist | |
| path: bindings/dist | |
| build: | |
| name: build on ${{ matrix.os }} (${{ matrix.target }} - ${{ matrix.interpreter || 'all' }}${{ matrix.os == 'linux' && format(' - {0}', matrix.manylinux == 'auto' && 'manylinux' || matrix.manylinux) || '' }}) | |
| # only run on push to main and on release | |
| if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [linux, macos, windows] | |
| target: [x86_64, aarch64] | |
| manylinux: [auto] | |
| include: | |
| - os: linux | |
| manylinux: auto | |
| target: i686 | |
| - os: linux | |
| manylinux: auto | |
| target: aarch64 | |
| - os: linux | |
| manylinux: auto | |
| target: armv7 | |
| interpreter: 3.9 3.10 3.11 3.12 3.13 | |
| - os: linux | |
| manylinux: auto | |
| target: ppc64le | |
| interpreter: 3.9 3.10 3.11 3.12 3.13 | |
| - os: linux | |
| manylinux: auto | |
| target: s390x | |
| interpreter: 3.9 3.10 3.11 3.12 3.13 | |
| # musllinux | |
| - os: linux | |
| manylinux: musllinux_1_1 | |
| target: x86_64 | |
| - os: linux | |
| manylinux: musllinux_1_1 | |
| target: aarch64 | |
| # macos | |
| - os: macos | |
| target: x86_64 | |
| - os: macos | |
| target: aarch64 | |
| interpreter: 3.9 3.10 3.11 3.12 3.13 | |
| # windows | |
| - os: windows | |
| target: x86_64 | |
| interpreter: 3.9 3.10 3.11 3.12 3.13 | |
| - os: windows | |
| target: i686 | |
| python-architecture: x86 | |
| interpreter: 3.9 3.10 3.11 3.12 3.13 | |
| exclude: | |
| - os: windows | |
| target: aarch64 | |
| runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| architecture: ${{ matrix.python-architecture || 'x64' }} | |
| - run: pip install -U twine | |
| - name: build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| manylinux: ${{ matrix.manylinux == 'manylinux' && 'auto' || matrix.manylinux }} | |
| args: --release --out dist --interpreter ${{ matrix.interpreter || '3.9 3.10 3.11 3.12 3.13' }} | |
| rust-toolchain: stable | |
| docker-options: -e CI | |
| working-directory: bindings | |
| - run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} bindings/dist/ | |
| - run: twine check --strict bindings/dist/* | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pypi_files-${{ matrix.os }}-${{ matrix.target }}-${{ matrix.interpreter || 'all' }}-${{ matrix.manylinux }} | |
| path: bindings/dist | |
| build-pgo: | |
| name: build pgo-optimized on ${{ matrix.os }} / ${{ matrix.interpreter }} | |
| # only run on push to main and on release | |
| if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main' || contains(github.event.pull_request.labels.*.name, 'Full Build') | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [linux, windows, macos] | |
| interpreter: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
| include: | |
| - os: linux | |
| runs-on: ubuntu-latest | |
| - os: windows | |
| ls: dir | |
| runs-on: windows-latest | |
| - os: macos | |
| runs-on: macos-latest | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: astral-sh/setup-uv@v5 | |
| - name: set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.interpreter }} | |
| - name: install rust stable | |
| id: rust-toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools | |
| - run: rustc --version --verbose | |
| - name: build initial wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| manylinux: auto | |
| args: > | |
| --release | |
| --out pgo-wheel | |
| --interpreter ${{ matrix.interpreter }} | |
| rust-toolchain: stable | |
| docker-options: -e CI | |
| working-directory: bindings | |
| env: | |
| RUSTFLAGS: "-Cprofile-generate=${{ github.workspace }}/profdata" | |
| - name: detect rust host | |
| run: echo RUST_HOST=$(rustc -Vv | grep host | cut -d ' ' -f 2) >> "$GITHUB_ENV" | |
| shell: bash | |
| - name: generate pgo data | |
| run: | | |
| cd bindings | |
| uv sync --group dev | |
| uv pip install powerboxes --no-index --no-deps --find-links pgo-wheel --force-reinstall | |
| uv run pytest tests/test_speed.py | |
| rustup run stable bash -c 'echo LLVM_PROFDATA=$RUSTUP_HOME/toolchains/$RUSTUP_TOOLCHAIN/lib/rustlib/${{ env.RUST_HOST }}/bin/llvm-profdata >> "$GITHUB_ENV"' | |
| - name: merge pgo data | |
| run: ${{ env.LLVM_PROFDATA }} merge -o ${{ github.workspace }}/merged.profdata ${{ github.workspace }}/profdata | |
| - name: build pgo-optimized wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| manylinux: auto | |
| args: > | |
| --release | |
| --out dist | |
| --interpreter ${{ matrix.interpreter }} | |
| rust-toolchain: stable | |
| docker-options: -e CI | |
| working-directory: bindings | |
| env: | |
| RUSTFLAGS: "-Cprofile-use=${{ github.workspace }}/merged.profdata" | |
| - run: ${{ matrix.ls || 'ls -lh' }} bindings/dist/ | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: pypi_files_pgo-${{ matrix.os }}-${{ matrix.interpreter }} | |
| path: bindings/dist | |
| release: | |
| needs: [build, build-pgo, build-sdist, check] | |
| if: success() && startsWith(github.ref, 'refs/tags/') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: set up python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.12' | |
| - run: pip install -U twine | |
| - name: get dist artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: pypi_files-* | |
| merge-multiple: true | |
| path: bindings/dist | |
| - name: get sdist artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pypi_files_sdist | |
| path: bindings/dist | |
| - name: get PGO dist artifacts (overrides non-PGO builds) | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: pypi_files_pgo-* | |
| merge-multiple: true | |
| path: bindings/dist | |
| - run: twine check --strict bindings/dist/* | |
| - name: upload to pypi | |
| run: twine upload bindings/dist/* | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |