Repository navigation
feat(runtime)!: add Scheduler with CURRENT_THREAD and tune low-concurrency I/O #953
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
| # This file is autogenerated by maturin v1.8.2 | |
| # To update, run | |
| # | |
| # maturin generate-ci github | |
| # | |
| name: CI | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| pull_request: | |
| paths-ignore: | |
| - "docs/**" | |
| - "bench/**" | |
| - "*.pyi" | |
| - "*.md" | |
| - "README.md" | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: write | |
| packages: write | |
| id-token: write | |
| env: | |
| MATURIN_VERSION: ${{ vars.MATURIN_VERSION }} | |
| jobs: | |
| style: | |
| name: style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| components: rustfmt, clippy | |
| override: true | |
| - name: Style check | |
| run: cargo fmt --all -- --check | |
| - name: Clippy check | |
| run: cargo clippy --all-targets -- -D warnings | |
| tests: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 30 | |
| services: | |
| httpbin: | |
| image: kennethreitz/httpbin | |
| ports: | |
| - 8080:80 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: 3.x | |
| architecture: ${{ matrix.platform.target }} | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Set up virtual environment | |
| run: | | |
| uv venv | |
| source .venv/bin/activate | |
| - name: Install dependencies | |
| run: | | |
| uv pip install .[test] | |
| uv pip install maturin | |
| # uvloop is optional and can lag a new Python release; never build it from source. | |
| uv pip install --only-binary uvloop uvloop || echo "::warning::no uvloop wheel; skipping uvloop tests" | |
| - name: Build wheels | |
| run: | | |
| source .venv/bin/activate | |
| maturin develop --uv | |
| - name: Run tests | |
| run: | | |
| source .venv/bin/activate | |
| pytest -o faulthandler_timeout=60 | |
| pypy311: | |
| name: PyPy 3.11 (Linux x86_64) | |
| runs-on: ubuntu-latest | |
| services: | |
| httpbin: | |
| image: kennethreitz/httpbin | |
| ports: | |
| - 8080:80 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: pypy3.11 | |
| architecture: x64 | |
| - name: Build wheel | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| rust-toolchain: stable | |
| target: x86_64 | |
| args: --release --out dist --zig --interpreter python --no-default-features --features jemalloc | |
| sccache: "false" | |
| manylinux: auto | |
| container: "off" | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install wheel and test dependencies | |
| run: | | |
| uv venv --python "$pythonLocation/bin/python" .venv-pypy | |
| uv pip install --python .venv-pypy/bin/python dist/*.whl pytest pytest-asyncio pytest-rerunfailures | |
| - name: Verify PyPy wheel | |
| run: | | |
| .venv-pypy/bin/python - <<'PY' | |
| import platform | |
| import sys | |
| import wreq | |
| assert platform.python_implementation() == "PyPy" | |
| assert sys.version_info[:2] == (3, 11) | |
| assert wreq.__name__ == "wreq" | |
| PY | |
| wheel=$(basename dist/*.whl) | |
| case "$wheel" in | |
| *-pp311-*.whl) ;; | |
| *) echo "Expected a pp311 wheel, got: $wheel"; exit 1 ;; | |
| esac | |
| - name: Run tests | |
| timeout-minutes: 15 | |
| run: .venv-pypy/bin/python -u -m pytest -vv -x -o faulthandler_timeout=60 | |
| - name: Upload wheel | |
| if: always() | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-linux-x86_64-pypy311 | |
| path: dist | |
| manylinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build_type: | |
| - name: standard | |
| maturin_args: "--find-interpreter" | |
| - name: free-threaded | |
| maturin_args: "--interpreter 3.14t" | |
| platform: | |
| - runner: ubuntu-latest | |
| target: x86_64 | |
| allocator: jemalloc | |
| apt_packages: "" | |
| custom_env: {} | |
| - runner: ubuntu-latest | |
| target: x86 | |
| allocator: jemalloc | |
| apt_packages: crossbuild-essential-i386 | |
| custom_env: | |
| CC: i686-linux-gnu-gcc | |
| CXX: i686-linux-gnu-g++ | |
| CFLAGS: -msse2 | |
| CXXFLAGS: -msse2 | |
| CFLAGS_i686_unknown_linux_gnu: -msse2 | |
| CXXFLAGS_i686_unknown_linux_gnu: -msse2 | |
| CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER: i686-linux-gnu-g++ | |
| - runner: ubuntu-latest | |
| target: aarch64 | |
| allocator: jemalloc | |
| apt_packages: crossbuild-essential-arm64 | |
| custom_env: | |
| CC: aarch64-linux-gnu-gcc | |
| CXX: aarch64-linux-gnu-g++ | |
| CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-g++ | |
| - runner: ubuntu-latest | |
| target: armv7 | |
| allocator: jemalloc | |
| apt_packages: crossbuild-essential-armhf | |
| custom_env: | |
| CC: arm-linux-gnueabihf-gcc | |
| CXX: arm-linux-gnueabihf-g++ | |
| CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-g++ | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: 3.x | |
| - name: Install target-specific APT dependencies | |
| if: "matrix.platform.apt_packages != ''" | |
| run: sudo apt-get update && sudo apt-get install -y ${{ matrix.platform.apt_packages }} | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| rust-toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| args: ${{ matrix.platform.target == 'x86_64' && '--release --out dist --zig' || '--release --out dist' }} ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator }} | |
| sccache: "false" | |
| manylinux: auto | |
| container: "off" | |
| env: ${{ matrix.platform.custom_env }} | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.build_type.name }} | |
| path: dist | |
| musllinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| environment: MuslLinux | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| build_type: | |
| - name: standard | |
| python-version: "3.11" | |
| cargo_args: "" | |
| - name: free-threaded | |
| python-version: "3.14t" | |
| cargo_args: "--no-default-features" | |
| platform: | |
| - runner: ubuntu-latest | |
| target: x86_64-unknown-linux-musl | |
| allocator: jemalloc | |
| custom_env: {} | |
| - runner: ubuntu-latest | |
| target: aarch64-unknown-linux-musl | |
| allocator: jemalloc | |
| custom_env: {} | |
| - runner: ubuntu-latest | |
| target: armv7-unknown-linux-musleabihf | |
| allocator: jemalloc | |
| custom_env: | |
| # Match Zig's musl time64 ABI, including libc versions before 0.2.187. | |
| RUSTFLAGS: --cfg=libc_unstable_musl_v1_2_3 | |
| RUST_LIBC_UNSTABLE_MUSL_V1_2_3: "1" | |
| CFLAGS_armv7_unknown_linux_musleabihf: -mfpu=vfpv3-d16 | |
| CXXFLAGS_armv7_unknown_linux_musleabihf: -mfpu=vfpv3-d16 | |
| - runner: ubuntu-latest | |
| target: i686-unknown-linux-musl | |
| allocator: jemalloc | |
| custom_env: | |
| RUSTFLAGS: --cfg=libc_unstable_musl_v1_2_3 | |
| RUST_LIBC_UNSTABLE_MUSL_V1_2_3: "1" | |
| CFLAGS_i686_unknown_linux_musl: -msse2 | |
| CXXFLAGS_i686_unknown_linux_musl: -msse2 | |
| env: | |
| # BoringSSL uses Zig's libc++ instead of the old image's libstdc++. | |
| BORING_BSSL_RUST_CPPLIB: c++ | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: ${{ matrix.build_type.python-version }} | |
| - name: Install BoringSSL build dependencies | |
| run: sudo apt-get update && sudo apt-get install -y cmake clang libclang-dev llvm-dev make nasm perl pkg-config | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| rust-toolchain: stable | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist --zig --interpreter ${{ matrix.build_type.python-version }} ${{ matrix.build_type.cargo_args }} --features ${{ matrix.platform.allocator }} | |
| manylinux: musllinux_1_2 | |
| container: "off" | |
| sccache: "false" | |
| env: ${{ matrix.platform.custom_env }} | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-musllinux-${{ matrix.platform.target }}-${{ matrix.build_type.name }} | |
| path: dist | |
| windows: | |
| runs-on: windows-latest | |
| environment: Windows | |
| strategy: | |
| matrix: | |
| build_type: | |
| - name: standard | |
| maturin_args: "" | |
| cargo_args: "" | |
| - name: free-threaded | |
| maturin_args: "--interpreter 3.14t" | |
| cargo_args: "--no-default-features" | |
| platform: | |
| - target: x64 | |
| allocator: mimalloc | |
| python-architecture: x64 | |
| - target: x86 | |
| allocator: mimalloc | |
| python-architecture: x86 | |
| - target: aarch64 | |
| allocator: mimalloc | |
| python-architecture: x64 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: 3.x | |
| architecture: ${{ matrix.platform.python-architecture || 'x64' }} | |
| - name: Install NASM | |
| run: | | |
| choco install nasm -y | |
| shell: cmd | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist ${{ matrix.build_type.maturin_args || '' }} ${{ matrix.build_type.cargo_args }} --features ${{ matrix.platform.allocator || '' }} | |
| sccache: "false" | |
| - name: Rust unit tests | |
| if: matrix.build_type.name == 'standard' && matrix.platform.target == 'x64' | |
| run: cargo test --lib --locked | |
| - name: Event loop tests | |
| if: matrix.build_type.name == 'standard' && matrix.platform.target == 'x64' | |
| timeout-minutes: 10 | |
| shell: bash | |
| run: | | |
| python -m pip install --no-index --find-links dist wreq | |
| python -m pip install pytest pytest-asyncio | |
| python -m pytest -v -o faulthandler_timeout=60 tests/aio_test.py tests/cancellation_test.py tests/upload_test.py tests/runtime_test.py | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-windows-${{ matrix.platform.target }}-${{ matrix.build_type.name }} | |
| path: dist | |
| macos: | |
| runs-on: ${{ matrix.platform.runner }} | |
| environment: MacOS | |
| strategy: | |
| matrix: | |
| build_type: | |
| - name: standard | |
| maturin_args: "--find-interpreter" | |
| - name: free-threaded | |
| maturin_args: "--interpreter 3.14t" | |
| platform: | |
| - runner: macos-latest | |
| target: x86_64 | |
| allocator: jemalloc | |
| - runner: macos-latest | |
| target: aarch64 | |
| allocator: jemalloc | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: 3.x | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator || '' }} | |
| sccache: "false" | |
| - name: Event loop tests | |
| if: matrix.build_type.name == 'standard' && matrix.platform.target == 'aarch64' | |
| timeout-minutes: 10 | |
| run: | | |
| python -m pip install --no-index --find-links dist wreq | |
| python -m pip install pytest pytest-asyncio | |
| python -m pip install --only-binary uvloop uvloop || echo "::warning::no uvloop wheel; skipping uvloop tests" | |
| python -m pytest -v -o faulthandler_timeout=60 tests/aio_test.py tests/cancellation_test.py tests/upload_test.py tests/runtime_test.py | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-macos-${{ matrix.platform.target }}-${{ matrix.build_type.name }} | |
| path: dist | |
| android: | |
| name: Android | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - thing: arm64-android | |
| target: aarch64-linux-android | |
| arch: aarch64 | |
| python_version: 3.14.0 | |
| features: abi3-py314 | |
| - thing: x86_64-android | |
| target: x86_64-linux-android | |
| arch: x86_64 | |
| python_version: 3.14.0 | |
| features: abi3-py314 | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: 3.x | |
| - name: Set Android Linker path | |
| if: endsWith(matrix.thing, '-android') | |
| run: | | |
| LINKER_PATH="$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/$(echo ${{ matrix.target }} | sed s/armv7/armv7a/)21-clang++" | |
| echo "CARGO_TARGET_$(echo ${{ matrix.target }} | tr \\-a-z _A-Z)_LINKER=$LINKER_PATH" >> "$GITHUB_ENV" | |
| echo "$PATH:$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin" >> "$GITHUB_PATH" | |
| env | |
| - name: Download and setup Android Python | |
| run: | | |
| wget https://www.python.org/ftp/python/${{ matrix.python_version }}/python-${{ matrix.python_version }}-${{ matrix.arch }}-linux-android.tar.gz | |
| mkdir -p /tmp/python-android | |
| tar -xzf python-${{ matrix.python_version }}-${{ matrix.arch }}-linux-android.tar.gz -C /tmp/python-android --strip-components=1 | |
| mv /tmp/python-android/prefix/lib /tmp/python-android/ | |
| mv /tmp/python-android/prefix/include /tmp/python-android/ | |
| echo "RUSTFLAGS=-L native=/tmp/python-android/lib" >> "$GITHUB_ENV" | |
| echo "=== Root directory after move ===" | |
| ls -la /tmp/python-android/ | |
| echo "=== Lib directory ===" | |
| ls -la /tmp/python-android/lib/ | head -10 | |
| echo "=== Include directory ===" | |
| ls -la /tmp/python-android/include/ | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| rust-toolchain: stable | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --no-default-features --features ${{ matrix.features }} --skip-auditwheel | |
| sccache: "false" | |
| container: "off" | |
| - name: Fix Android wheel platform tags | |
| run: | | |
| cd dist | |
| for wheel in *.whl; do | |
| case "$wheel" in | |
| *linux_aarch64*) | |
| new_wheel=${wheel/linux_aarch64/android_21_arm64_v8a} | |
| mv "$wheel" "$new_wheel" | |
| echo "Renamed: $wheel -> $new_wheel" | |
| ;; | |
| *linux_x86_64*) | |
| new_wheel=${wheel/linux_x86_64/android_21_x86_64} | |
| mv "$wheel" "$new_wheel" | |
| echo "Renamed: $wheel -> $new_wheel" | |
| ;; | |
| esac | |
| done | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-android-${{ matrix.target }} | |
| path: dist | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| maturin-version: ${{ env.MATURIN_VERSION }} | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: [manylinux, musllinux, windows, macos, android, sdist, tests, pypy311, style] | |
| # Fork PRs get no id-token, so attestation and the publish dry-run can't run there. | |
| if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository | |
| permissions: | |
| # Use to sign the release artifacts | |
| id-token: write | |
| # Used to upload release artifacts | |
| contents: write | |
| # Used to generate artifact attestation | |
| attestations: write | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| - name: Install the latest version of uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v4 | |
| with: | |
| subject-path: "wheels-*/*" | |
| - name: Dry-run publish to PyPI | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| run: uv publish --dry-run wheels-*/* | |
| - name: Publish to PyPI | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| env: | |
| UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| run: uv publish wheels-*/* | |
| - name: Upload binaries to GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
| generate_release_notes: true |