Skip to content

Commit 989f428

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

1 file changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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+
# actions/setup-python doesn't support riscv64 yet, so work around that by
33+
# using a recent astral-sh/setup-uv action and activate it automatically
34+
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131dab # v8.1.0
35+
with:
36+
python-version: '3.11'
37+
activate-environment: true
38+
39+
- name: Set download url
40+
id: download_url
41+
run: |
42+
DOWNLOAD_URL=$(
43+
echo "${{ env.FFMPEG_BASE_URL }}/${{ env.FFMPEG_VERS }}/ffmpeg-manylinux-${{ matrix.platform.arch }}.tar.gz";
44+
)
45+
echo "ffmpeg_url=$DOWNLOAD_URL" >> $GITHUB_OUTPUT
46+
47+
- name: Build wheels
48+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
49+
with:
50+
target: ${{ matrix.platform.target }}
51+
before-script-linux: |
52+
dnf install -y clang
53+
curl -L "${{ steps.download_url.outputs.ffmpeg_url }}" -o ffmpeg.tar.gz
54+
mkdir -p ${{ env.FFMPEG_DIR }}
55+
tar -zxf ffmpeg.tar.gz -C ${{ env.FFMPEG_DIR }}
56+
args: --release --out dist --interpreter '3.9 3.10 3.11 3.12 3.13 3.13t 3.14 3.14t pypy3.11'
57+
manylinux: 2_39
58+
docker-options: -e CI -e FFMPEG_DIR=${{ env.FFMPEG_DIR }}
59+
- name: Upload wheels
60+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
61+
with:
62+
name: wheels-linux-${{ matrix.platform.arch }}
63+
path: dist
64+
65+
sdist:
66+
runs-on: ubuntu-22.04
67+
steps:
68+
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
69+
with:
70+
persist-credentials: false
71+
- name: Build sdist
72+
uses: PyO3/maturin-action@e83996d129638aa358a18fbd1dfb82f0b0fb5d3b # v1.51.0
73+
with:
74+
command: sdist
75+
args: --out dist
76+
- name: Upload sdist
77+
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
78+
with:
79+
name: wheels-sdist
80+
path: dist
81+
82+
release:
83+
name: Release
84+
runs-on: ubuntu-latest
85+
if: "startsWith(github.ref, 'refs/tags/')"
86+
needs: [linux, sdist]
87+
permissions:
88+
id-token: write
89+
steps:
90+
- name: Download artifacts
91+
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
92+
with:
93+
path: dist
94+
merge-multiple: true
95+
- name: Install uv
96+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
97+
- name: Publish to PyPI
98+
env:
99+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
100+
run: uv publish

0 commit comments

Comments
 (0)