diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..59f3ee6 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,49 @@ +name: CI + +on: + pull_request: + push: + branches: [main] + +permissions: + contents: read + +# A new push to the same PR cancels the run it replaces. +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + # Apple Silicon runner; the app uses AppKit and Metal, so it only builds on macOS. + runs-on: macos-latest + timeout-minutes: 45 + steps: + # Actions are pinned to commit SHAs so a moved tag can't change what runs. + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + + - uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 + with: + node-version: 22 + cache: npm + + - uses: dtolnay/rust-toolchain@89b12181fb390509a0842a86cc55eeb8eb928c1d # stable + with: + components: clippy + + - uses: Swatinem/rust-cache@6323deb102c322ba6fcbdcafc7e3dddab59af2b6 # v2.9.2 + with: + workspaces: src-tauri + + - run: npm ci + + # Typechecks the frontend and produces dist/, which the Tauri build embeds. + - run: npm run build + + - name: Rust tests + working-directory: src-tauri + run: cargo test + + - name: Clippy + working-directory: src-tauri + run: cargo clippy --all-targets -- -D warnings