refactor(client): replace numeric duration values with datetime.timedelta
#686
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/**' | |
| - 'benchmark/**' | |
| - '*.pyi' | |
| - '*.md' | |
| - '.github/**' | |
| - 'python/**' | |
| - '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 | |
| jobs: | |
| style: | |
| name: style | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - 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 --all-features | |
| tests: | |
| runs-on: ubuntu-latest | |
| services: | |
| httpbin: | |
| image: kennethreitz/httpbin | |
| ports: | |
| - 8080:80 | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| 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 maturin pytest pytest-asyncio pytest-rerunfailures | |
| - name: Build wheels | |
| run: | | |
| source .venv/bin/activate | |
| maturin develop --uv | |
| - name: Run tests | |
| run: | | |
| source .venv/bin/activate | |
| pytest | |
| 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.13t 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++ | |
| 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@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - name: Install LLVM and Clang | |
| uses: KyleMayes/install-llvm-action@v2 | |
| with: | |
| version: "13.0" | |
| - 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: | |
| 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@v5 | |
| with: | |
| name: wheels-linux-${{ matrix.platform.target }}-${{ matrix.build_type.name }} | |
| path: dist | |
| musllinux: | |
| runs-on: ${{ matrix.platform.runner }} | |
| environment: MuslLinux | |
| strategy: | |
| matrix: | |
| build_type: | |
| - name: standard | |
| maturin_args: "--find-interpreter" | |
| - name: free-threaded | |
| maturin_args: "--interpreter 3.13t 3.14t" | |
| platform: | |
| - runner: ubuntu-22.04 | |
| target: x86_64-unknown-linux-musl | |
| allocator: jemalloc | |
| - runner: ubuntu-22.04 | |
| target: aarch64-unknown-linux-musl | |
| allocator: jemalloc | |
| - runner: ubuntu-22.04 | |
| target: armv7-unknown-linux-musleabihf | |
| allocator: jemalloc | |
| - runner: ubuntu-22.04 | |
| target: i686-unknown-linux-musl | |
| allocator: jemalloc | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build wheels | |
| run: | |
| bash .github/musl_build.sh ${{ matrix.platform.target }} "${{ matrix.build_type.maturin_args }}" --features "${{ matrix.platform.allocator }}" | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: wheels-musllinux-${{ matrix.platform.target }}-${{ matrix.build_type.name }} | |
| path: dist | |
| windows: | |
| runs-on: ${{ matrix.platform.runner }} | |
| environment: Windows | |
| strategy: | |
| matrix: | |
| build_type: | |
| - name: standard | |
| maturin_args: "--find-interpreter" | |
| - name: free-threaded | |
| maturin_args: "--interpreter 3.13t 3.14t" | |
| platform: | |
| - runner: windows-latest | |
| target: x64 | |
| allocator: mimalloc | |
| python-architecture: x64 | |
| - runner: windows-latest | |
| target: x86 | |
| allocator: mimalloc | |
| python-architecture: x86 | |
| - runner: windows-latest | |
| target: aarch64 | |
| allocator: mimalloc | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| architecture: ${{ matrix.platform.python-architecture || 'x64' }} | |
| - name: Install NASM | |
| run: | | |
| choco install nasm -y | |
| shell: cmd | |
| - name: Pin some dependencies, temporary patch for cmake breakage | |
| run: | | |
| cargo update --package cmake --precise 0.1.54 | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator || '' }} | |
| sccache: 'false' | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v5 | |
| 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.13t 3.14t" | |
| platform: | |
| - runner: macos-14 | |
| target: x86_64 | |
| allocator: jemalloc | |
| - runner: macos-14 | |
| target: aarch64 | |
| allocator: jemalloc | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.x | |
| - uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| override: true | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.platform.target }} | |
| args: --release --out dist ${{ matrix.build_type.maturin_args }} --features ${{ matrix.platform.allocator || '' }} | |
| sccache: 'false' | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v5 | |
| 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@v6 | |
| - uses: actions/setup-python@v6 | |
| 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: | |
| 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@v5 | |
| with: | |
| name: wheels-android-${{ matrix.target }} | |
| path: dist | |
| sdist: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| - name: Upload sdist | |
| uses: actions/upload-artifact@v5 | |
| with: | |
| name: wheels-sdist | |
| path: dist | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| if: ${{ startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch' }} | |
| needs: [manylinux, musllinux, windows, macos, android, sdist, tests, style] | |
| 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@v6 | |
| - name: Generate artifact attestation | |
| uses: actions/attest-build-provenance@v3 | |
| with: | |
| subject-path: 'wheels-*/*' | |
| - name: Publish to PyPI | |
| if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
| uses: PyO3/maturin-action@v1 | |
| env: | |
| MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }} | |
| with: | |
| command: upload | |
| args: --non-interactive --skip-existing wheels-*/* | |
| - name: Upload binaries to GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| prerelease: ${{ contains(github.ref, 'alpha') || contains(github.ref, 'beta') }} | |
| generate_release_notes: true |