-
Notifications
You must be signed in to change notification settings - Fork 41
305 lines (270 loc) · 10.1 KB
/
ci.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
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
env:
CARGO_TERM_COLOR: always
jobs:
rustfmt_check:
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt
- run: cargo fmt --all -- --check
rust_clippy_check_ubuntu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
- name: Install FFmpegBuildTools
run: |
sudo apt-get update -qq
sudo apt-get -y install autoconf automake build-essential cmake \
git-core libass-dev libfreetype6-dev libgnutls28-dev libsdl2-dev \
libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev \
libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget yasm \
zlib1g-dev nasm libx264-dev libx265-dev libnuma-dev \
libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev
- name: Build Linux FFmpeg
run: bash utils/linux_ffmpeg.rs
- run: |
export FFMPEG_PKG_CONFIG_PATH=${PWD}/tmp/ffmpeg_build/lib/pkgconfig
cargo clippy -- -D warnings
rust_clippy_check_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: clippy
# Using this since it's used by clang-sys's CI
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
directory: ${{ github.workspace }}/clang
- name: Cache vcpkg
id: cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/vcpkg
key: vcpkg-${{ runner.os }}
- name: Build vcpkg
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone https://github.com/microsoft/vcpkg --depth 1
./vcpkg/bootstrap-vcpkg.bat
- name: Install vcpkg
run: |
./vcpkg/vcpkg.exe install ffmpeg:x64-windows-static-md
- name: Clippy check
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
LIBCLANG_PATH: ${{ github.workspace }}/clang/lib
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
# vcpkg doesn't provide FFmpeg 7 yet (https://github.com/microsoft/vcpkg/issues/37888)
run: cargo clippy --no-default-features --features ffmpeg6 -- -D warnings
build_static_and_test_ubuntu:
runs-on: ubuntu-latest
strategy:
matrix:
ffmpeg-version: ["release/6.0", "release/6.1", "release/7.0"]
rust: ["nightly", "1.70.0"]
valgrind: ["valgrind", "no valgrind"]
include:
# Stop running tests on stable rust or FFmpeg 6.0 (due to specific bug of FFmpeg 6.0)
# https://github.com/FFmpeg/FFmpeg/commit/c4f35ba8084f254afe1fb05202abfdcfff63b854
- rust: "nightly"
ffmpeg-version: "release/6.1"
should_test: "true"
- rust: "nightly"
ffmpeg-version: "release/7.0"
should_test: "true"
- ffmpeg-version: "release/6.0"
additional-cargo-flags: "--no-default-features --features ffmpeg6"
- ffmpeg-version: "release/6.1"
additional-cargo-flags: "--no-default-features --features ffmpeg6"
exclude:
# Only run valgrind with latest FFmpeg and nightly rust to reduce resource consumption.
- valgrind: "valgrind"
ffmpeg-version: "release/6.0"
- valgrind: "valgrind"
ffmpeg-version: "release/6.1"
- valgrind: "valgrind"
rust: "1.70.0"
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Install valgrind dependencies
# On Debian and Ubuntu, libc6-dbg is required for valgrind
run: |
sudo apt-get update -qq
sudo apt-get -y install libc6-dbg
cargo install cargo-valgrind --version 2.0.2
- name: Cache valgrind
id: cache
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/valgrind
key: valgrind-${{ runner.os }}
- name: Build valgrind
if: steps.cache.outputs.cache-hit != 'true'
run: |
git clone git://sourceware.org/git/valgrind.git --depth 1
cd valgrind
./autogen.sh
./configure
make -j$(nproc)
- name: Install valgrind
run: |
cd valgrind
sudo make install
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
- name: Install FFmpegBuildTools
run: |
sudo apt-get update -qq
sudo apt-get -y install autoconf automake build-essential cmake \
git-core libass-dev libfreetype6-dev libgnutls28-dev libsdl2-dev \
libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev \
libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget yasm \
zlib1g-dev nasm libx264-dev libx265-dev libnuma-dev \
libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev
- name: Build Linux FFmpeg
run: bash utils/linux_ffmpeg.rs ${{ matrix.ffmpeg-version }}
- name: Test
run: |
export FFMPEG_PKG_CONFIG_PATH=${PWD}/tmp/ffmpeg_build/lib/pkgconfig
if [ '${{ matrix.should_test }}' == 'true' ]; then
if [ '${{ matrix.valgrind }}' == 'valgrind' ]; then
cargo valgrind test ${{ matrix.additional-cargo-flags }}
else
cargo test ${{ matrix.additional-cargo-flags }}
fi
else
cargo test ${{ matrix.additional-cargo-flags }} --no-run
fi
# Cross build on Ubuntu, then send it to Windows machine for CI.
build_dynamic_and_test_windows_pre:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
- name: Install FFmpegBuildTools
run: |
sudo apt-get update -qq
sudo apt-get -y install autoconf automake build-essential cmake \
git-core libass-dev libfreetype6-dev libgnutls28-dev libsdl2-dev \
libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev \
libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget yasm \
zlib1g-dev nasm libx264-dev libx265-dev libnuma-dev \
libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev
- name: Install cross deps
run: sudo apt-get -y install mingw-w64
- name: Build FFmpeg
run: bash utils/windows_ffmpeg.rs
- name: Make shared
run: |
cd ./tmp/ffmpeg_build/lib
i686-w64-mingw32-gcc -shared -o libffmpeg.dll \
-Wl,--out-implib,libffmpeg.lib \
-Wl,--whole-archive *.a -Wl,--no-whole-archive \
-lgdi32 \
-lpsapi \
-lole32 \
-lstrmiids \
-luuid \
-loleaut32 \
-lshlwapi \
-luser32 \
-lws2_32 \
-lvfw32 \
-luser32 \
-lsecur32 \
-lbcrypt \
-lm \
-lpsapi \
-ladvapi32 \
-lshell32 \
-lole32 \
-lmfplat \
-static-libgcc \
-static-libstdc++
- name: Upload Cross Compiled FFmpeg for Windows
uses: actions/upload-artifact@v4
with:
name: cross_ffmpeg
path: tmp/ffmpeg_build/
build_dynamic_and_test_windows:
strategy:
matrix:
rust: ["nightly", "1.70.0"]
fail-fast: false
runs-on: windows-latest
needs: build_dynamic_and_test_windows_pre
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
target: i686-pc-windows-msvc
toolchain: ${{ matrix.rust }}
- name: Download Cross Compiled FFmpeg for Windows
uses: actions/download-artifact@v4
with:
name: cross_ffmpeg
path: ${{ github.workspace }}/ffmpeg_prebuilt_cross
# Using this since it's used by clang-sys's CI
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v1
with:
version: "10.0"
directory: ${{ github.workspace }}/clang
# `--tests` to disable glfw-sys building on windows_x86(which is currently not working)
- env:
FFMPEG_INCLUDE_DIR: ${{ github.workspace }}/ffmpeg_prebuilt_cross/include
FFMPEG_DLL_PATH: ${{ github.workspace }}/ffmpeg_prebuilt_cross/lib/libffmpeg.dll
LIBCLANG_PATH: ${{ github.workspace }}/clang/lib
LLVM_CONFIG_PATH: ${{ github.workspace }}/clang/bin/llvm-config
run: |
copy ${{ github.workspace }}/ffmpeg_prebuilt_cross/lib/libffmpeg.dll .
cargo test --tests --target i686-pc-windows-msvc -- --skip transcode
# Check if correct documentation can be generated by docs.rs
docs_rs_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
# https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
- name: Install FFmpegBuildTools
run: |
sudo apt-get update -qq
sudo apt-get -y install autoconf automake build-essential cmake \
git-core libass-dev libfreetype6-dev libgnutls28-dev libsdl2-dev \
libtool libva-dev libvdpau-dev libvorbis-dev libxcb1-dev \
libxcb-shm0-dev libxcb-xfixes0-dev pkg-config texinfo wget yasm \
zlib1g-dev nasm libx264-dev libx265-dev libnuma-dev \
libvpx-dev libfdk-aac-dev libmp3lame-dev libopus-dev
- name: Set env
run: echo "DOCS_RS=1" >> $GITHUB_ENV
- name: Document Generation
run: cargo doc