forked from PyAV-Org/PyAV
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (76 loc) · 2.57 KB
/
tests.yml
File metadata and controls
83 lines (76 loc) · 2.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: tests
on:
release:
types: [published]
workflow_dispatch:
jobs:
package-source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Build source package
run: |
pip install cython
python scripts/fetch-vendor.py --config-file scripts/ffmpeg-7.1.json /tmp/vendor
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist
- name: Upload source package
uses: actions/upload-artifact@v4
with:
name: dist-source
path: dist/
package-wheel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# 仅保留 Linux ARM64 构建 (使用 GitHub 原生 ARM64 运行器)
- os: ubuntu-24.04-arm
arch: aarch64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.9"
# 如果后续需要退回到 ubuntu-latest 使用模拟器,此步骤会生效
- name: Set up QEMU
if: matrix.arch == 'aarch64' && matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
- name: Build wheels
env:
CIBW_ARCHS: ${{ matrix.arch }}
# Linux (manylinux/Rocky) 依赖安装
CIBW_BEFORE_ALL_LINUX: yum install -y alsa-lib libxcb pkgconfig
# Linux 前置构建脚本
CIBW_BEFORE_BUILD_LINUX: python scripts/fetch-vendor.py --config-file scripts/ffmpeg-7.1.json /tmp/vendor
# Linux 环境变量
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig
# 跳过不必要的镜像构建 (musl 针对 alpine)
CIBW_SKIP: "*-musllinux*"
run: |
pip install cibuildwheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}-${{ matrix.arch }}
path: dist/
publish:
runs-on: ubuntu-latest
needs: [package-source, package-wheel]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist/
- name: Publish to PyPI
if: github.event_name == 'release' && github.event.action == 'published'
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}