From 658a14f2901bebd30ee9ebafe8e55a2d69c536f0 Mon Sep 17 00:00:00 2001 From: t8y2 <1156263951@qq.com> Date: Sat, 23 May 2026 14:11:46 +0800 Subject: [PATCH] ci: split CI jobs, add clippy/test, upgrade actions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Split single check job into frontend / rust / jdbc parallel jobs - Add concurrency group to cancel redundant CI runs - Add pnpm cache via setup-node - Add cargo clippy and cargo test to CI - Unify Node version to 22 across all workflows - Upgrade pnpm/action-setup to v6 - Fix clippy never_loop errors (while let → if let) --- .github/workflows/ci.yml | 50 ++++++++++++++++++----- .github/workflows/docs.yml | 2 +- .github/workflows/mcp-release.yml | 2 +- .github/workflows/release.yml | 4 +- crates/dbx-web/src/routes/agents.rs | 2 +- crates/dbx-web/src/routes/sql_file.rs | 2 +- crates/dbx-web/src/routes/table_import.rs | 2 +- 7 files changed, 46 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56a05fec5f..5042ad7346 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,23 +6,26 @@ on: pull_request: branches: [main] +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + jobs: - check: + frontend: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Setup Node.js uses: actions/setup-node@v4 with: node-version: 22.13.0 + cache: pnpm - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v6 - - name: Install system dependencies (Linux) + - name: Install system dependencies run: | sudo apt-get update sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libsecret-1-dev @@ -45,15 +48,20 @@ jobs: - name: Node package publish dry run run: pnpm publish:dry-run + rust: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Install system dependencies + run: | + sudo apt-get update + sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev libsecret-1-dev + - name: Setup Rust uses: dtolnay/rust-toolchain@stable - - - name: Setup Java - uses: actions/setup-java@v4 with: - distribution: temurin - java-version: '17' - cache: maven + components: clippy - name: Rust cache uses: swatinem/rust-cache@v2 @@ -64,9 +72,29 @@ jobs: - name: Cargo fmt check run: cargo fmt --check + - name: Cargo clippy + run: cargo clippy --workspace --locked + - name: Cargo check run: cargo check --workspace --locked + - name: Cargo test + run: cargo test --workspace --locked + + jdbc: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: '17' + cache: maven + - name: JDBC plugin version guard env: BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }} diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index cf474a397e..45dfa9df9b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -25,7 +25,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 22 - - uses: pnpm/action-setup@v4 + - uses: pnpm/action-setup@v6 - run: cd docs && pnpm install --frozen-lockfile --ignore-workspace && pnpm build - name: Deploy to Cloudflare Workers working-directory: docs diff --git a/.github/workflows/mcp-release.yml b/.github/workflows/mcp-release.yml index d237004049..51175e53f2 100644 --- a/.github/workflows/mcp-release.yml +++ b/.github/workflows/mcp-release.yml @@ -22,7 +22,7 @@ jobs: fetch-depth: 0 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v6 - name: Setup Node.js uses: actions/setup-node@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 11e830fccb..24ededd648 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -73,10 +73,10 @@ jobs: - name: Setup Node.js uses: actions/setup-node@v4 with: - node-version: 20 + node-version: 22 - name: Setup pnpm - uses: pnpm/action-setup@v4 + uses: pnpm/action-setup@v6 - name: Install frontend dependencies run: pnpm install diff --git a/crates/dbx-web/src/routes/agents.rs b/crates/dbx-web/src/routes/agents.rs index 0a064cda89..e6bb4e8ee4 100644 --- a/crates/dbx-web/src/routes/agents.rs +++ b/crates/dbx-web/src/routes/agents.rs @@ -139,7 +139,7 @@ pub async fn import_agents_from_zip( let tmp_dir = state.data_dir.join("tmp"); std::fs::create_dir_all(&tmp_dir).map_err(|err| AppError(err.to_string()))?; - while let Some(field) = multipart.next_field().await.map_err(|err| AppError(err.to_string()))? { + if let Some(field) = multipart.next_field().await.map_err(|err| AppError(err.to_string()))? { let file_name = field.file_name().unwrap_or("offline-drivers.zip").to_string(); if !file_name.to_ascii_lowercase().ends_with(".zip") { return Err(AppError("Offline driver package must be a .zip file".to_string())); diff --git a/crates/dbx-web/src/routes/sql_file.rs b/crates/dbx-web/src/routes/sql_file.rs index f15d2d509f..710558419c 100644 --- a/crates/dbx-web/src/routes/sql_file.rs +++ b/crates/dbx-web/src/routes/sql_file.rs @@ -42,7 +42,7 @@ pub async fn preview_sql_file( let tmp_dir = state.data_dir.join("tmp"); std::fs::create_dir_all(&tmp_dir).map_err(|e| AppError(e.to_string()))?; - while let Some(field) = multipart.next_field().await.map_err(|e| AppError(e.to_string()))? { + if let Some(field) = multipart.next_field().await.map_err(|e| AppError(e.to_string()))? { let file_name = field.file_name().unwrap_or("upload.sql").to_string(); let data = field.bytes().await.map_err(|e| AppError(e.to_string()))?; diff --git a/crates/dbx-web/src/routes/table_import.rs b/crates/dbx-web/src/routes/table_import.rs index ad9b4c96ef..5a87ea425d 100644 --- a/crates/dbx-web/src/routes/table_import.rs +++ b/crates/dbx-web/src/routes/table_import.rs @@ -30,7 +30,7 @@ pub async fn preview_import( let tmp_dir = state.data_dir.join("tmp"); std::fs::create_dir_all(&tmp_dir).map_err(|e| AppError(e.to_string()))?; - while let Some(field) = multipart.next_field().await.map_err(|e| AppError(e.to_string()))? { + if let Some(field) = multipart.next_field().await.map_err(|e| AppError(e.to_string()))? { let file_name = field.file_name().unwrap_or("upload.csv").to_string(); let data = field.bytes().await.map_err(|e| AppError(e.to_string()))?;