Files
alchemist/.github/workflows/ci.yml

220 lines
5.3 KiB
YAML

name: CI
on:
push:
branches:
- master
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/ISSUE_TEMPLATE/**'
pull_request:
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/ISSUE_TEMPLATE/**'
workflow_dispatch:
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
rust-check:
runs-on: ubuntu-latest
timeout-minutes: 20
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: 2G
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: rust-linux-shared
- name: Check formatting
run: cargo fmt --all -- --check
- name: Lint
run: cargo clippy --locked --all-targets --all-features -- -D warnings
- name: Check
run: cargo check --locked --all-targets --all-features
rust-test:
runs-on: ubuntu-latest
timeout-minutes: 30
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: 2G
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install FFmpeg
shell: bash
run: |
set -euo pipefail
sudo apt-get update
sudo apt-get install -y ffmpeg
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: rust-linux-shared
- name: Run tests
run: cargo test --locked --all-targets -- --test-threads=4
- name: Upload artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: rust-test-artifacts
path: target/debug/
retention-days: 3
frontend-check:
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: web
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Restore Bun dependency cache
uses: actions/cache@v4
with:
path: |
web/node_modules
~/.bun/install/cache
key: bun-web-${{ runner.os }}-${{ hashFiles('web/bun.lock') }}
restore-keys: |
bun-web-${{ runner.os }}-
- name: Install dependencies
run: bun install --frozen-lockfile
- name: Typecheck
run: bun run typecheck
- name: Astro diagnostics
run: bun run check
- name: Build
run: bun run build
e2e-reliability:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: [frontend-check]
env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: "true"
SCCACHE_CACHE_SIZE: 2G
defaults:
run:
working-directory: web-e2e
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install sccache
uses: mozilla-actions/sccache-action@v0.0.9
- name: Install FFmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- name: Restore Rust cache
uses: Swatinem/rust-cache@v2
with:
prefix-key: rust-linux-shared
- name: Install Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Restore Bun dependency cache
uses: actions/cache@v4
with:
path: |
web/node_modules
web-e2e/node_modules
~/.bun/install/cache
key: bun-e2e-${{ runner.os }}-${{ hashFiles('web/bun.lock', 'web-e2e/bun.lock') }}
restore-keys: |
bun-e2e-${{ runner.os }}-
bun-web-${{ runner.os }}-
- name: Restore Playwright browser cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-${{ hashFiles('web-e2e/package.json', 'web-e2e/bun.lock') }}
restore-keys: |
playwright-${{ runner.os }}-
- name: Build frontend
run: |
cd ../web
bun install --frozen-lockfile
bun run build
- name: Install e2e dependencies
run: bun install --frozen-lockfile
- name: Install Playwright browsers
run: bunx playwright install --with-deps chromium
- name: Run reliability tests
run: bun run test:reliability
- name: Upload artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: e2e-reliability-artifacts
path: web-e2e/test-results/
retention-days: 3