Repository navigation
171 lines (164 loc) · 6.98 KB
/
Copy pathtests.yml
File metadata and controls
171 lines (164 loc) · 6.98 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
name: tests
on:
release:
types: [published]
workflow_dispatch:
jobs:
package-source:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
activate-environment: true
python-version: "3.14"
- name: Build source package
run: |
uv pip install -U cython setuptools
python scripts/fetch-vendor.py --config-file scripts/ffmpeg-latest.json /tmp/vendor
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist
- name: Upload source package
uses: actions/upload-artifact@v6
with:
name: dist-source
path: dist/
package-wheel:
runs-on: ${{ matrix.os }}
# riscv64 is best-effort: a failure there must not hold back the release.
continue-on-error: ${{ matrix.arch == 'riscv64' }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-15
arch: arm64
- os: macos-15-intel
arch: x86_64
# riscv64 wheels are attached to the GitHub release only, not
# uploaded to PyPI (see #2443).
- os: ubuntu-24.04-riscv
arch: riscv64
github-only: true
- os: ubuntu-24.04-arm
arch: aarch64
- os: ubuntu-24.04
arch: x86_64
- os: windows-latest
arch: AMD64
- os: windows-11-arm
arch: ARM64
steps:
- uses: actions/checkout@v7
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
activate-environment: true
python-version: "3.14"
- name: Set Minimum MacOS Target
if: runner.os == 'macOS'
run: |
if [ "${{ matrix.arch }}" = "x86_64" ]; then
echo "MACOSX_DEPLOYMENT_TARGET=11.0" >> $GITHUB_ENV
else
echo "MACOSX_DEPLOYMENT_TARGET=14.0" >> $GITHUB_ENV
fi
- name: Build wheels
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: python scripts/fetch-vendor.py --config-file scripts/ffmpeg-latest.json /tmp/vendor
CIBW_BEFORE_BUILD_MACOS: python scripts/fetch-vendor.py --config-file scripts/ffmpeg-latest.json /tmp/vendor
CIBW_BEFORE_BUILD_WINDOWS: python scripts\fetch-vendor.py --config-file scripts\ffmpeg-latest.json C:\cibw\vendor
# Linux is the only platform that embeds debug info in the extensions;
# macOS and Windows keep it out of the shipped binaries.
# riscv64 wheels (e.g. numpy, for CIBW_TEST_REQUIRES) are often missing on
# PyPI; RISE mirrors prebuilt wheels for it. unsafe-best-match is needed so
# uv still falls back to PyPI for packages/versions RISE doesn't carry.
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig LDFLAGS=-Wl,--strip-debug${{ matrix.arch == 'riscv64' && ' UV_INDEX=https://pypi.riseproject.dev/simple/ UV_INDEX_STRATEGY=unsafe-best-match' || '' }}
CIBW_ENVIRONMENT_MACOS: PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig LDFLAGS=-headerpad_max_install_names
CIBW_ENVIRONMENT_WINDOWS: INCLUDE=C:\\cibw\\vendor\\include LIB=C:\\cibw\\vendor\\lib PYAV_SKIP_TESTS=unicode_filename
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: delvewheel repair --add-path C:\cibw\vendor\bin -w {dest_dir} {wheel}
CIBW_BUILD: "cp312* cp314t*"
CIBW_BUILD_FRONTEND: uv
CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m pytest {package}/tests && mv {project}/av.disabled {project}/av
# cibuildwheel passes this straight to `pip install`. Never build numpy
# or Pillow from source for the tests, as `make test` does.
CIBW_TEST_REQUIRES: pytest numpy pillow --only-binary numpy,pillow
CIBW_TEST_SKIP: "*-musllinux_riscv64"
run: |
uv pip install cibuildwheel delvewheel
cibuildwheel --output-dir dist
shell: bash
- name: Upload wheels
uses: actions/upload-artifact@v6
with:
name: ${{ matrix.github-only && 'github-only' || 'dist' }}-${{ matrix.os }}-${{ matrix.arch }}
path: dist/
# armv7l (32-bit ARM) is cross-compiled with zig on a native x86_64 runner
# instead of emulated with QEMU. cibuildwheel cannot cross-compile, so this
# target uses its own driver (scripts/build-armv7l-cross.sh).
package-wheel-armv7l:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v7
- name: Set up uv
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
- name: Install build tooling
run: |
uv venv --seed --python 3.12 .venv-3.12
uv venv --seed --python 3.14t .venv-3.14t
uv pip install --python .venv-3.12/bin/python -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
uv pip install --python .venv-3.14t/bin/python -U "cython>=3.1.0,<4" "setuptools>=77.0" wheel
# patchelf 0.18 (ubuntu-24.04's system version) corrupts ELF files
# with large p_align; pin <0.18 for auditwheel to use.
uv pip install --python .venv-3.12/bin/python -U ziglang auditwheel 'patchelf<0.18'
- name: Cross-compile armv7l wheels with zig
env:
HOST_PY312: .venv-3.12/bin/python
HOST_PY314T: .venv-3.14t/bin/python
TOOLS_PY: .venv-3.12/bin/python
run: bash scripts/build-armv7l-cross.sh
- name: Upload wheels
uses: actions/upload-artifact@v6
with:
name: dist-armv7l
path: dist/
publish:
runs-on: ubuntu-latest
needs: [package-source, package-wheel, package-wheel-armv7l]
steps:
- uses: actions/checkout@v7
- uses: actions/download-artifact@v7
with:
pattern: dist-*
merge-multiple: true
path: dist/
- name: Publish to GitHub
if: github.event_name == 'release'
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- 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 }}
# Wheels for platforms we don't publish to PyPI go on the GitHub release only.
publish-github-only:
runs-on: ubuntu-latest
needs: package-wheel
if: github.event_name == 'release'
steps:
- uses: actions/download-artifact@v7
with:
pattern: github-only-*
merge-multiple: true
path: dist/
- name: Publish to GitHub
if: hashFiles('dist/*') != ''
uses: softprops/action-gh-release@efb35369e0ad2afab669f228072c1b0d510eae64 # v3.0.3
with:
files: dist/*
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}