From f49cd16e00d02731ad76e738ae38c59b5cd4e36b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Barczy=C5=84ski?= <104033489+WojciechBarczynski@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:35:40 +0200 Subject: [PATCH] Optimize CI speed (#644) --- .github/workflows/{check.yml => lint.yml} | 28 +-------- .github/workflows/test.yml | 71 +++++++++++++++++++++++ 2 files changed, 72 insertions(+), 27 deletions(-) rename .github/workflows/{check.yml => lint.yml} (74%) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/check.yml b/.github/workflows/lint.yml similarity index 74% rename from .github/workflows/check.yml rename to .github/workflows/lint.yml index 951ac9c04..5772cde4f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: build, lint and test +name: lint on: push: branches: [master] @@ -29,11 +29,6 @@ jobs: with: components: rustfmt, clippy - - name: ๐Ÿ”ฌ Install nextest - uses: taiki-e/install-action@v2 - with: - tool: cargo-nextest - - name: ๐Ÿ›  Setup Node.JS uses: actions/setup-node@v4 with: @@ -63,34 +58,13 @@ jobs: - name: ๐Ÿ“Ž Run clippy run: cargo clippy --workspace --all-targets --all-features -- -D clippy::todo -D warnings - - name: ๐Ÿ›  Cargo build - run: | - cargo build --features decklink - cargo build --no-default-features - - name: ๐Ÿ“„ Generate JSON schema working-directory: ./generate run: | cargo run --bin generate_from_types -- --check - - name: ๐Ÿงช Run tests - run: | - cargo clean - cargo nextest run --workspace --profile ci - - name: ๐Ÿ–‹๏ธ Run website lint + typecheck + build working-directory: ./docs run: | npm ci npm run typecheck && npm run lint --max-warnings=0 && npm run build - - - name: ๐Ÿ“ฆ Upload failed snapshot test artifacts - if: failure() - uses: actions/upload-artifact@v4 - with: - name: failed_snapshot_tests - path: failed_snapshot_tests - retention-days: 2 - - - name: ๐Ÿ“š Run doctests - run: cargo test --workspace --doc diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 000000000..36a91fd60 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,71 @@ +name: build and test +on: + push: + branches: [master] + pull_request: + types: [opened, synchronize] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} + +jobs: + check: + runs-on: ubuntu-24.04 + steps: + - name: ๐Ÿ›  Install system dependencies + run: | + set -e + + echo ttf-mscorefonts-installer msttcorefonts/accepted-mscorefonts-eula select true | sudo debconf-set-selections + + sudo apt-get update -y -qq + sudo apt-get install -y mesa-vulkan-drivers libegl1-mesa-dev libgl1-mesa-dri libxcb-xfixes0-dev ffmpeg libavcodec-dev libavformat-dev libavfilter-dev libavdevice-dev ttf-mscorefonts-installer libopus-dev + + fc-cache -f + + - name: ๐Ÿ”ง Install the rust toolchain + uses: dtolnay/rust-toolchain@stable + + - name: ๐Ÿ”ฌ Install nextest + uses: taiki-e/install-action@v2 + with: + tool: cargo-nextest + + - name: ๐Ÿ“ฅ Checkout repo + uses: actions/checkout@v4 + + - name: ๐Ÿงฉ Git submodules update + run: | + cat > .gitmodules << EOF + [submodule "snapshot_tests/snapshots"] + path = snapshot_tests/snapshots + url = https://github.com/membraneframework-labs/video_compositor_snapshot_tests.git + EOF + git submodule update --init + + - name: ๐Ÿ“ Rust cache + uses: Swatinem/rust-cache@v2 + + - name: ๐Ÿชข Generate Chromium Embedded Framework bindings + run: cargo build --package compositor_chromium + + - name: ๐Ÿ›  Cargo build + run: | + cargo build --features decklink + cargo build --no-default-features + + - name: ๐Ÿงช Run tests + run: | + cargo nextest run --workspace --profile ci + + - name: ๐Ÿ“ฆ Upload failed snapshot test artifacts + if: failure() + uses: actions/upload-artifact@v4 + with: + name: failed_snapshot_tests + path: failed_snapshot_tests + retention-days: 2 + + - name: ๐Ÿ“š Run doctests + run: cargo test --workspace --doc