docs: Update projects #36
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 `build-linux-wheels` job of | |
| # https://github.com/wandb/wandb/blob/v0.28.2/.github/workflows/release-sdk.yml | |
| name: Build wandb wheels (riscv64) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version glob to (re)build; empty builds every version of docs/packages/wandb.yaml not released yet' | |
| required: false | |
| default: '' | |
| pull_request: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-wandb.yml' | |
| - 'docs/packages/wandb.yaml' | |
| - 'patches/wandb/**' | |
| push: | |
| branches: [main] | |
| paths: | |
| - '.github/workflows/build-wandb.yml' | |
| - 'docs/packages/wandb.yaml' | |
| - 'patches/wandb/**' | |
| 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 | |
| # Pinned by upstream for reproducible release artifacts; keep in sync with | |
| # RUST_TOOLCHAIN in release-sdk.yml. | |
| RUST_TOOLCHAIN: '1.88.0' | |
| jobs: | |
| setup: | |
| uses: $/.github/workflows/_setup.yml | |
| with: | |
| package: wandb | |
| version: ${{ inputs.version }} | |
| build_wheels: | |
| needs: [setup] | |
| if: needs.setup.outputs.versions != '[]' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| version: ${{ fromJSON(needs.setup.outputs.versions) }} | |
| name: Build wandb ${{ matrix.version }} py3-none-manylinux_riscv64 | |
| runs-on: ubuntu-24.04-riscv | |
| # musllinux is dropped: rustup ships no riscv64 musl host toolchain, and the | |
| # musl wheels additionally need CGO, i.e. a riscv64 musl C toolchain. | |
| env: | |
| WANDB_VERSION: ${{ matrix.version }} | |
| # wandb pulls protobuf and PyYAML at test time; neither publishes riscv64 | |
| # wheels on PyPI. | |
| PIP_EXTRA_INDEX_URL: https://pypi.riseproject.dev/simple/ | |
| steps: | |
| - name: Checkout wandb v${{ env.WANDB_VERSION }} | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| repository: wandb/wandb | |
| ref: v${{ env.WANDB_VERSION }} | |
| persist-credentials: false | |
| - name: Checkout python-wheels | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| with: | |
| path: python-wheels | |
| persist-credentials: false | |
| - name: Patch wandb source | |
| run: git apply python-wheels/patches/wandb/${{ env.WANDB_VERSION }}/*.patch | |
| - name: Build wheels | |
| uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0 | |
| with: | |
| output-dir: wheelhouse/ | |
| # The build hook emits an ABI-independent py3-none-* wheel, so one | |
| # CPython selector covers every interpreter. | |
| only: cp312-manylinux_riscv64 | |
| env: | |
| CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }} | |
| CIBW_BEFORE_ALL_LINUX: > | |
| export DOWNLOAD_GOVERSION=$( grep '^go' core/go.mod | cut -d' ' -f2 ) && | |
| curl -L https://golang.org/dl/go$DOWNLOAD_GOVERSION.linux-riscv64.tar.gz > go.tar.gz && | |
| tar -C /usr/local/ -xzf go.tar.gz && | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | | |
| sh -s -- -y --profile minimal --default-toolchain ${{ env.RUST_TOOLCHAIN }} | |
| # NOTE: the Linux build environment lives in [tool.cibuildwheel.linux] | |
| # in pyproject.toml. Do not set CIBW_ENVIRONMENT_LINUX here: it would | |
| # replace that table, including the PATH entries for Go and cargo. | |
| CIBW_ENVIRONMENT_PASS_LINUX: PIP_EXTRA_INDEX_URL | |
| CIBW_TEST_COMMAND: >- | |
| WANDB_MODE=offline python -c "import wandb; run = wandb.init(); run.finish()" | |
| - name: Check the wheel carries riscv64 Go and Rust binaries | |
| run: | | |
| python3 - wheelhouse/*.whl <<'EOF' | |
| import sys, zipfile | |
| EM_RISCV = 243 | |
| PT_INTERP = 3 | |
| INTERP = "/lib/ld-linux-riscv64-lp64d.so.1" | |
| expected = { | |
| "wandb/bin/wandb-core", | |
| "wandb/bin/wandb-xpu", | |
| "wandb/bin/librust_parquet_ffi.so", | |
| } | |
| def interpreter(blob): | |
| phoff = int.from_bytes(blob[0x20:0x28], "little") | |
| phentsize = int.from_bytes(blob[0x36:0x38], "little") | |
| phnum = int.from_bytes(blob[0x38:0x3A], "little") | |
| for i in range(phnum): | |
| ph = blob[phoff + i * phentsize:][:phentsize] | |
| if int.from_bytes(ph[0:4], "little") != PT_INTERP: | |
| continue | |
| off = int.from_bytes(ph[8:16], "little") | |
| size = int.from_bytes(ph[32:40], "little") | |
| return blob[off:off + size].rstrip(b"\0").decode() | |
| return None | |
| for whl in sys.argv[1:]: | |
| with zipfile.ZipFile(whl) as zf: | |
| names = set(zf.namelist()) | |
| assert expected <= names, sorted(expected - names) | |
| for name in sorted(expected): | |
| blob = zf.read(name) | |
| assert blob[:4] == b"\x7fELF", (name, blob[:4]) | |
| machine = int.from_bytes(blob[18:20], "little") | |
| assert machine == EM_RISCV, (name, machine) | |
| interp = interpreter(blob) | |
| assert interp in (None, INTERP), (name, interp) | |
| print(name, "riscv64 ELF, interpreter:", interp) | |
| print(whl, "ok") | |
| EOF | |
| - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: wandb-${{ env.WANDB_VERSION }}-py3-none-manylinux_riscv64 | |
| path: wheelhouse/*.whl | |
| if-no-files-found: error | |
| publish: | |
| name: Publish wandb ${{ 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: wandb-${{ matrix.version }}-*-manylinux_riscv64 |