forked from PyAV-Org/PyAV
-
Notifications
You must be signed in to change notification settings - Fork 0
234 lines (214 loc) · 7.11 KB
/
tests.yml
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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
name: tests
on:
push:
paths-ignore:
- '**.md'
- '**.rst'
- '**.txt'
pull_request:
paths-ignore:
- '**.md'
- '**.rst'
- '**.txt'
jobs:
style:
name: "Style"
runs-on: ubuntu-latest
env:
PYAV_PYTHON: python3
PYAV_LIBRARY: ffmpeg-6.0
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Environment
run: env | sort
- name: Packages
run: |
. scripts/activate.sh
python -m pip install black isort
- name: "Test Style"
run: |
python -m black av examples tests
python -m isort --profile black --check-only --diff av examples tests
nix:
name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}"
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: ubuntu-latest, python: 3.9, ffmpeg: "6.0"}
- {os: ubuntu-latest, python: 3.9, ffmpeg: "5.1"}
- {os: macos-latest, python: 3.9, ffmpeg: "6.0"}
env:
PYAV_PYTHON: python${{ matrix.config.python }}
PYAV_LIBRARY: ffmpeg-${{ matrix.config.ffmpeg }}
steps:
- uses: actions/checkout@v4
name: Checkout
- name: Python ${{ matrix.config.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.config.python }}
- name: OS Packages
run: |
case ${{ matrix.config.os }} in
ubuntu-latest)
sudo apt-get update
sudo apt-get install autoconf automake build-essential cmake \
libtool mercurial pkg-config texinfo wget yasm zlib1g-dev
sudo apt-get install libass-dev libfreetype6-dev libjpeg-dev \
libtheora-dev libvorbis-dev libx264-dev
;;
macos-latest)
brew update
brew install automake libtool nasm pkg-config shtool wget
brew install libass libjpeg libpng libvorbis libvpx opus theora x264
;;
esac
- name: Pip and FFmpeg
run: |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }}
scripts/build-deps
- name: Build
run: |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }}
scripts/build
- name: Test
run: |
. scripts/activate.sh ffmpeg-${{ matrix.config.ffmpeg }}
python -m av --version # Assert it can import.
scripts/test
windows:
name: "py-${{ matrix.config.python }} lib-${{ matrix.config.ffmpeg }} ${{matrix.config.os}}"
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {os: windows-latest, python: 3.9, ffmpeg: "6.0"}
- {os: windows-latest, python: 3.9, ffmpeg: "5.1"}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Conda
shell: bash
run: |
. $CONDA/etc/profile.d/conda.sh
conda config --set always_yes true
conda config --add channels conda-forge
conda create -q -n pyav \
cython \
numpy \
pillow \
python=${{ matrix.config.python }} \
setuptools
if [[ "${{ matrix.config.ffmpeg }}" == "5.1" ]]; then
curl -L -o ffmpeg.tar.gz https://github.com/PyAV-Org/pyav-ffmpeg/releases/download/5.1.2-1/ffmpeg-win_amd64.tar.gz
else
conda install -q -n pyav ffmpeg=${{ matrix.config.ffmpeg }}
fi
- name: Build
shell: bash
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate pyav
if [[ "${{ matrix.config.ffmpeg }}" != "6.0" ]]; then
tar -xf ffmpeg.tar.gz -C $CONDA_PREFIX/Library/
fi
python setup.py build_ext --inplace --ffmpeg-dir=$CONDA_PREFIX/Library
- name: Test
shell: bash
run: |
. $CONDA/etc/profile.d/conda.sh
conda activate pyav
python setup.py test
package-source:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Build source package
run: |
pip install cython
python scripts/fetch-vendor.py /tmp/vendor
PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig python setup.py sdist
- name: Upload source package
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
package-wheel:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-latest
arch: arm64
- os: macos-latest
arch: x86_64
# - os: ubuntu-latest
# arch: aarch64
- os: ubuntu-latest
arch: i686
- os: ubuntu-latest
arch: x86_64
- os: windows-latest
arch: AMD64
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Set up QEMU
if: matrix.os == 'ubuntu-latest'
uses: docker/setup-qemu-action@v3
- name: Install packages
if: matrix.os == 'macos-latest'
run: |
brew update
brew install pkg-config
- name: Build wheels
env:
CIBW_ARCHS: ${{ matrix.arch }}
CIBW_BEFORE_ALL_LINUX: yum install -y alsa-lib libxcb
CIBW_BEFORE_BUILD: pip install cython && python scripts/fetch-vendor.py /tmp/vendor
CIBW_BEFORE_BUILD_WINDOWS: pip install cython && python scripts\fetch-vendor.py C:\cibw\vendor
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH=/tmp/vendor/lib:$LD_LIBRARY_PATH PKG_CONFIG_PATH=/tmp/vendor/lib/pkgconfig
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_SKIP: "*-musllinux*"
CIBW_TEST_COMMAND: mv {project}/av {project}/av.disabled && python -m unittest discover -t {project} -s tests && mv {project}/av.disabled {project}/av
CIBW_TEST_REQUIRES: numpy
CIBW_TEST_SKIP: pp* *_i686 *-macosx_arm64
run: |
pip install cibuildwheel delvewheel
cibuildwheel --output-dir dist
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
publish:
runs-on: ubuntu-latest
needs: [package-source, package-wheel]
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Publish to PyPI
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}