The `push` + `pull_request` combo doubled CI runs on every PR (visible on #170 with 4 pending checks instead of 2). Drop `push`, keep `pull_request: branches: [main]`. Trade-off: branches pushed without an open PR no longer get CI feedback. Open a draft PR if you want CI to run before requesting review — `/fix-issue` always opens a PR right after pushing, so the gap is essentially zero in practice. Also adds a concurrency group `ci-${{ github.ref }}` with cancel-in-progress so force-pushes cancel the previous run instead of stacking. Same change applied to .github/workflows/check.yml (GitHub mirror) to keep the two configs in sync. Fixes #171
73 lines
1.9 KiB
YAML
73 lines
1.9 KiB
YAML
name: PR Check
|
|
|
|
# Mirror of .forgejo/workflows/check.yml using GitHub-native runners.
|
|
# Forgejo is the primary host; this file keeps the GitHub mirror functional.
|
|
#
|
|
# Trigger is `pull_request` only — kept in sync with the Forgejo workflow
|
|
# after #171 dropped the redundant `push` trigger that duplicated every run.
|
|
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
# Cancel obsolete runs (e.g. on force-push) so only the latest commit runs.
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
rust:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Install system dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y --no-install-recommends \
|
|
pkg-config libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev libssl-dev
|
|
|
|
- name: Install Rust toolchain (stable)
|
|
uses: dtolnay/rust-toolchain@stable
|
|
|
|
- name: Cache cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/registry
|
|
~/.cargo/git
|
|
src-tauri/target
|
|
key: ${{ runner.os }}-cargo-${{ hashFiles('src-tauri/Cargo.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-cargo-
|
|
|
|
- name: cargo check
|
|
run: cargo check --manifest-path src-tauri/Cargo.toml --all-targets
|
|
|
|
- name: cargo test
|
|
run: cargo test --manifest-path src-tauri/Cargo.toml --all-targets
|
|
|
|
frontend:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js 20
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
|
|
- name: Install dependencies
|
|
run: npm ci
|
|
|
|
- name: Build (tsc + vite)
|
|
run: npm run build
|
|
|
|
- name: Tests (vitest)
|
|
run: npm test
|