Skip to content

Test

Test #178

Workflow file for this run

name: Test
on:
push:
paths:
- "cli/**"
- "core/**"
- "wasm/**"
- "Cargo.toml"
- ".github/workflows/code-quality.yml"
jobs:
test:
name: Test ${{ matrix.os }} ${{ matrix.rust }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-13, macos-15]
rust: [stable]
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Install FFmpeg (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libavutil-dev libavcodec-dev libavformat-dev \
libavdevice-dev libswscale-dev libswresample-dev \
libpostproc-dev
- name: Gather Homebrew paths
if: runner.os == 'macOS'
run: |
echo "BREW_CACHE=$(brew --cache)" >> $GITHUB_ENV
echo "BREW_CELLAR=$(brew --cellar)" >> $GITHUB_ENV
echo "FFMPEG_PREFIX=$(brew --prefix ffmpeg)" >> $GITHUB_ENV
- name: Install FFmpeg (macOS)
if: runner.os == 'macOS'
run: |
brew update
brew install ffmpeg
- name: Expose FFmpeg libs to the loader (macOS)
if: runner.os == 'macOS'
run: |
echo "DYLD_LIBRARY_PATH=${{ env.FFMPEG_PREFIX }}/lib:$DYLD_LIBRARY_PATH" \
>> $GITHUB_ENV
- name: Set up MSBuild (Windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
- name: Download & extract FFmpeg (Windows)
if: runner.os == 'Windows'
shell: powershell
run: |
$url = 'https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z'
$archive = Join-Path $Env:USERPROFILE 'ffmpeg.7z'
$dest = Join-Path $Env:USERPROFILE 'ffmpeg'
Invoke-WebRequest $url -OutFile $archive
$seven = Join-Path $Env:ProgramFiles '7-Zip\7z.exe'
& $seven x $archive "-o$dest" -y
Remove-Item $archive
$nestedDir = Get-ChildItem -Path $dest | Select-Object -First 1
Get-ChildItem -Path $nestedDir.FullName | Move-Item -Destination $dest
Remove-Item -Path $nestedDir.FullName
Add-Content -Path $Env:GITHUB_ENV -Value "FFMPEG_DIR=$dest"
Add-Content -Path $Env:GITHUB_ENV -Value "INCLUDE=$dest\include;$Env:INCLUDE"
Add-Content -Path $Env:GITHUB_ENV -Value "LIB=$dest\lib;$Env:LIB"
Add-Content -Path $Env:GITHUB_ENV -Value "PATH=$dest\bin;$Env:PATH"
- name: Run tests
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
cmd.exe /c '"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64 && cargo test'
else
cargo test
fi