Skip to content

fix(ci): enable custom-protocol in desktop smoke #108

fix(ci): enable custom-protocol in desktop smoke

fix(ci): enable custom-protocol in desktop smoke #108

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
jobs:
# -----------------------------------------------------------
# Rust formatting (single runner, fast gate)
# -----------------------------------------------------------
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check
# -----------------------------------------------------------
# Clippy & tests — matrix across macOS + Linux
# -----------------------------------------------------------
check:
name: Clippy & Tests (${{ matrix.name }})
runs-on: ${{ matrix.os }}
needs: fmt
strategy:
fail-fast: false
matrix:
include:
- name: macOS
os: macos-latest
install-protoc: brew install protobuf
# On macOS we can lint/test the whole workspace (including cratebay-vz)
clippy-args: --workspace --exclude cratebay-gui -- -D warnings
test-args: --workspace --exclude cratebay-gui
- name: Linux
os: ubuntu-latest
install-protoc: sudo apt-get update && sudo apt-get install -y protobuf-compiler
# cratebay-vz requires Virtualization.framework (macOS only)
clippy-args: --workspace --exclude cratebay-gui --exclude cratebay-vz -- -D warnings
test-args: --workspace --exclude cratebay-gui --exclude cratebay-vz
- name: Windows
os: windows-latest
install-protoc: choco install protoc -y
# cratebay-vz requires Virtualization.framework (macOS only);
# cratebay-gui requires WebKitGTK / WebView2 build tooling
clippy-args: --workspace --exclude cratebay-gui --exclude cratebay-vz -- -D warnings
test-args: --workspace --exclude cratebay-gui --exclude cratebay-vz
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install protoc
run: ${{ matrix.install-protoc }}
# Linux-only: system libs required by Tauri / WebKitGTK (needed for
# workspace resolve even though we skip the GUI crate itself)
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf
- name: Cargo cache
uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy ${{ matrix.clippy-args }}
- name: Tests
run: cargo test ${{ matrix.test-args }} -- --test-threads=1
env:
RUST_BACKTRACE: 1
# cratebay-vz: only build & test on macOS (Virtualization.framework)
- name: Build cratebay-vz
if: runner.os == 'macOS'
run: cargo build -p cratebay-vz
- name: Test cratebay-vz
if: runner.os == 'macOS'
run: cargo test -p cratebay-vz
# -----------------------------------------------------------
# GUI backend Rust tests (src-tauri)
# -----------------------------------------------------------
gui-backend:
name: GUI Backend Rust (Ubuntu)
runs-on: ubuntu-latest
needs: fmt
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install Linux system dependencies
run: |
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
shared-key: gui-backend
- name: Cargo check
run: cargo check -p cratebay-gui
- name: Cargo tests
run: cargo test -p cratebay-gui
# -----------------------------------------------------------
# Docker runtime smoke — real CLI against a live daemon
# -----------------------------------------------------------
docker-runtime-smoke:
name: Docker Runtime Smoke (CLI)
runs-on: ubuntu-latest
needs: check
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
shared-key: docker-runtime-smoke
- name: Docker runtime info
run: docker version && docker info
- name: Run Docker runtime smoke
run: ./scripts/docker-runtime-smoke.sh
# -----------------------------------------------------------
# AI runtime smoke — Ollama canary, MCP lifecycle, sandboxes
# -----------------------------------------------------------
ai-runtime-smoke:
name: AI Runtime Smoke (Linux)
runs-on: ubuntu-latest
needs: gui-backend
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install Linux system dependencies
run: |
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ai-runtime-smoke
- name: Docker runtime info
run: docker version && docker info
- name: Run AI runtime smoke
run: ./scripts/ai-runtime-smoke.sh
# -----------------------------------------------------------
# Frontend — Node / React lint & build
# -----------------------------------------------------------
frontend:
name: Frontend Lint, Build & Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: ["22", "24"]
defaults:
run:
working-directory: crates/cratebay-gui
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
cache-dependency-path: crates/cratebay-gui/package-lock.json
- name: Install dependencies
run: npm ci
- name: Lint
run: npm run lint
- name: Type-check & build
run: npm run build
- name: Check i18n keys
run: npm run check:i18n
- name: Unit tests
run: npm run test:unit
# -----------------------------------------------------------
# Frontend E2E — Playwright browser validation
# -----------------------------------------------------------
frontend-e2e:
name: Frontend E2E (Playwright)
runs-on: ubuntu-latest
needs: frontend
defaults:
run:
working-directory: crates/cratebay-gui
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: npm
cache-dependency-path: crates/cratebay-gui/package-lock.json
- name: Install dependencies
run: npm ci
- name: Install Playwright browser
run: npx playwright install --with-deps chromium
- name: Run end-to-end tests
run: npx playwright test
- name: Upload Playwright artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: |
output/playwright/report
output/playwright/results
if-no-files-found: ignore
# -----------------------------------------------------------
# Desktop shell smoke — real Tauri app on Linux
# -----------------------------------------------------------
desktop-smoke-linux:
name: Desktop Smoke (Tauri Linux)
runs-on: ubuntu-latest
needs: [frontend-e2e, docker-runtime-smoke]
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "24"
cache: npm
cache-dependency-path: crates/cratebay-gui/package-lock.json
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Install Linux desktop dependencies
run: |
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf \
xauth \
xvfb \
webkit2gtk-driver
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
shared-key: desktop-smoke-linux
- name: Install tauri-driver
run: cargo install tauri-driver --locked --version 2.0.5
- name: Run desktop smoke
run: |
mkdir -p dist/desktop-smoke
set +e
xvfb-run -a -e /tmp/xvfb-run.log ./scripts/run-desktop-e2e-linux.sh
status=$?
set -e
if [[ -f /tmp/xvfb-run.log ]]; then
cp /tmp/xvfb-run.log dist/desktop-smoke/xvfb-run.log || true
echo "== Xvfb log (tail) =="
tail -n 200 /tmp/xvfb-run.log || true
fi
exit $status
- name: Upload desktop smoke artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: desktop-smoke-artifacts
path: dist/desktop-smoke
if-no-files-found: ignore
# -----------------------------------------------------------
# Release binary size check (macOS only — primary target)
# -----------------------------------------------------------
size-check:
name: Binary Size Check
runs-on: macos-latest
needs: check
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install protoc
run: brew install protobuf
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
shared-key: size-check
- name: Build release (CLI + daemon)
run: cargo build --release -p cratebay-cli -p cratebay-daemon
- name: Report binary sizes
run: |
echo "## Release binary sizes" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Binary | Size |" >> "$GITHUB_STEP_SUMMARY"
echo "|--------|------|" >> "$GITHUB_STEP_SUMMARY"
for bin in cratebay cratebay-daemon; do
path="target/release/$bin"
if [ -f "$path" ]; then
size_bytes=$(stat -f%z "$path")
size_mb=$(echo "scale=2; $size_bytes / 1048576" | bc)
echo "| $bin | ${size_mb} MB |" >> "$GITHUB_STEP_SUMMARY"
echo "$bin: ${size_mb} MB ($size_bytes bytes)"
fi
done
- name: Check binary size limit (20 MB each)
run: |
MAX_BYTES=$((20 * 1048576))
for bin in cratebay cratebay-daemon; do
path="target/release/$bin"
if [ -f "$path" ]; then
size=$(stat -f%z "$path")
if [ "$size" -gt "$MAX_BYTES" ]; then
echo "::error::$bin is $(echo "scale=2; $size/1048576" | bc) MB — exceeds 20 MB limit"
exit 1
fi
fi
done
echo "All binaries within size budget."
# -----------------------------------------------------------
# Performance benchmark (binary size + startup + idle RAM)
# -----------------------------------------------------------
perf-bench:
name: Performance Benchmark (${{ matrix.name }})
needs: check
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: macOS
os: macos-latest
install-protoc: brew install protobuf
- name: Linux
os: ubuntu-latest
install-protoc: sudo apt-get update && sudo apt-get install -y protobuf-compiler
steps:
- uses: actions/checkout@v4
- name: Install Rust stable
uses: dtolnay/rust-toolchain@stable
- name: Install protoc
run: ${{ matrix.install-protoc }}
# Linux-only: system libs required by workspace resolve
- name: Install Linux system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get install -y \
libgtk-3-dev \
libwebkit2gtk-4.1-dev \
libappindicator3-dev \
librsvg2-dev \
patchelf
- name: Cargo cache
uses: Swatinem/rust-cache@v2
with:
shared-key: perf-bench
- name: Build release binaries
run: cargo build --release -p cratebay-cli -p cratebay-daemon
- name: Run performance benchmarks
run: ./scripts/bench-perf.sh
- name: Write benchmark summary
if: always()
run: |
echo "## Performance Benchmark (${{ matrix.name }})" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo '```' >> "$GITHUB_STEP_SUMMARY"
./scripts/bench-perf.sh 2>&1 || true
echo '```' >> "$GITHUB_STEP_SUMMARY"