Migrate to FFmpeg new channel layout API (#130) #359
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
components: rustfmt | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: fmt | |
args: --all -- --check | |
rust_clippy_check_ubuntu: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
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 | |
sudo apt-get -y install 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 -vv -- -D warnings | |
rust_clippy_check_windows: | |
runs-on: windows-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# 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@v3 | |
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 | |
run: cargo clippy -- -D warnings | |
build_static_and_test_ubuntu: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
ffmpeg-version: ["release/6.0", "release/6.1"] | |
rust: ["nightly", "1.70.0"] | |
valgrind: ["valgrind", "no valgrind"] | |
include: | |
# Only run tests on nightly rust + latest FFmpeg | |
# This is caused by specific bug of FFmpeg 6.0 | |
# https://github.com/FFmpeg/FFmpeg/commit/c4f35ba8084f254afe1fb05202abfdcfff63b854 | |
- rust: "nightly" | |
ffmpeg-version: "release/6.1" | |
should_test: "true" | |
exclude: | |
# Only run valgrind with latest FFmpeg and nightly rust to reduce resource consumption. | |
- valgrind: "valgrind" | |
ffmpeg-version: "release/6.0" | |
- valgrind: "valgrind" | |
rust: "1.70.0" | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
override: true | |
- name: Install valgrind dependencies | |
run: | | |
sudo apt-get -y install libc6-dbg | |
cargo install cargo-valgrind --version 2.0.2 | |
- name: Cache valgrind | |
id: cache | |
uses: actions/cache@v3 | |
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 | |
sudo apt-get -y install 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 -vv | |
else | |
cargo test -vv | |
fi | |
else | |
cargo test --no-run -vv | |
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@v2 | |
# 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 | |
sudo apt-get -y install 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@v2 | |
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@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
target: i686-pc-windows-msvc | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
override: true | |
- name: Download Cross Compiled FFmpeg for Windows | |
uses: actions/download-artifact@v2 | |
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 -vv -- --skip transcoding | |
# Check if correct documentation can be generated by docs.rs | |
docs_rs_check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
# 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 | |
sudo apt-get -y install 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 -vv |