forked from shssoichiro/ffmpeg-the-third
-
Notifications
You must be signed in to change notification settings - Fork 0
223 lines (201 loc) · 7.58 KB
/
build.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
name: build
on:
push:
branches: [ "master" ]
paths-ignore:
- 'README.md'
pull_request:
branches: [ "master" ]
paths-ignore:
- 'README.md'
env:
CARGO_INCREMENTAL: 0
CARGO_TERM_COLOR: always
RUSTFLAGS: "-Dwarnings"
# All default features except non-exhaustive-enums,
# to check that FFmpeg versions are properly compatible
CARGO_FEATURES: "
--no-default-features
--features codec,device,filter,format
--features software-resampling,software-scaling"
SYS_FEATURES: "
--no-default-features
--features avcodec,avdevice,avfilter,avformat
--features swresample,swscale"
jobs:
build-test-lint-linux:
name: Linux - FFmpeg ${{ matrix.ffmpeg.version }} - build, test and lint
runs-on: ubuntu-latest
strategy:
matrix:
ffmpeg:
- version: "4.2"
file: "ffmpeg-4.2-linux-gcc.tar.xz"
- version: "4.3"
file: "ffmpeg-4.3-linux-gcc.tar.xz"
- version: "4.4"
file: "ffmpeg-4.4-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "5.1"
file: "ffmpeg-5.1-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "6.1"
file: "ffmpeg-6.1-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "7.0"
file: "ffmpeg-7.0-linux-clang-default.tar.xz"
lib_subdir: "amd64"
- version: "7.1"
file: "ffmpeg-7.1-linux-clang-default.tar.xz"
lib_subdir: "amd64"
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
libc++1 libva2 libva-drm2 libva-x11-2 libvdpau1 libxv1
- name: Download FFmpeg
shell: bash
run: |
mkdir ffmpeg-libs
curl -L "https://sourceforge.net/projects/avbuild/files/linux/${{ matrix.ffmpeg.file }}/download" \
| tar xJf - --strip 1 -C ffmpeg-libs
echo "PKG_CONFIG_PATH=$PWD/ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}/pkgconfig" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$PWD/ffmpeg-libs/lib/${{ matrix.ffmpeg.lib_subdir }}" >> "$GITHUB_ENV"
- name: Install Rust stable with clippy and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v3-rust"
# Only save cache for one FFmpeg version
save-if: ${{ matrix.ffmpeg.version == '7.1' }}
- name: Check format
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --all-targets $CARGO_FEATURES -- -D warnings
- name: Build
run: cargo build --all-targets $CARGO_FEATURES
- name: Test bindings
run: >
cargo test
--manifest-path ffmpeg-sys-third/Cargo.toml
--target-dir target
$SYS_FEATURES
- name: Test
run: cargo test $CARGO_FEATURES
build-test-lint-macos:
name: macOS - FFmpeg ${{ matrix.ffmpeg_version }} - build, test and lint
runs-on: macos-latest
strategy:
matrix:
ffmpeg_version: ["4", "5", "6", "7"]
fail-fast: false
env:
PKG_CONFIG_PATH: /opt/homebrew/opt/ffmpeg@${{ matrix.ffmpeg_version }}/lib/pkgconfig
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: brew install ffmpeg@${{ matrix.ffmpeg_version }}
- name: Install Rust stable with clippy and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v2-rust"
- name: Check format
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --all-targets $CARGO_FEATURES -- -D warnings
- name: Build
run: cargo build --all-targets $CARGO_FEATURES
- name: Test bindings
run: >
cargo test
--manifest-path ffmpeg-sys-third/Cargo.toml
--target-dir target
$SYS_FEATURES
- name: Test
run: cargo test $CARGO_FEATURES
build-test-lint-windows:
name: Windows - FFmpeg ${{ matrix.ffmpeg_version }} - build, test and lint
runs-on: windows-latest
strategy:
matrix:
# GyanD builds don't go as far back as the Ubuntu builds
ffmpeg_version: ["4.4", "5.0", "5.1", "6.0", "6.1", "7.0", "7.1"]
fail-fast: false
env:
FFMPEG_DOWNLOAD_URL: "https://github.com/GyanD/codexffmpeg/releases/download/VER/ffmpeg-VER-full_build-shared.7z"
FFMPEG_INSTALL_PATH: "C:/ffmpeg"
steps:
- uses: actions/checkout@v4
- name: Set libclang path
run: |
$VCINSTALLDIR = $(& "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath)
Add-Content $env:GITHUB_ENV "LIBCLANG_PATH=${VCINSTALLDIR}\VC\Tools\LLVM\x64\bin"
- name: Install FFmpeg ${{ matrix.ffmpeg_version }}
run: |
$tempFile = New-TemporaryFile
$uri = ($env:FFMPEG_DOWNLOAD_URL).Replace('VER', "${{ matrix.ffmpeg_version }}")
Invoke-WebRequest "$uri" -OutFile "$tempFile" -TimeoutSec 10
7z x -y -o"$env:FFMPEG_INSTALL_PATH" "$tempFile"
$ffmpegDir = (Get-ChildItem -Directory "$env:FFMPEG_INSTALL_PATH").FullName
Add-Content $env:GITHUB_ENV "FFMPEG_DIR=$ffmpegDir"
Add-Content $env:GITHUB_PATH "$ffmpegDir/bin"
- name: Install Rust stable with clippy and rustfmt
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v3-rust"
save-if: ${{ matrix.ffmpeg_version == '7.1' }}
- name: Check format
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --all-targets $CARGO_FEATURES -- -D warnings
- name: Build
run: cargo build --all-targets $CARGO_FEATURES
- name: Test bindings
run: >
cargo test
--manifest-path ffmpeg-sys-third/Cargo.toml
--target-dir target
$SYS_FEATURES
- name: Test
run: cargo test $CARGO_FEATURES
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download FFmpeg
shell: bash
run: |
mkdir ffmpeg-libs
curl -L "https://sourceforge.net/projects/avbuild/files/linux/ffmpeg-7.1-linux-clang-lite.tar.xz/download" \
| tar xJf - --strip 1 -C ffmpeg-libs
echo "PKG_CONFIG_PATH=$PWD/ffmpeg-libs/lib/amd64/pkgconfig" >> "$GITHUB_ENV"
echo "LD_LIBRARY_PATH=$PWD/ffmpeg-libs" >> "$GITHUB_ENV"
# rust-version from Cargo.toml
- name: Install Rust 1.82.0
uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
with:
prefix-key: "v2-rust"
- name: Use predefined lockfile
run: mv Cargo.lock.MSRV Cargo.lock
- name: Debug dependencies
run: |
echo "=== Cargo Tree Output ==="
cargo tree --locked
echo "=== Detailed Dependency Resolution ==="
cargo metadata --locked --format-version=1 | jq '.resolve.nodes[] | {id: .id, deps: .deps[].name}' || true
echo "=== Package Dependencies ==="
cargo metadata --locked --format-version=1 | jq '.packages[] | {name: .name, version: .version, dependencies: [.dependencies[].name]}' || true
- name: Run cargo check
run: cargo check --locked $CARGO_FEATURES