docs: Update projects #34
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 | |
| --- | |
| # Based on the `build-wheels` job of | |
| # https://github.com/WorksApplications/sudachi.rs/blob/v0.7.0/.github/workflows/build-python-wheels.yml | |
| # 0.7.0 switched the python/ build from setuptools-rust to maturin, whose | |
| # pyo3 dependency now enables the "abi3-py310" feature (python/Cargo.toml): | |
| # one cp310 wheel loads on every newer non-free-threaded CPython, so the | |
| # matrix collapses to it plus the separate free-threaded cp314t build | |
| # (CLAUDE.md gotcha 11), same shape as build-apache-tvm-ffi.yml. | |
| name: Build sudachipy wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/sudachipy.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-sudachipy.yml' | |
| - 'docs/packages/sudachipy.yaml' | |
| - 'patches/sudachipy/**' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-sudachipy.yml' | |
| - 'docs/packages/sudachipy.yaml' | |
| - 'patches/sudachipy/**' | |
| 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: sudachipy | |
| version: ${{ inputs.version }} | |
| build_wheels: | |
| needs: [setup] | |
| if: needs.setup.outputs.versions != '[]' | |
| name: Build sudachipy ${{ matrix.version }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| timeout-minutes: 90 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| python: ["cp310", "cp314t"] | |
| include: | |
| # tokenizers has no free-threaded wheel anywhere (abi3-only); its sdist | |
| # build is unproven here, so drop just the one test module that needs it. | |
| - python: "cp314t" | |
| drop_pretokenizer_test: "rm tests/test_pretokenizers.py &&" | |
| test_requires: 'sudachidict_core' | |
| env: | |
| SUDACHIPY_VERSION: ${{ matrix.version }} | |
| steps: | |
| - name: Checkout sudachi.rs ${{ env.SUDACHIPY_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: WorksApplications/sudachi.rs | |
| ref: v${{ env.SUDACHIPY_VERSION }} | |
| persist-credentials: false | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| - name: Patch sudachi.rs source | |
| run: git apply python-wheels/patches/sudachipy/${{ env.SUDACHIPY_VERSION }}/*.patch | |
| - name: Build and test wheel | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| package-dir: . | |
| env: | |
| CIBW_ARCHS: riscv64 | |
| CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 | |
| CIBW_SKIP: '*-musllinux_*' # rustup.rs has no riscv64 musl toolchain | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # cibuildwheel's audit step needs a host `uv`, which the self-hosted | |
| # runner doesn't have; override upstream's build-frontend = "build[uv]" | |
| # (CLAUDE.md gotcha 13). | |
| CIBW_BUILD_FRONTEND: build | |
| # No Rust in the manylinux image; install it and put cargo on PATH. Skips | |
| # upstream's PGO before-all (external corpus download + release build of | |
| # sudachi-cli), which would otherwise re-run once per matrix leg here. | |
| CIBW_BEFORE_ALL_LINUX: >- | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| CIBW_ENVIRONMENT: PATH="$PATH:$HOME/.cargo/bin" PIP_EXTRA_INDEX_URL=https://pypi.riseproject.dev/simple/ | |
| # pypi.riseproject.dev's newest tokenizers (0.22.2) is behind PyPI's | |
| # (0.23.2, no riscv64 wheel); pin so pip resolves to ours. | |
| CIBW_TEST_REQUIRES: ${{ matrix.test_requires || 'tokenizers==0.22.2 sudachidict_core' }} | |
| # Upstream's own build_and_test.sh test command, run against {package} | |
| # (gotcha 5) since cibuildwheel tests from an empty scratch directory. | |
| CIBW_TEST_COMMAND: >- | |
| bash -c "cd {package}/python && ${{ matrix.drop_pretokenizer_test }} python -m unittest discover -s tests -v" | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: sudachipy-${{ env.SUDACHIPY_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish sudachipy ${{ 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: sudachipy-${{ matrix.version }}-*-manylinux_riscv64 |