From 316c41c05bbedde59435af576a187e0bf397ac20 Mon Sep 17 00:00:00 2001 From: MOMO0302-02 Date: Thu, 20 Aug 2026 10:12:19 +0800 Subject: [PATCH] ci: run lint, typecheck, format and unit tests on PRs and pushes The existing build.yml only runs on v* tags and never invokes the test suite, so pull requests get no automated checks. Add a lightweight CI workflow that runs format:check, lint:check and typecheck once on Linux and the unit tests on both Linux and Windows. Uses --ignore-scripts so it does not download the mihomo cores, which the checks and tests do not need. Co-authored-by: Claude Opus 4.8 --- .github/workflows/ci.yml | 68 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..14ecbd7a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,68 @@ +name: CI + +on: + pull_request: + push: + branches: + - smart_core + - main + paths-ignore: + - 'README.md' + - '.github/ISSUE_TEMPLATE/**' + - '.github/workflows/issues.yml' + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check: + name: Lint, typecheck & format + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: 'pnpm' + # --ignore-scripts skips the prepare step that downloads the mihomo cores; + # none of the static checks or unit tests need the sidecar binaries. + - name: Install dependencies + run: pnpm install --ignore-scripts + - name: Format check + run: pnpm run format:check + - name: Lint + run: pnpm run lint:check + - name: Typecheck + run: pnpm run typecheck + + test: + name: Unit tests (${{ matrix.os }}) + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - windows-latest + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup pnpm + uses: pnpm/action-setup@v4 + - name: Setup Node.js + uses: actions/setup-node@v6 + with: + node-version: 22 + cache: 'pnpm' + - name: Install dependencies + run: pnpm install --ignore-scripts + - name: Test + run: pnpm test