From e294e14fe2d5dace734c96456ccd66bacb5e9e49 Mon Sep 17 00:00:00 2001 From: FreezyLemon Date: Wed, 3 Apr 2024 15:26:55 +0200 Subject: [PATCH] Update and fix CI (#15) --- .github/workflows/build.yml | 84 ++++++++++++++++++++----------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3b3979a..bac7af6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -3,68 +3,76 @@ on: push: pull_request: schedule: - - cron: "0 0 * * *" + - cron: "0 0 * * *" # Daily + +env: + CARGO_INCREMENTAL: 0 + RUSTFLAGS: "-Dwarnings" + + # All default features except non-exhaustive-enums, + # to check that FFmpeg versions are properly compatible + CARGO_FEATURES: " + --no-default-features + -F codec,device,filter,format + -F software-resampling,software-scaling" + jobs: build-test-lint-linux: name: Linux - FFmpeg ${{ matrix.ffmpeg_version }} - build, test and lint - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 container: jrottenberg/ffmpeg:${{ matrix.ffmpeg_version }}-ubuntu + strategy: matrix: ffmpeg_version: ["3.4", "4.0", "4.1", "4.2", "4.3", "4.4", "5.0", "5.1", "6.0", "6.1"] fail-fast: false + steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies run: | - apt update - apt install -y --no-install-recommends clang curl pkg-config - - name: Set up Rust - uses: actions-rs/toolchain@v1 + apt-get update + apt-get install -y --no-install-recommends clang curl pkg-config + - name: Install Rust stable with clippy and rustfmt + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true components: rustfmt, clippy - - name: Build - run: | - cargo build --examples - - name: Test - run: | - cargo test --examples - - name: Lint - run: | - cargo clippy --examples -- -D warnings + - uses: Swatinem/rust-cache@v2 + with: + # Only save cache for one FFmpeg version + save-if: matrix.ffmpeg_version == "6.1" + - name: Check format - run: | - cargo fmt -- --check + run: cargo fmt -- --check + - name: Lint + run: cargo clippy --all-targets $CARGO_FEATURES + - name: Build + run: cargo build --all-targets $CARGO_FEATURES + - name: Test + run: cargo test $CARGO_FEATURES build-test-lint-macos: name: macOS - FFmpeg latest - build, test and lint runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Install dependencies - run: | - brew install ffmpeg pkg-config - - name: Set up Rust - uses: actions-rs/toolchain@v1 + run: brew install ffmpeg pkg-config + - name: Install Rust stable with clippy and rustfmt + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - override: true components: rustfmt, clippy - - name: Build - run: | - cargo build --examples - - name: Test - run: | - cargo test --examples - - name: Lint - run: | - cargo clippy --examples -- -D warnings + - uses: Swatinem/rust-cache@v2 + - name: Check format - run: | - cargo fmt -- --check + run: cargo fmt -- --check + - name: Lint + run: cargo clippy --all-targets $CARGO_FEATURES + - name: Build + run: cargo build --all-targets $CARGO_FEATURES + - name: Test + run: cargo test $CARGO_FEATURES # IDK what's up with the windows CI, it's broken somehow # build-test-lint-windows: