workflows: build-grpcio: add #3
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: Build grpcio wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'grpcio version to build (git tag without leading v, e.g. 1.78.0)' | |
| required: true | |
| default: '1.78.0' | |
| pull_request: | |
| paths: | |
| - '.github/workflows/build-grpcio.yml' | |
| - 'patches/grpcio/**' | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ inputs.version || '1.78.0' }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| GRPCIO_VERSION: ${{ inputs.version || '1.78.0' }} | |
| UV_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ | |
| UV_INDEX_STRATEGY: unsafe-best-match | |
| UV_ONLY_BINARY: ':all:' | |
| MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 | |
| jobs: | |
| build_wheels: | |
| name: Build grpcio ${{ inputs.version || '1.78.0' }} ${{ matrix.python }}-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # grpcio doesn't advertise free-threaded support yet | |
| # (src/python/grpcio/python_version.py lists only 3.10-3.14), so | |
| # 3.14t is dropped from the usual default matrix. | |
| # See also: https://github.com/grpc/grpc/issues/38762 | |
| python: ["cp312", "cp313", "cp314"] | |
| steps: | |
| - name: Checkout grpc v${{ env.GRPCIO_VERSION }} | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| repository: grpc/grpc | |
| ref: v${{ env.GRPCIO_VERSION }} | |
| submodules: true | |
| persist-credentials: false | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| # install_all_python_modules.sh (run below via CIBW_TEST_COMMAND) would | |
| # otherwise reinstall grpcio from source before testing, rather than | |
| # testing the wheel this job just built. | |
| - name: Patch grpc source | |
| run: git apply python-wheels/patches/grpcio/${{ env.GRPCIO_VERSION }}/00*.patch | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@294735312765b09d24a2fbec22660ce817587d55 # v4.1.0 | |
| env: | |
| CIBW_BUILD: ${{ matrix.python }}-manylinux_riscv64 | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| # Enables grpc's optional systemd socket-activation feature (see | |
| # src/python/grpcio/README.rst); needs libsystemd-devel present. | |
| CIBW_ENVIRONMENT: GRPC_PYTHON_BUILD_WITH_SYSTEMD=1 | |
| CIBW_BEFORE_ALL: dnf install -y systemd-devel | |
| CIBW_BEFORE_BUILD: pip install -r requirements.txt | |
| CIBW_REPAIR_WHEEL_COMMAND: auditwheel repair --strip -w {dest_dir} {wheel} | |
| CIBW_TEST_REQUIRES: setuptools | |
| CIBW_TEST_COMMAND: >- | |
| cd {project}/tools/distrib && | |
| PIP_NO_BUILD_ISOLATION=0 ./install_all_python_modules.sh && | |
| cd {project}/src && python python/grpcio_tests/setup.py test_lite | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: grpcio-${{ env.GRPCIO_VERSION }}-${{ matrix.python }}-manylinux_riscv64 | |
| path: ./wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish grpcio ${{ inputs.version || '1.78.0' }} to GitLab | |
| needs: [build_wheels] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Publish wheels and open docs PR | |
| uses: riseproject-dev/python-wheels/actions/publish-wheels@main | |
| with: | |
| artifact-pattern: grpcio-${{ env.GRPCIO_VERSION }}-*-manylinux_riscv64 | |
| gitlab-username: ${{ vars.GITLAB_DEPLOY_USER }} | |
| gitlab-token: ${{ secrets.GITLAB_DEPLOY_TOKEN }} | |
| gitlab-project-id: ${{ vars.GITLAB_PROJECT_ID }} | |
| gh-token: ${{ secrets.GITHUB_TOKEN }} |