mirror of
https://github.com/l0ng-ai/openidea.git
synced 2026-11-06 16:08:05 +00:00
Adds knip (pnpm knip, knip.ts covering src, scripts, perf and e2e) and runs it in the CI frontend job. Removes what it reported: the unused codemirror and @types/dompurify dependencies, exports and test hooks used nowhere (AppLogo, Tooltip, barrel re-exports, duplicate default exports of lazily loaded settings pages), the unused iterateAll helper, and the zh entry for a deleted notification. rustfmt (used by lint-staged) is ignored as a toolchain binary. Co-authored-by: jaw52 <53564781+jaw52@users.noreply.github.com>
110 lines
3.6 KiB
YAML
110 lines
3.6 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ci-${{ github.ref }}
|
|
# A newer push supersedes the run in progress, on main too.
|
|
cancel-in-progress: true
|
|
|
|
env:
|
|
CARGO_TERM_COLOR: always
|
|
CARGO_INCREMENTAL: 0
|
|
|
|
jobs:
|
|
rust:
|
|
name: Rust (${{ matrix.os }})
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [macos-latest, ubuntu-22.04, windows-latest]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with: { version: 11 }
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: 22, cache: pnpm }
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with: { components: "clippy, rustfmt" }
|
|
# Only main saves the cache (saving takes minutes on Windows); PRs restore main's.
|
|
- uses: Swatinem/rust-cache@v2
|
|
with:
|
|
save-if: ${{ github.ref == 'refs/heads/main' }}
|
|
- uses: taiki-e/install-action@nextest
|
|
- name: Linux deps
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev libxdo-dev libssl-dev patchelf
|
|
# tauri-build checks that frontendDist exists.
|
|
- run: pnpm install --frozen-lockfile && mkdir -p dist
|
|
shell: bash
|
|
- if: runner.os == 'Linux'
|
|
run: cargo fmt --all --check
|
|
- run: cargo clippy --workspace --all-targets -- -D warnings
|
|
# Test fixtures write LF files; keep Git from converting them on checkout.
|
|
- run: git config --global core.autocrlf false
|
|
- run: cargo nextest run --workspace --no-fail-fast
|
|
# nextest ran export_bindings, which rewrites src/bindings.ts.
|
|
- name: Bindings are up to date
|
|
if: runner.os == 'Linux'
|
|
run: git diff --exit-code src/bindings.ts
|
|
|
|
# The remote development server ships as a static Linux binary (release.yml):
|
|
# keep that build working.
|
|
server:
|
|
name: Remote server (linux musl)
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: dtolnay/rust-toolchain@stable
|
|
with: { targets: x86_64-unknown-linux-musl }
|
|
- uses: Swatinem/rust-cache@v2
|
|
with: { key: server-musl }
|
|
- run: sudo apt-get update && sudo apt-get install -y musl-tools
|
|
- run: cargo build --locked -p ide-host --bin openidea-server --target x86_64-unknown-linux-musl
|
|
- run: target/x86_64-unknown-linux-musl/debug/openidea-server --version
|
|
|
|
frontend:
|
|
name: Frontend
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with: { version: 11 }
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: 22, cache: pnpm }
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm typecheck
|
|
- run: pnpm lint
|
|
- run: pnpm format:check
|
|
- run: pnpm knip
|
|
- run: pnpm test
|
|
- run: pnpm build
|
|
|
|
e2e:
|
|
name: E2E
|
|
runs-on: ubuntu-24.04
|
|
# Browsers and their system libraries are preinstalled; keep the tag in step with @playwright/test.
|
|
container: mcr.microsoft.com/playwright:v1.64.1-noble
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: pnpm/action-setup@v4
|
|
with: { version: 11 }
|
|
- uses: actions/setup-node@v4
|
|
with: { node-version: 22, cache: pnpm }
|
|
- run: pnpm install --frozen-lockfile
|
|
- run: pnpm e2e
|
|
env:
|
|
HOME: /root
|
|
- uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: playwright-report
|
|
path: playwright-report/
|
|
retention-days: 7
|