Merge pull request #4 from phial3/develop #23
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 \ | |
| 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: Setup FFmpeg ENV | |
| run: | | |
| # set env | |
| export FFMPEG_BUILD_DIR=${PWD}/tmp/ffmpeg_build | |
| echo "FFMPEG_DIR=${FFMPEG_BUILD_DIR}" >> $GITHUB_ENV | |
| echo "FFMPEG_INCLUDE_DIR=${FFMPEG_BUILD_DIR}/include" >> $GITHUB_ENV | |
| echo "FFMPEG_LIB_DIR=${FFMPEG_BUILD_DIR}/lib" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_PATH=${FFMPEG_BUILD_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=${FFMPEG_BUILD_DIR}/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| # check env | |
| echo "FFmpeg build directory: $FFMPEG_BUILD_DIR" | |
| echo "FFmpeg include directory: $FFMPEG_INCLUDE_DIR" | |
| echo "FFmpeg library directory: $FFMPEG_LIB_DIR" | |
| ls -l ${FFMPEG_BUILD_DIR}/lib || true | |
| ls -l ${FFMPEG_BUILD_DIR}/include || true | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Build | |
| run: cargo build --features ${{ matrix.feature }} --verbose | |
| - name: Test | |
| run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture | |
| 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 --all --all-features --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 | |
| clippy: | |
| name: Clippy + Test | |
| 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 \ | |
| 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: Setup FFmpeg ENV | |
| run: | | |
| # set env | |
| export FFMPEG_BUILD_DIR=${PWD}/tmp/ffmpeg_build | |
| echo "FFMPEG_DIR=${FFMPEG_BUILD_DIR}" >> $GITHUB_ENV | |
| echo "FFMPEG_INCLUDE_DIR=${FFMPEG_BUILD_DIR}/include" >> $GITHUB_ENV | |
| echo "FFMPEG_LIB_DIR=${FFMPEG_BUILD_DIR}/lib" >> $GITHUB_ENV | |
| echo "PKG_CONFIG_PATH=${FFMPEG_BUILD_DIR}/lib/pkgconfig:$PKG_CONFIG_PATH" >> $GITHUB_ENV | |
| echo "LD_LIBRARY_PATH=${FFMPEG_BUILD_DIR}/lib:$LD_LIBRARY_PATH" >> $GITHUB_ENV | |
| # check env | |
| echo "FFmpeg build directory: $FFMPEG_BUILD_DIR" | |
| echo "FFmpeg include directory: $FFMPEG_INCLUDE_DIR" | |
| echo "FFmpeg library directory: $FFMPEG_LIB_DIR" | |
| ls -l ${FFMPEG_BUILD_DIR}/lib || true | |
| ls -l ${FFMPEG_BUILD_DIR}/include || true | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| components: clippy | |
| - name: Clippy | |
| run: cargo clippy --all --features ${{ matrix.feature }} --verbose -- -D warnings | |
| - name: Test | |
| run: cargo test --features ${{ matrix.feature }} --verbose -- --nocapture | |
| lints: | |
| name: Rust fmt | |
| 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 |