docs: Update projects (#2194) #30
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
| # SPDX-FileCopyrightText: 2026 The RISE Project | |
| # SPDX-License-Identifier: MIT | |
| --- | |
| # This workflow is based on the `test-python-coverage`/`test-python` jobs of | |
| # https://github.com/pydantic/monty/blob/v0.0.21/.github/workflows/ci.yml | |
| name: Build pydantic-monty-client wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/pydantic-monty-client.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-pydantic-monty-client.yml' | |
| - 'docs/packages/pydantic-monty-client.yaml' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-pydantic-monty-client.yml' | |
| - 'docs/packages/pydantic-monty-client.yaml' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read # to fetch code (actions/checkout) | |
| env: | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: pydantic-monty-client | |
| version: ${{ inputs.version }} | |
| build_wheels: | |
| needs: [setup] | |
| if: needs.setup.outputs.versions != '[]' | |
| name: Build pydantic-monty-client ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| timeout-minutes: 360 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| # No abi3 feature on pyo3 in Cargo.toml, so upstream ships one wheel | |
| # per interpreter (matches PyPI's cp3xx-cp3xx tags). | |
| python: ["cp312", "cp313", "cp314", "cp314t"] | |
| env: | |
| MONTY_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout monty ${{ env.MONTY_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: pydantic/monty | |
| ref: v${{ env.MONTY_VERSION }} | |
| persist-credentials: false | |
| # `crates/monty-python`'s pyproject.toml has no `license-files`, so | |
| # maturin's default LICEN[CS]E* glob only looks next to it -- the repo's | |
| # actual LICENSE lives at the workspace root (gotcha 146). Upstream's own | |
| # published wheel has the same gap (no LICENSE in its dist-info); copy it | |
| # in so ours doesn't. | |
| - name: Copy LICENSE next to the crate's pyproject.toml | |
| run: cp LICENSE crates/monty-python/LICENSE | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| package-dir: crates/monty-python | |
| output-dir: wheelhouse/ | |
| env: | |
| CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # monty ships no [tool.cibuildwheel]: install the Rust toolchain, | |
| # then build the `monty` worker binary the test suite spawns as a | |
| # subprocess (mirrors upstream's own `maturin develop -m | |
| # crates/monty-runtime/Cargo.toml` step ahead of `pytest`). | |
| CIBW_BEFORE_ALL_LINUX: >- | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && | |
| PATH="$PATH:$HOME/.cargo/bin" cargo build --release --locked -p monty-runtime && | |
| cp target/release/monty /usr/local/bin/monty | |
| # `tests/test_threading.py` skips itself under `'CI' in os.environ` | |
| # (its own comment: GitHub-hosted runners have one CPU) -- cibuildwheel | |
| # does not forward the host's `CI` var into the container, so without | |
| # this the timing-sensitive module runs and flakes on a shared runner. | |
| CIBW_ENVIRONMENT_LINUX: PATH="$PATH:$HOME/.cargo/bin" CI=true | |
| CIBW_TEST_REQUIRES: >- | |
| anyio>=4.0 dirty-equals>=0.11 inline-snapshot>=0.31.1 | |
| opentelemetry-proto>=1.0.0 opentelemetry-sdk>=1.39.0 | |
| pytest>=9.0.2 pytest-pretty>=1.3.0 | |
| CIBW_TEST_SOURCES: crates/monty-python/tests crates/monty-python/pyproject.toml | |
| # test_readme_examples.py needs `ruff` (via pytest-examples) and | |
| # test_websocket.py needs `websockets`; neither has a riscv64 wheel | |
| # on this registry and porting them is out of scope here. | |
| CIBW_TEST_COMMAND: >- | |
| python -c "import pydantic_monty._monty as n; assert n.__file__.endswith('.so'), n.__file__" && | |
| python -m pytest -v crates/monty-python/tests | |
| --ignore=crates/monty-python/tests/test_readme_examples.py | |
| --ignore=crates/monty-python/tests/test_websocket.py | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: pydantic-monty-client-${{ env.MONTY_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish pydantic-monty-client ${{ matrix.version }} | |
| needs: [setup, build_wheels] | |
| if: needs.setup.outputs.versions != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| uses: $/.github/workflows/_publish-wheel.yml | |
| secrets: | |
| app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} | |
| with: | |
| artifact-pattern: pydantic-monty-client-${{ matrix.version }}-*-manylinux_riscv64 |