Refactor/split commands #164
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "CI" | |
on: | |
workflow_call: {} # Allow this workflow to be called by other workflows | |
push: | |
branches: | |
- master | |
paths: | |
- 'src-tauri/**' | |
- 'src/**' | |
- 'static/**' | |
- 'package.json' | |
- 'bun.lockb' | |
- 'svelte.config.js' | |
- 'tailwind.config.js' | |
- 'vite.config.js' | |
- '.github/workflows/ci.yml' | |
pull_request: | |
paths: | |
- 'src-tauri/**' | |
- 'src/**' | |
- 'static/**' | |
- 'package.json' | |
- 'bun.lockb' | |
- 'svelte.config.js' | |
- 'tailwind.config.js' | |
- 'vite.config.js' | |
- '.github/workflows/ci.yml' | |
jobs: | |
check: | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# macOS desktop builds | |
- name: "macOS (Apple Silicon)" | |
platform: "macos-latest" | |
args: "--target aarch64-apple-darwin" | |
arch: "aarch64" | |
- name: "macOS (Intel)" | |
platform: "macos-latest" | |
args: "--target x86_64-apple-darwin" | |
arch: "x86_64" | |
# Linux desktop builds | |
- name: "Linux Desktop" | |
platform: "ubuntu-22.04" | |
args: "" | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add Rust cache | |
uses: Swatinem/rust-cache@v2 | |
with: | |
# Specify the working directory for Rust cache | |
workspaces: "src-tauri -> target" | |
# Cache cargo registry | |
cache-directories: | | |
~/.cargo/registry | |
~/.cargo/git | |
# Add a suffix to distinguish between different platforms and architectures | |
key: ${{ matrix.platform }}${{ matrix.arch && '-' }}${{ matrix.arch }} | |
- name: Install Rust stable | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: >- | |
${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
- name: Cache bun dependencies | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.bun/install/cache | |
node_modules | |
key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lockb') }} | |
restore-keys: | | |
${{ runner.os }}-bun- | |
- name: Setup bun | |
uses: oven-sh/setup-bun@v1 | |
with: | |
bun-version: 1.1.39 | |
- name: Install system dependencies (ubuntu only) | |
if: matrix.platform == 'ubuntu-22.04' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
- name: Install frontend dependencies | |
run: bun install | |
- name: Build frontend | |
run: bun run build | |
- name: Run tests | |
run: cd src-tauri && cargo test ${{ matrix.args }} | |
- name: Run frontend tests | |
run: bun test | |
- name: Run clippy | |
run: cd src-tauri && cargo clippy ${{ matrix.args }} -- -D warnings |