|
| 1 | +# SPDX-FileCopyrightText: 2026 The RISE Project |
| 2 | +# SPDX-License-Identifier: MIT |
| 3 | + |
| 4 | +# This workflow follows upstream's own fiftyone-db release process: |
| 5 | +# https://github.com/voxel51/fiftyone/blob/main/.github/workflows/build-db.yml |
| 6 | +# which releases from db-v<version> tags and builds one wheel per platform |
| 7 | +# directly with `python -m build`, no interpreter matrix (the wheel is |
| 8 | +# tagged py3-none-<platform> and carries no compiled extension of its own). |
| 9 | +# Upstream's own workflow has no Linux leg at all - every Linux install |
| 10 | +# today builds the sdist locally, since the unpatched CustomBdistWheel |
| 11 | +# produces an invalid "linux-<arch>" tag for any arch it doesn't special-case. |
| 12 | +name: Build fiftyone-db wheels (riscv64) |
| 13 | + |
| 14 | +on: |
| 15 | + workflow_dispatch: |
| 16 | + inputs: |
| 17 | + version: |
| 18 | + description: 'Version glob to (re)build; empty builds every version of docs/packages/fiftyone-db.yaml not released yet' |
| 19 | + required: false |
| 20 | + default: '' |
| 21 | + pull_request: |
| 22 | + branches: [main] |
| 23 | + paths: |
| 24 | + - '.github/workflows/build-fiftyone-db.yml' |
| 25 | + - 'docs/packages/fiftyone-db.yaml' |
| 26 | + - 'patches/fiftyone-db/**' |
| 27 | + push: |
| 28 | + branches: [main] |
| 29 | + paths: |
| 30 | + - '.github/workflows/build-fiftyone-db.yml' |
| 31 | + - 'docs/packages/fiftyone-db.yaml' |
| 32 | + - 'patches/fiftyone-db/**' |
| 33 | + |
| 34 | +concurrency: |
| 35 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 36 | + cancel-in-progress: true |
| 37 | + |
| 38 | +permissions: |
| 39 | + contents: read |
| 40 | + |
| 41 | +env: |
| 42 | + MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64 |
| 43 | + |
| 44 | +jobs: |
| 45 | + setup: |
| 46 | + uses: $/.github/workflows/_setup.yml |
| 47 | + with: |
| 48 | + package: fiftyone-db |
| 49 | + version: ${{ inputs.version }} |
| 50 | + |
| 51 | + build_wheels: |
| 52 | + needs: [setup] |
| 53 | + if: needs.setup.outputs.versions != '[]' |
| 54 | + name: Build fiftyone-db ${{ matrix.version }} py3-none-manylinux_riscv64 |
| 55 | + runs-on: ubuntu-24.04-riscv |
| 56 | + timeout-minutes: 60 |
| 57 | + strategy: |
| 58 | + fail-fast: false |
| 59 | + matrix: |
| 60 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 61 | + env: |
| 62 | + FIFTYONE_DB_VERSION: ${{ matrix.version }} |
| 63 | + |
| 64 | + steps: |
| 65 | + - name: Checkout fiftyone db-v${{ env.FIFTYONE_DB_VERSION }} |
| 66 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 67 | + with: |
| 68 | + repository: voxel51/fiftyone |
| 69 | + ref: db-v${{ env.FIFTYONE_DB_VERSION }} |
| 70 | + path: fiftyone |
| 71 | + persist-credentials: false |
| 72 | + |
| 73 | + - name: Checkout python-wheels |
| 74 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 75 | + with: |
| 76 | + path: python-wheels |
| 77 | + persist-credentials: false |
| 78 | + |
| 79 | + - name: Apply patches |
| 80 | + # git -C changes git's own cwd, but the shell still expands this |
| 81 | + # glob relative to $GITHUB_WORKSPACE (where fiftyone/ and |
| 82 | + # python-wheels/ are siblings) before git ever sees it, so the |
| 83 | + # patch path is relative to there, not to -C's target. |
| 84 | + run: git -C fiftyone apply $PWD/python-wheels/patches/fiftyone-db/${{ env.FIFTYONE_DB_VERSION }}/*.patch |
| 85 | + |
| 86 | + - name: Build wheel, check its tag/contents, and smoke-test install |
| 87 | + # All three steps run inside the manylinux image, not the bare |
| 88 | + # runner: the runner's own python/pip is a different glibc baseline |
| 89 | + # than manylinux_2_39, and pip's platform-tag compatibility check |
| 90 | + # rejects the wheel as "not a supported wheel on this platform" |
| 91 | + # outside the image it was tagged for. |
| 92 | + env: |
| 93 | + RELEASE_VERSION: ${{ env.FIFTYONE_DB_VERSION }} |
| 94 | + run: | |
| 95 | + set -eux |
| 96 | + mkdir -p wheelhouse |
| 97 | + docker run --rm -i \ |
| 98 | + -v "${GITHUB_WORKSPACE}:/work" -w /work/fiftyone/package/db \ |
| 99 | + -e RELEASE_VERSION \ |
| 100 | + "${MANYLINUX_RISCV64_IMAGE}" \ |
| 101 | + bash <<'SCRIPT' |
| 102 | + set -eux |
| 103 | + PYTHON_BIN=/opt/python/cp312-cp312/bin/python |
| 104 | + "${PYTHON_BIN}" -m pip install -q -U pip build |
| 105 | + "${PYTHON_BIN}" -Im build --wheel |
| 106 | + cp dist/*.whl /work/wheelhouse/ |
| 107 | +
|
| 108 | + wheel=$(ls /work/wheelhouse/*.whl) |
| 109 | + case "$wheel" in |
| 110 | + *-py3-none-manylinux_2_39_riscv64.whl) ;; |
| 111 | + *) echo "unexpected wheel tag: $wheel"; exit 1 ;; |
| 112 | + esac |
| 113 | + "${PYTHON_BIN}" -m zipfile -l "$wheel" |
| 114 | + # MongoDB ships no riscv64 binary (gotcha: see patches/fiftyone-db's |
| 115 | + # Upstream-Status), so the wheel must NOT contain mongod - only the |
| 116 | + # empty bin/ dir fiftyone.db expects to find at runtime. |
| 117 | + if "${PYTHON_BIN}" -m zipfile -l "$wheel" | grep -q 'fiftyone/db/bin/mongod'; then |
| 118 | + echo "wheel unexpectedly bundles a mongod binary" |
| 119 | + exit 1 |
| 120 | + fi |
| 121 | +
|
| 122 | + "${PYTHON_BIN}" -m venv /tmp/venv |
| 123 | + /tmp/venv/bin/pip install -q "$wheel" |
| 124 | + /tmp/venv/bin/python -c " |
| 125 | + import fiftyone.db |
| 126 | + print('fiftyone.db imports ok; bin dir:', fiftyone.db.FIFTYONE_DB_BIN_DIR) |
| 127 | + " |
| 128 | + SCRIPT |
| 129 | +
|
| 130 | + - uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 |
| 131 | + with: |
| 132 | + name: fiftyone-db-${{ env.FIFTYONE_DB_VERSION }}-py3-none-manylinux_riscv64 |
| 133 | + path: wheelhouse/*.whl |
| 134 | + if-no-files-found: error |
| 135 | + |
| 136 | + publish: |
| 137 | + name: Publish fiftyone-db ${{ matrix.version }} |
| 138 | + needs: [setup, build_wheels] |
| 139 | + if: needs.setup.outputs.versions != '[]' |
| 140 | + strategy: |
| 141 | + fail-fast: false |
| 142 | + matrix: |
| 143 | + version: ${{ fromJSON(needs.setup.outputs.versions) }} |
| 144 | + permissions: |
| 145 | + contents: write |
| 146 | + pull-requests: write |
| 147 | + uses: $/.github/workflows/_publish-wheel.yml |
| 148 | + secrets: |
| 149 | + app-private-key: ${{ secrets.RISEPROJECT_APP_PRIVATE_KEY }} |
| 150 | + with: |
| 151 | + artifact-pattern: fiftyone-db-${{ matrix.version }}-py3-none-manylinux_riscv64 |
0 commit comments