From 9e4a0180ec9c2f701c48cb757a61044a2088a383 Mon Sep 17 00:00:00 2001 From: StreamKit Devin Date: Sat, 16 May 2026 08:25:41 +0000 Subject: [PATCH 1/2] ci: extract skit.yml job prelude into a composite action The Lint, Test, Coverage, and Build jobs in .github/workflows/skit.yml each repeated the same prelude (free-disk-space, Bun, UI build, apt packages, Rust toolchain, rust-cache). Bumping a tool version meant editing the same block in four places, which has already produced at least one mismatch (different action SHAs on otherwise-identical steps). Move the prelude to a new local composite action .github/actions/setup-skit, with inputs covering the job-to-job variations: - rust-cache-key (default "skit"; Coverage overrides to "skit-coverage") - rust-cache-workspaces (default ""; Coverage overrides to ". -> target/coverage") - rust-components (Lint: "rustfmt, clippy"; Coverage: "llvm-tools-preview"; others: empty) - skip-ui-build (default "false"; reserved for future non-Rust-server jobs) Each migrated job now collapses to actions/checkout + uses: ./.github/actions/setup-skit + inputs that differ. sccache stays per-job because Coverage opts out of it entirely, and the issue scoped sccache out of the composite. Out of scope per #436: Test (GPU) uses a different self-hosted prelude; .github/workflows/ui.yml has less duplication and is not in scope; .github/workflows/e2e.yml has significant variation and is not in scope. Closes #436. Signed-off-by: StreamKit Devin Co-Authored-By: Claudio Costa --- .github/actions/setup-skit/action.yml | 80 ++++++++++++++ .github/workflows/skit.yml | 153 ++------------------------ 2 files changed, 88 insertions(+), 145 deletions(-) create mode 100644 .github/actions/setup-skit/action.yml diff --git a/.github/actions/setup-skit/action.yml b/.github/actions/setup-skit/action.yml new file mode 100644 index 00000000..95fc3b8d --- /dev/null +++ b/.github/actions/setup-skit/action.yml @@ -0,0 +1,80 @@ +name: Set up Skit CI environment +description: > + Common prelude for Skit CI jobs on ubuntu-22.04: free disk space, install + Bun and optionally build the UI (streamkit-server embeds ./ui/dist via + RustEmbed), install the system packages needed by the Rust build (libvpx, + nasm), install the pinned Rust toolchain, and restore Swatinem/rust-cache. + The caller must run actions/checkout before invoking this action so the + action.yml file is resolvable on the runner. sccache is intentionally not + part of the prelude — it is per-job and Coverage opts out entirely. + +inputs: + rust-cache-key: + description: Swatinem/rust-cache shared-key. Jobs that share a target/ may share a key. + required: false + default: skit + rust-cache-workspaces: + description: > + Swatinem/rust-cache workspaces directive. Leave empty for the default + ("."); set to e.g. ". -> target/coverage" when redirecting Cargo's + target dir (cargo-llvm-cov). + required: false + default: "" + rust-components: + description: > + Comma-separated extra Rust toolchain components to install (e.g. + "rustfmt, clippy" or "llvm-tools-preview"). Empty means none beyond + the default profile. + required: false + default: "" + skip-ui-build: + description: > + If "true", skip building ./ui/dist. streamkit-server's RustEmbed + directive requires ./ui/dist to exist at compile time, so most Rust + jobs need this false. + required: false + default: "false" + +runs: + using: composite + steps: + - name: Free disk space + uses: jlumbroso/free-disk-space@main + with: + tool-cache: false + android: true + dotnet: true + haskell: true + large-packages: false + docker-images: true + swap-storage: false + + - name: Setup Bun + uses: oven-sh/setup-bun@v2 + with: + bun-version: "1.3.5" + + - name: Build UI + if: inputs.skip-ui-build != 'true' + working-directory: ./ui + shell: bash + run: | + bun install --frozen-lockfile + bun run build + + - name: Install system dependencies (libvpx for VP9, nasm for AV1 assembly) + shell: bash + run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm + + - name: Install Rust toolchain + uses: dtolnay/rust-toolchain@master + with: + toolchain: "1.95.0" + components: ${{ inputs.rust-components }} + + - uses: Swatinem/rust-cache@v2 + with: + shared-key: ${{ inputs.rust-cache-key }} + workspaces: ${{ inputs.rust-cache-workspaces }} + save-if: ${{ github.ref == 'refs/heads/main' }} + cache-on-failure: true diff --git a/.github/workflows/skit.yml b/.github/workflows/skit.yml index 23df34bd..fb01e273 100644 --- a/.github/workflows/skit.yml +++ b/.github/workflows/skit.yml @@ -13,38 +13,11 @@ jobs: name: Lint (fmt + clippy) runs-on: ubuntu-22.04 steps: - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: false - - uses: actions/checkout@v5 - - name: Setup Bun - uses: oven-sh/setup-bun@v2 + - uses: ./.github/actions/setup-skit with: - bun-version: "1.3.5" - - - name: Build UI - working-directory: ./ui - run: | - bun install --frozen-lockfile - bun run build - - - name: Install system dependencies (libvpx for VP9, nasm for AV1 assembly) - run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: "1.95.0" - components: rustfmt, clippy + rust-components: "rustfmt, clippy" - name: Restore sccache cache uses: actions/cache/restore@v4 @@ -56,12 +29,6 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: Swatinem/rust-cache@v2 - with: - shared-key: skit - save-if: ${{ github.ref == 'refs/heads/main' }} - cache-on-failure: true - - name: Check formatting run: cargo fmt --all -- --check @@ -91,37 +58,9 @@ jobs: name: Test runs-on: ubuntu-22.04 steps: - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: false - - uses: actions/checkout@v5 - - name: Setup Bun - uses: oven-sh/setup-bun@v2 - with: - bun-version: "1.3.5" - - - name: Build UI - working-directory: ./ui - run: | - bun install --frozen-lockfile - bun run build - - - name: Install system dependencies (libvpx for VP9, nasm for AV1 assembly) - run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: "1.95.0" + - uses: ./.github/actions/setup-skit - name: Restore sccache cache uses: actions/cache/restore@v4 @@ -133,12 +72,6 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: Swatinem/rust-cache@v2 - with: - shared-key: skit - save-if: ${{ github.ref == 'refs/heads/main' }} - cache-on-failure: true - - name: Run tests (GPU tests run separately on self-hosted runner) run: | cargo test --locked --workspace -- --skip gpu_tests:: @@ -167,49 +100,13 @@ jobs: # avoid the "sccache not installed" failure and unnecessary indirection. RUSTC_WRAPPER: "" steps: - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: false - - uses: actions/checkout@v5 - - name: Setup Bun - uses: oven-sh/setup-bun@v2 + - uses: ./.github/actions/setup-skit with: - bun-version: "1.3.5" - - - name: Build UI - working-directory: ./ui - run: | - bun install --frozen-lockfile - bun run build - - - name: Install system dependencies (libvpx for VP9, nasm for AV1 assembly) - run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: "1.95.0" - components: llvm-tools-preview - - - uses: Swatinem/rust-cache@v2 - with: - shared-key: skit-coverage - # Point the cache at the same target dir we redirected Cargo to - # via CARGO_LLVM_COV_TARGET_DIR. Without this, rust-cache would - # cache the (empty) default target/ and skip the actual build - # artifacts under target/coverage. - workspaces: ". -> target/coverage" - save-if: ${{ github.ref == 'refs/heads/main' }} - cache-on-failure: true + rust-cache-key: skit-coverage + rust-cache-workspaces: ". -> target/coverage" + rust-components: llvm-tools-preview - name: Install cargo-llvm-cov and cargo-nextest uses: taiki-e/install-action@v2 @@ -297,37 +194,9 @@ jobs: name: Build runs-on: ubuntu-22.04 steps: - - name: Free disk space - uses: jlumbroso/free-disk-space@main - with: - tool-cache: false - android: true - dotnet: true - haskell: true - large-packages: false - docker-images: true - swap-storage: false - - uses: actions/checkout@v5 - - name: Setup Bun - uses: oven-sh/setup-bun@v2 - with: - bun-version: "1.3.5" - - - name: Build UI - working-directory: ./ui - run: | - bun install --frozen-lockfile - bun run build - - - name: Install system dependencies (libvpx for VP9, nasm for AV1 assembly) - run: sudo apt-get update && sudo apt-get install -y libvpx-dev nasm - - - name: Install Rust toolchain - uses: dtolnay/rust-toolchain@master - with: - toolchain: "1.95.0" + - uses: ./.github/actions/setup-skit - name: Restore sccache cache uses: actions/cache/restore@v4 @@ -339,12 +208,6 @@ jobs: - uses: mozilla-actions/sccache-action@v0.0.9 - - uses: Swatinem/rust-cache@v2 - with: - shared-key: skit - save-if: ${{ github.ref == 'refs/heads/main' }} - cache-on-failure: true - - name: Build all crates run: | cargo build --locked --workspace --release From 56a09e6c34e6d0933982dde00e9b34270bb670c7 Mon Sep 17 00:00:00 2001 From: StreamKit Devin Date: Sat, 16 May 2026 08:48:51 +0000 Subject: [PATCH 2/2] ci(setup-skit): add explicit SPDX header for consistency Matches the convention used by docker.yml, docs.yml, e2e.yml, plugins.yml, and release.yml under .github/workflows/. The file was already REUSE compliant via the **/*.yml annotation in REUSE.toml, but inlining the header makes the licensing self-evident on first read. Signed-off-by: StreamKit Devin Co-Authored-By: Claudio Costa --- .github/actions/setup-skit/action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/actions/setup-skit/action.yml b/.github/actions/setup-skit/action.yml index 95fc3b8d..4472fa45 100644 --- a/.github/actions/setup-skit/action.yml +++ b/.github/actions/setup-skit/action.yml @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: © 2025 StreamKit Contributors +# +# SPDX-License-Identifier: MPL-2.0 + name: Set up Skit CI environment description: > Common prelude for Skit CI jobs on ubuntu-22.04: free disk space, install