name: build
on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"
jobs:
build-test-lint-linux:
name: Linux - FFmpeg 7.1 vcpkg static - build, test and lint
runs-on: ubuntu-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-linux-release
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Cache vcpkg
uses: actions/cache@v4
id: cache-vcpkg-linux
with:
path: |
/usr/local/share/vcpkg/installed
/usr/local/share/vcpkg/buildtrees
/usr/local/share/vcpkg/downloads
/usr/local/share/vcpkg/packages
~/.cache/vcpkg
key: ${{ runner.os }}-vcpkg-ffmpeg-nvcodec-v2
- name: Install dependencies
run: |
sudo apt update
sudo apt install -y --no-install-recommends \
clang \
curl \
pkg-config \
nasm \
yasm \
autoconf \
automake \
libtool \
libxv-dev \
libc++-dev
env:
VCPKG_INSTALLATION_ROOT: /usr/local/share/vcpkg
- name: Install FFmpeg via vcpkg
if: steps.cache-vcpkg-linux.outputs.cache-hit != 'true'
run: |
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale,nvcodec]:x64-linux-release
env:
VCPKG_INSTALLATION_ROOT: /usr/local/share/vcpkg
VCPKG_BUILD_TYPE: release
- name: Set environment variables
run: |
echo "PKG_CONFIG_PATH=/usr/local/share/vcpkg/installed/x64-linux-release/lib/pkgconfig" >> $GITHUB_ENV
echo "VCPKG_ROOT=/usr/local/share/vcpkg" >> $GITHUB_ENV
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Build
run: |
cargo build --examples
- name: Test
run: |
cargo test --examples
- name: Lint
run: |
cargo clippy --examples -- -D warnings
- name: Check format
run: |
cargo fmt -- --check
build-test-lint-macos:
name: macOS - FFmpeg 7.1 vcpkg static - build, test and lint
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Determine triplet
id: triplet
run: |
if [ "$(uname -m)" = "arm64" ]; then
echo "triplet=arm64-osx-release" >> $GITHUB_OUTPUT
else
echo "triplet=x64-osx-release" >> $GITHUB_OUTPUT
fi
- name: Cache vcpkg
uses: actions/cache@v4
id: cache-vcpkg-macos
with:
path: |
/usr/local/share/vcpkg/installed
/usr/local/share/vcpkg/buildtrees
/usr/local/share/vcpkg/downloads
/usr/local/share/vcpkg/packages
~/.cache/vcpkg
key: ${{ runner.os }}-${{ steps.triplet.outputs.triplet }}-vcpkg-ffmpeg-v2
- name: Install dependencies
run: |
brew install \
nasm \
yasm \
autoconf \
automake \
libtool \
pkg-config
env:
VCPKG_INSTALLATION_ROOT: /usr/local/share/vcpkg
- name: Install FFmpeg via vcpkg
if: steps.cache-vcpkg-macos.outputs.cache-hit != 'true'
run: |
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale]:${{ steps.triplet.outputs.triplet }}
env:
VCPKG_INSTALLATION_ROOT: /usr/local/share/vcpkg
VCPKG_BUILD_TYPE: release
- name: Set environment variables
run: |
echo "PKG_CONFIG_PATH=/usr/local/share/vcpkg/installed/${{ steps.triplet.outputs.triplet }}/lib/pkgconfig" >> $GITHUB_ENV
echo "VCPKG_ROOT=/usr/local/share/vcpkg" >> $GITHUB_ENV
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Build
run: |
cargo build --examples
- name: Test
run: |
cargo test --examples
- name: Lint
run: |
cargo clippy --examples -- -D warnings
- name: Check format
run: |
cargo fmt -- --check
build-test-lint-windows:
name: Windows - FFmpeg 7.1 vcpkg static - build, test and lint
runs-on: windows-latest
env:
VCPKG_DEFAULT_TRIPLET: x64-windows-static-md-release
VCPKGRS_TRIPLET: x64-windows-static-md-release
VCPKG_ROOT: C:\vcpkg
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Cache vcpkg
uses: actions/cache@v4
id: cache-vcpkg-windows
with:
path: |
C:\vcpkg\installed
C:\vcpkg\buildtrees
C:\vcpkg\downloads
C:\vcpkg\packages
~\AppData\Local\vcpkg\archives
key: ${{ runner.os }}-vcpkg-ffmpeg-nvcodec-release-only-v3
- name: Create custom release-only triplet
run: |
$tripletContent = @"
set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_BUILD_TYPE release)
"@
New-Item -Path "C:\vcpkg\triplets\community" -ItemType Directory -Force | Out-Null
Set-Content -Path "C:\vcpkg\triplets\community\x64-windows-static-md-release.cmake" -Value $tripletContent
- name: Install dependencies
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`n"
- name: Install FFmpeg via vcpkg
if: steps.cache-vcpkg-windows.outputs.cache-hit != 'true'
run: |
vcpkg install ffmpeg[core,avcodec,avdevice,avfilter,avformat,swresample,swscale,nvcodec]:x64-windows-static-md-release
env:
VCPKG_INSTALLATION_ROOT: C:\vcpkg
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Build
run: |
cargo build --examples
- name: Test
run: |
cargo test --examples
- name: Lint
run: |
cargo clippy --examples -- -D warnings
- name: Check format
run: |
cargo fmt -- --check