From fa3133a0943a27841a4dce0ac89c54d9ce048d9a Mon Sep 17 00:00:00 2001 From: NianJiuZst <3235467914@qq.com> Date: Thu, 9 Jul 2026 12:42:42 +0800 Subject: [PATCH] Add PR CI workflow --- .github/workflows/ci.yml | 84 +++++++++++++++++++++++++++++++++ crates/bsk-cli/src/daemon/ws.rs | 3 +- packages/ui/package.json | 4 ++ pnpm-lock.yaml | 7 +++ pnpm-workspace.yaml | 3 ++ 5 files changed, 100 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..6c0a879 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,84 @@ +name: CI + +on: + pull_request: + types: + - opened + - synchronize + - reopened + - ready_for_review + push: + branches: + - main + +permissions: + contents: read + +concurrency: + group: ci-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + rust: + name: Rust fmt, clippy, tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - uses: dtolnay/rust-toolchain@stable + + - name: Check Rust formatting + run: cargo fmt --all -- --check + + - name: Run clippy + run: cargo clippy --workspace --all-targets --locked -- -D warnings + + - name: Run Rust tests + run: cargo test --workspace --locked + + frontend: + name: Frontend lint, typecheck, tests, build + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - uses: pnpm/action-setup@v6 + + - uses: actions/setup-node@v6 + with: + node-version: 22 + cache: pnpm + + - name: Install dependencies + run: pnpm install --frozen-lockfile + + - name: Prepare extension types + run: pnpm --filter @browser-skill/extension exec wxt prepare + + - name: Run lint checks + run: pnpm lint + + - name: Compile extension TypeScript + run: pnpm --filter @browser-skill/extension compile + + - name: Run extension tests + run: pnpm ext:test + + - name: Build extension + run: pnpm ext:build + + node-scripts: + name: Node script tests + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v6 + + - uses: actions/setup-node@v6 + with: + node-version: 22 + + - name: Run script tests + run: node --test scripts/*.test.mjs diff --git a/crates/bsk-cli/src/daemon/ws.rs b/crates/bsk-cli/src/daemon/ws.rs index 05a62ac..4073771 100644 --- a/crates/bsk-cli/src/daemon/ws.rs +++ b/crates/bsk-cli/src/daemon/ws.rs @@ -124,7 +124,8 @@ async fn handle_connection( let captured_origin: std::sync::Arc>> = std::sync::Arc::new(std::sync::Mutex::new(None)); let captured_origin_for_cb = std::sync::Arc::clone(&captured_origin); - let callback = move |req: &Request, response: Response| -> Result { + #[allow(clippy::result_large_err)] + let callback = move |req: &Request, response: Response| { let origin = req .headers() .get("Origin") diff --git a/packages/ui/package.json b/packages/ui/package.json index 4565cde..3262209 100644 --- a/packages/ui/package.json +++ b/packages/ui/package.json @@ -21,5 +21,9 @@ "clsx": "^2.1.1", "tailwind-merge": "^3.6.0", "tw-animate-css": "^1.4.0" + }, + "devDependencies": { + "@types/react": "^19.2.14", + "@types/react-dom": "^19.2.3" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 776a1d2..6663b8f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -114,6 +114,13 @@ importers: tw-animate-css: specifier: ^1.4.0 version: 1.4.0 + devDependencies: + '@types/react': + specifier: ^19.2.14 + version: 19.2.14 + '@types/react-dom': + specifier: ^19.2.3 + version: 19.2.3(@types/react@19.2.14) packages: diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index 3ff5faa..64214fd 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -1,3 +1,6 @@ packages: - "apps/*" - "packages/*" +allowBuilds: + esbuild: true + spawn-sync: true