Skip to content

Commit d1f9eda

Browse files
committed
video_reader-rs_build.yml: add build workflow
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
1 parent 1887a91 commit d1f9eda

1 file changed

Lines changed: 95 additions & 0 deletions

File tree

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
tags:
7+
- '*'
8+
pull_request:
9+
branches: [main]
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
linux:
16+
runs-on: ${{ matrix.platform.runner }}
17+
strategy:
18+
matrix:
19+
platform:
20+
- runner: ubuntu-24.04-riscv
21+
target: riscv64gc-unknown-linux-gnu
22+
arch: riscv64
23+
env:
24+
FFMPEG_DIR: ${{ github.workspace }}/ffmpeg
25+
FFMPEG_VERS: 8.1-1
26+
FFMPEG_BASE_URL: https://github.com/PyAV-Org/pyav-ffmpeg/releases/download
27+
steps:
28+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
29+
with:
30+
persist-credentials: false
31+
32+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
33+
with:
34+
repository: gcanat/video_reader-rs
35+
ref: v0.4.3
36+
path: upstream
37+
38+
# actions/setup-python doesn't support riscv64 yet, so work around that by
39+
# using a recent astral-sh/setup-uv action and activate it automatically
40+
- uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
41+
with:
42+
# Avoid this error:
43+
# maturin failed
44+
# Caused by: Free-threaded Python interpreter is only supported on 3.14 and later.
45+
python-version: '3.14'
46+
activate-environment: true
47+
working-directory: upstream
48+
49+
- name: Set download url
50+
id: download_url
51+
run: |
52+
DOWNLOAD_URL=$(
53+
echo "${{ env.FFMPEG_BASE_URL }}/${{ env.FFMPEG_VERS }}/ffmpeg-manylinux-${{ matrix.platform.arch }}.tar.gz";
54+
)
55+
echo "ffmpeg_url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
56+
57+
- name: Build wheels
58+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
59+
with:
60+
working-directory: upstream
61+
target: ${{ matrix.platform.target }}
62+
before-script-linux: |
63+
dnf install -y clang
64+
curl -L "${{ steps.download_url.outputs.ffmpeg_url }}" -o ffmpeg.tar.gz
65+
mkdir -p ${{ env.FFMPEG_DIR }}
66+
tar -zxf ffmpeg.tar.gz -C ${{ env.FFMPEG_DIR }}
67+
args: --release --out dist --interpreter '3.9 3.10 3.11 3.12 3.13 3.13t 3.14 3.14t pypy3.11'
68+
manylinux: 2_39
69+
docker-options: -e CI -e FFMPEG_DIR=${{ env.FFMPEG_DIR }}
70+
- name: Upload wheels
71+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
72+
with:
73+
name: wheels-linux-${{ matrix.platform.arch }}
74+
path: dist
75+
working-directory: upstream
76+
77+
# release:
78+
# name: Release
79+
# runs-on: ubuntu-latest
80+
# if: "startsWith(github.ref, 'refs/tags/')"
81+
# needs: [linux]
82+
# permissions:
83+
# id-token: write
84+
# steps:
85+
# - name: Download artifacts
86+
# uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
87+
# with:
88+
# path: dist
89+
# merge-multiple: true
90+
# - name: Install uv
91+
# uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
92+
# - name: Publish to PyPI
93+
# env:
94+
# UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
95+
# run: uv publish

0 commit comments

Comments
 (0)