CI #12
This file contains hidden or 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: [ "main" ] | |
| paths-ignore: | |
| - 'README.md' | |
| pull_request: | |
| branches: [ "main" ] | |
| paths-ignore: | |
| - 'README.md' | |
| env: | |
| CARGO_TERM_COLOR: always | |
| CARGO_INCREMENTAL: 0 | |
| RUST_LOG: info | |
| RUSTFLAGS: "-D warnings" | |
| RUST_BACKTRACE: "full" | |
| jobs: | |
| build-linux: | |
| name: build / linux / ffmpeg+opencv+pytorch | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - feature: "full,test-tch" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| build-essential \ | |
| ca-certificates \ | |
| clang \ | |
| curl \ | |
| pkg-config \ | |
| software-properties-common \ | |
| wget \ | |
| cmake \ | |
| python3 \ | |
| python3-pip \ | |
| python3-dev \ | |
| libavcodec-dev \ | |
| libavdevice-dev \ | |
| libavfilter-dev \ | |
| libavformat-dev \ | |
| libavutil-dev \ | |
| libswresample-dev \ | |
| libswscale-dev \ | |
| libopencv-dev \ | |
| python3-opencv | |
| # 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 scripts/linux_ffmpeg.rs | |
| - name: export ffmpeg env | |
| run: export FFMPEG_INCLUDE_DIR=${PWD}/tmp/ffmpeg_build/include | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: clippy | |
| - name: Build | |
| run: cargo build --features ${{ matrix.feature }} --verbose | |
| - name: Test | |
| run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture | |
| - name: Clippy | |
| run: cargo clippy --all --features ${{ matrix.feature }} --verbose -- -D warnings | |
| build-macos: | |
| name: build / macos / ffmpeg+opencv+pytorch | |
| runs-on: macos-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: brew install ffmpeg opencv pytorch pkg-config | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build | |
| run: cargo build --all-features --verbose | |
| - name: Run Test | |
| run: cargo test --verbose -- --nocapture | |
| build-windows: | |
| name: build / windows / latest ffmpeg | |
| runs-on: windows-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - feature: "rsmpeg" | |
| env: | |
| FFMPEG_DOWNLOAD_URL: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full-shared.7z | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - 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" | |
| Invoke-WebRequest "${env:FFMPEG_DOWNLOAD_URL}" -OutFile ffmpeg-release-full-shared.7z | |
| 7z x ffmpeg-release-full-shared.7z | |
| mv ffmpeg-*/* ffmpeg/ | |
| Add-Content $env:GITHUB_ENV "FFMPEG_DIR=${pwd}\ffmpeg`n" | |
| Add-Content $env:GITHUB_ENV "FFMPEG_INCLUDE_DIR=${pwd}\ffmpeg\include`n" | |
| Add-Content $env:GITHUB_ENV "FFMPEG_LIBS_DIR=${pwd}\ffmpeg\lib`n" | |
| Add-Content $env:GITHUB_ENV "FFMPEG_DLL_PATH=${pwd}\ffmpeg\bin`n" | |
| Add-Content $env:GITHUB_PATH "${pwd}\ffmpeg\bin`n" | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build | |
| run: cargo build --features ${{ matrix.feature }} --verbose | |
| # TODO: Failed test on windows | |
| #- name: Run Test | |
| # run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture | |
| lints: | |
| name: Rustfmt | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [macos-latest, windows-latest, ubuntu-latest] | |
| fail-fast: false | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: rustfmt | |
| - run: cargo fmt --all -- --check |