Skip to content

Commit 7c5ed99

Browse files
authored
livekit-blingfire: add build-livekit-blingfire.yml for riscv64 wheels (#1731)
* **Package**: `livekit-blingfire` * **Version**: `1.1.0` * **Source**: https://github.com/livekit/agents (monorepo, `livekit-plugins/livekit-blingfire`) * **Docs**: https://github.com/livekit/agents Compiles a pybind11 binding over Microsoft's BlingFire finite-state-transducer tokenizer into a wheel. Upstream publishes no riscv64 wheel. Mirrors [upstream's now-removed `build_blingfire` job](https://github.com/livekit/agents/blob/3bea770e545b7aa02c2c34cf8f8d8022e5fbd1ed/.github/workflows/build.yml), from the last commit before the package moved out of this monorepo. **Differs from upstream** - No git tag exists for 1.1.0 - pinned to the commit that bumped the version and matches the published wheels' upload timestamps. - Stages `LICENSE`/BlingFire's `LICENSE` into the package dir - upstream's own wheel ships neither. **Testing** - same as upstream (`test_import.py`), plus a `.so` and licence-file check. **License**: Wheel statically links Microsoft's BlingFire (MIT), fetched via CMake `FetchContent`; upstream ships no licence text for it or for its own Apache-2.0, so the build adds both.
1 parent 2ce6ac0 commit 7c5ed99

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
# SPDX-FileCopyrightText: 2026 The RISE Project
2+
# SPDX-License-Identifier: MIT
3+
---
4+
# livekit-blingfire has no git tag for any release; PyPI's 1.1.0 wheels were
5+
# built from livekit/agents commit 3bea770e (its own build_blingfire job,
6+
# since removed after the package moved out of this monorepo):
7+
# https://github.com/livekit/agents/blob/3bea770e545b7aa02c2c34cf8f8d8022e5fbd1ed/.github/workflows/build.yml
8+
name: Build livekit-blingfire wheels (riscv64)
9+
10+
on:
11+
workflow_dispatch:
12+
inputs:
13+
version:
14+
description: 'livekit-blingfire version to build, e.g. 1.1.0'
15+
required: true
16+
default: '1.1.0'
17+
pull_request:
18+
paths:
19+
- '.github/workflows/build-livekit-blingfire.yml'
20+
21+
concurrency:
22+
group: ${{ github.workflow }}-${{ inputs.version || '1.1.0' }}-${{ github.head_ref || github.run_id }}
23+
cancel-in-progress: true
24+
25+
permissions:
26+
contents: read # to fetch code (actions/checkout)
27+
28+
env:
29+
LIVEKIT_BLINGFIRE_VERSION: ${{ inputs.version || '1.1.0' }}
30+
# No upstream tag exists for this version; move together with the version above.
31+
LIVEKIT_BLINGFIRE_REF: 3bea770e545b7aa02c2c34cf8f8d8022e5fbd1ed
32+
MANYLINUX_RISCV64_IMAGE: quay.io/pypa/manylinux_2_39_riscv64
33+
34+
jobs:
35+
setup:
36+
uses: $/.github/workflows/_setup.yml
37+
38+
build_wheels:
39+
needs: [setup]
40+
name: Build livekit-blingfire ${{ inputs.version || '1.1.0' }} ${{ matrix.python }}-manylinux_riscv64
41+
runs-on: ubuntu-24.04-riscv
42+
timeout-minutes: 60
43+
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
python: ["cp312", "cp313", "cp314", "cp314t"]
48+
49+
steps:
50+
- name: Checkout livekit/agents @ ${{ env.LIVEKIT_BLINGFIRE_REF }}
51+
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
52+
with:
53+
repository: livekit/agents
54+
ref: ${{ env.LIVEKIT_BLINGFIRE_REF }}
55+
persist-credentials: false
56+
57+
# CMakeLists.txt FetchContent-pulls microsoft/BlingFire and statically
58+
# links it; upstream's own wheel ships neither its own LICENSE nor
59+
# BlingFire's. Stage both at package-dir root for setuptools' default
60+
# LICEN[CS]E* glob to pick up.
61+
- name: Stage the upstream LICENSE files
62+
run: |
63+
cp LICENSE livekit-plugins/livekit-blingfire/LICENSE
64+
curl -fsSL --retry 5 "https://raw.githubusercontent.com/microsoft/BlingFire/master/LICENSE" -o livekit-plugins/livekit-blingfire/LICENSE.blingfire
65+
66+
- name: Build wheels
67+
uses: pypa/cibuildwheel@1828c10ab37f080699c7b81cea34097c684a7074 # v4.2.0
68+
with:
69+
package-dir: livekit-plugins/livekit-blingfire
70+
only: ${{ matrix.python }}-manylinux_riscv64
71+
output-dir: wheelhouse/
72+
env:
73+
CIBW_MANYLINUX_RISCV64_IMAGE: ${{ env.MANYLINUX_RISCV64_IMAGE }}
74+
# {project} is the checkout root (monorepo) with package-dir set;
75+
# test_import.py lives under {package} instead (gotcha 5).
76+
CIBW_TEST_COMMAND: >-
77+
python3 {package}/test_import.py &&
78+
python3 -c "import lk_blingfire as m; assert m.__file__.endswith('.so'), m.__file__"
79+
80+
- name: Check wheel contents
81+
run: |
82+
python3 - wheelhouse/*.whl <<'EOF'
83+
import sys, zipfile
84+
path = sys.argv[1]
85+
names = zipfile.ZipFile(path).namelist()
86+
libs = [n for n in names if n.endswith(".so")]
87+
assert libs and all("lk_blingfire" in n for n in libs), libs
88+
licences = {n.rsplit("/", 1)[-1] for n in names
89+
if "dist-info/" in n and n.rsplit("/", 1)[-1].startswith("LICENSE")}
90+
assert licences == {"LICENSE", "LICENSE.blingfire"}, licences
91+
EOF
92+
93+
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
94+
with:
95+
name: livekit-blingfire-${{ env.LIVEKIT_BLINGFIRE_VERSION }}-${{ matrix.python }}-manylinux_riscv64
96+
path: wheelhouse/*.whl
97+
if-no-files-found: error
98+
99+
publish:
100+
name: Publish livekit-blingfire ${{ inputs.version || '1.1.0' }}
101+
needs: [setup, build_wheels]
102+
permissions:
103+
contents: write
104+
pull-requests: write
105+
uses: $/.github/workflows/_publish-wheel.yml
106+
with:
107+
artifact-pattern: livekit-blingfire-${{ inputs.version || '1.1.0' }}-*-manylinux_riscv64

0 commit comments

Comments
 (0)