-
Notifications
You must be signed in to change notification settings - Fork 31
Release/260330 #53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release/260330 #53
Changes from all commits
640292a
521d466
a76cc97
1632fcb
285359f
e634167
c925cab
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,71 @@ | ||||||||||||||||||||||||||||||||
| name: Multi-Platform Build | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||
| workflow_dispatch: | ||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||
| tags: | ||||||||||||||||||||||||||||||||
| - "v*" | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||
| build: | ||||||||||||||||||||||||||||||||
| name: Build (${{ matrix.platform }}) | ||||||||||||||||||||||||||||||||
| runs-on: ${{ matrix.os }} | ||||||||||||||||||||||||||||||||
| timeout-minutes: 30 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||
| include: | ||||||||||||||||||||||||||||||||
| - platform: linux | ||||||||||||||||||||||||||||||||
| os: ubuntu-22.04 | ||||||||||||||||||||||||||||||||
| - platform: macos | ||||||||||||||||||||||||||||||||
| os: macos-latest | ||||||||||||||||||||||||||||||||
| - platform: windows | ||||||||||||||||||||||||||||||||
| os: windows-latest | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Setup Bun | ||||||||||||||||||||||||||||||||
| uses: oven-sh/setup-bun@v2 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| bun-version: latest | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Cache Bun dependencies | ||||||||||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||||||||||
| node_modules | ||||||||||||||||||||||||||||||||
| ~/.bun/install/cache | ||||||||||||||||||||||||||||||||
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | ||||||||||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||||||||||
| ${{ runner.os }}-bun- | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Install frontend dependencies | ||||||||||||||||||||||||||||||||
| run: bun install --frozen-lockfile | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Setup Rust toolchain | ||||||||||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Cache Rust build artifacts | ||||||||||||||||||||||||||||||||
| uses: Swatinem/rust-cache@v2 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| workspaces: src-tauri -> src-tauri/target | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Install Linux dependencies | ||||||||||||||||||||||||||||||||
| if: matrix.platform == 'linux' | ||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||
| sudo apt-get update | ||||||||||||||||||||||||||||||||
| sudo apt-get install -y libgtk-3-dev libwebkit2gtk-4.1-dev libayatana-appindicator3-dev librsvg2-dev | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Build Tauri app | ||||||||||||||||||||||||||||||||
| run: bun tauri build | ||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||
| - name: Upload artifacts | ||||||||||||||||||||||||||||||||
| uses: actions/upload-artifact@v4 | ||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||
| name: dbpaw-${{ matrix.platform }} | ||||||||||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||||||||||
| src-tauri/target/release/bundle/ | ||||||||||||||||||||||||||||||||
| retention-days: 7 | ||||||||||||||||||||||||||||||||
|
Comment on lines
+65
to
+71
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: The if-no-files-found parameter in actions/upload-artifact@v4 controls the action's behavior when no files match the provided path. It is optional with a default value of warn. Available options: - warn: Outputs a warning but does not fail the action (default). - error: Fails the action with an error message. - ignore: Outputs no warnings or errors, and the action does not fail. Example usage: - uses: actions/upload-artifact@v4 with: name: my-artifact path: path/to/artifact/ if-no-files-found: error This feature allows customization of the response when no files are found for upload, improving workflow reliability. Citations:
Fail the workflow when no bundle is uploaded.
📦 Make missing artifacts fail fast - name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: dbpaw-${{ matrix.platform }}
path: |
src-tauri/target/release/bundle/
+ if-no-files-found: error
retention-days: 7📝 Committable suggestion
Suggested change
🧰 Tools🪛 GitHub Check: CodeQL[warning] 11-71: Workflow does not contain permissions 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -4,63 +4,129 @@ | |||||||||||||||||||||||||||||||||||||||||||||||||||
| pull_request: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| push: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| branches: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - main | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| test: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Fast smoke tests run first to fail fast | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| smoke: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Smoke Tests (typecheck, lint, unit) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-22.04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 40 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 10 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+7
to
+16
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Locate and read the CI workflow file
fd 'ci\.yml' --type fRepository: codeErrorSleep/dbpaw Length of output: 46 🏁 Script executed: # Read the full CI workflow file to understand structure and existing permissions
cat -n '.github/workflows/ci.yml'Repository: codeErrorSleep/dbpaw Length of output: 4280 Set explicit Currently, the workflow lacks an explicit 🔐 Suggested hardening on:
pull_request:
branches:
- main
push:
branches:
- main
+
+permissions:
+ contents: read📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Bun | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: oven-sh/setup-bun@v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| bun-version: latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Cache Bun dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| node_modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ~/.bun/install/cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${{ runner.os }}-bun- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install frontend dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bun install --frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Rust toolchain | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| components: rustfmt | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Cache Rust build artifacts | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: Swatinem/rust-cache@v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workspaces: src-tauri -> src-tauri/target | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run unit tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bun run test:unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run smoke tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bun run test:smoke | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Parallel database integration tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| integration: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
14
to
+54
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 2 months ago In general, this is fixed by explicitly defining a The best minimal fix without changing existing functionality is to add a root-level permissions:
contents: readafter line 10 (the last line of the
Suggested changeset
1
.github/workflows/ci.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: Integration Tests (${{ matrix.database }}) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-22.04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: smoke | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| timeout-minutes: 15 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run service tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bun run test:service | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| strategy: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fail-fast: false | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| matrix: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| database: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mysql | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - postgres | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mariadb | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - clickhouse | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - mssql | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - sqlite | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - duckdb | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run rust unit tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bun run test:rust:unit | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Checkout | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run integration tests (MySQL + Postgres with testcontainers) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: IT_DB=all bun run test:integration | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Bun | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: oven-sh/setup-bun@v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| bun-version: latest | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Cache Bun dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: actions/cache@v4 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| node_modules | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ~/.bun/install/cache | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| restore-keys: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ${{ runner.os }}-bun- | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Install frontend dependencies | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: bun install --frozen-lockfile | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Setup Rust toolchain | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Cache Rust build artifacts | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| uses: Swatinem/rust-cache@v2 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| workspaces: src-tauri -> src-tauri/target | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| key: ${{ matrix.database }} | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Run ${{ matrix.database }} integration tests | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: IT_DB=${{ matrix.database }} bun run test:integration | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Docker diagnostics on failure | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: failure() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "==== docker ps -a ====" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker ps -a || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "==== recent mysql/postgres logs ====" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for image in mysql:8.0 postgres:16-alpine; do | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| for id in $(docker ps -aq --filter "ancestor=${image}"); do | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "--- logs for $id (${image}) ---" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker logs "$id" || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| done | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "==== Container logs ====" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| docker ps -aq | xargs -I {} sh -c 'echo "--- Container {} ---" && docker logs {} 2>&1 | tail -50' || true | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| # Summary job to check all tests passed | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| ci-success: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
55
to
115
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Copilot AutofixAI 2 months ago In general, the fix is to add an explicit The single best fix here without changing existing functionality is to add a root-level permissions:
contents: readThis documents that the workflow needs only read access to repository contents and constrains
Suggested changeset
1
.github/workflows/ci.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| name: CI Success | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-22.04 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| needs: [smoke, integration] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if: always() | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| - name: Check all jobs succeeded | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "${{ needs.smoke.result }}" != "success" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Smoke tests failed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| if [ "${{ needs.integration.result }}" != "success" ]; then | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "Integration tests failed" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| exit 1 | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||||||||||||||||||
| echo "All CI checks passed!" | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
116
to
132
Check warningCode scanning / CodeQL Workflow does not contain permissions Medium
Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Copilot AutofixAI 2 months ago In general, the problem is fixed by explicitly specifying a The best fix with minimal functional change is to add a top-level Concretely:
permissions:
contents: read
Suggested changeset
1
.github/workflows/ci.yml
Copilot is powered by AI and may make mistakes. Always verify output.
Refresh and try again.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,185 @@ | ||
| # CLAUDE.md | ||
|
|
||
| This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. | ||
|
|
||
| ## Project Overview | ||
|
|
||
| DbPaw is a cross-platform database client built with Tauri v2, supporting PostgreSQL, MySQL, MariaDB, TiDB, SQLite, SQL Server, ClickHouse, and DuckDB. The architecture separates frontend (React/TypeScript) from backend (Rust) with communication via Tauri commands. | ||
|
|
||
| ## Essential Commands | ||
|
|
||
| ### Development | ||
| - `bun install` - Install dependencies | ||
| - `bun dev:mock` - Frontend-only development with mock data (recommended for UI work) | ||
| - `bun tauri dev` - Full Tauri app with Rust backend (for end-to-end testing) | ||
| - `bun tauri build` - Production build | ||
|
|
||
| ### Testing | ||
| For comprehensive testing documentation, see [TESTING.md](TESTING.md). | ||
|
|
||
| Quick reference: | ||
| - `bun run test:all` - Run all tests (unit, service, Rust, integration) | ||
| - `bun run test:unit` - Run TypeScript unit tests (files: `*.unit.test.ts`) | ||
| - `bun run test:service` - Run service layer tests (files: `*.service.test.ts`) | ||
| - `bun run test:rust:unit` - Run Rust unit tests (`cargo test --lib`) | ||
| - `bun run test:integration` - Run database integration tests (requires Docker) | ||
| - `IT_DB=mysql bun run test:integration` - Test specific database | ||
| - `IT_DB=all bun run test:integration` - Test all databases | ||
| - `IT_REUSE_LOCAL_DB=1` - Reuse existing local database containers | ||
| - `bun run test:smoke` - Quick validation (typecheck, lint, unit tests) | ||
| - `bun run test:ci` - Full CI test suite | ||
|
|
||
| ### Code Quality | ||
| - `bun run typecheck` - TypeScript type checking | ||
| - `bun run lint` - Lint TypeScript/JSON files with Prettier | ||
| - `bun run lint:rust` - Check Rust code (`cargo check`) | ||
| - `bun run format` - Format TypeScript files with Prettier | ||
|
|
||
| ### Website | ||
| - `bun run website:dev` - Run Astro marketing site locally | ||
| - `bun run website:build` - Build marketing site | ||
|
|
||
| ## Architecture | ||
|
|
||
| ### Frontend (React + TypeScript) | ||
|
|
||
| **Directory Structure:** | ||
| - `src/components/ui/` - Shadcn/UI components (base UI primitives) | ||
| - `src/components/business/` - Business logic components: | ||
| - `Editor/` - SQL editor (Monaco/CodeMirror) | ||
| - `DataGrid/` - Query results and table data display | ||
| - `Sidebar/` - Connection/database tree navigation | ||
| - `Metadata/` - Table structure and schema views | ||
| - `SqlLogs/` - Query execution history | ||
| - `src/components/settings/` - Settings dialogs | ||
| - `src/services/` - Tauri API wrapper and mocks | ||
| - `src/lib/` - Utilities (i18n, keyboard shortcuts, validation) | ||
| - `src/theme/` - Theme registry and management | ||
|
|
||
| **Key Patterns:** | ||
| - All Tauri backend calls go through `src/services/api.ts` which provides: | ||
| - Mock mode (`VITE_USE_MOCK=true`) for frontend-only development | ||
| - Type-safe wrappers around Tauri `invoke()` commands | ||
| - Runtime detection (`isTauri()`) to handle non-Tauri environments | ||
| - Path alias: `@/` maps to `./src/` | ||
| - i18n: Files in `src/lib/i18n/locales/` (en, zh, ja supported) | ||
|
|
||
| ### Backend (Rust + Tauri) | ||
|
|
||
| **Core Modules:** | ||
| - `src-tauri/src/commands/` - Tauri command handlers (exposed to frontend): | ||
| - `connection.rs` - Connection CRUD and testing | ||
| - `query.rs` - Query execution and cancellation | ||
| - `metadata.rs` - Schema inspection (tables, structures, DDL) | ||
| - `storage.rs` - Saved queries persistence | ||
| - `ai.rs` - AI provider management and chat | ||
| - `transfer.rs` - Import/export operations | ||
| - `src-tauri/src/db/` - Database layer: | ||
| - `drivers/` - Per-database implementations (postgres, mysql, clickhouse, mssql, sqlite, duckdb) | ||
| - `pool_manager.rs` - Connection pooling with bb8 | ||
| - `local.rs` - SQLite database for app metadata | ||
| - `src-tauri/src/state.rs` - Global app state (local DB + pool manager) | ||
| - `src-tauri/src/ssh.rs` - SSH tunnel support | ||
| - `src-tauri/src/ai/` - AI provider integration (OpenAI-compatible APIs) | ||
| - `src-tauri/src/models/` - Shared data types | ||
| - `src-tauri/src/error.rs` - Error handling | ||
|
|
||
| **Key Patterns:** | ||
| - All database drivers implement `DatabaseDriver` trait (see `src-tauri/src/db/drivers/mod.rs`) | ||
| - Connection pooling: Each database connection gets a managed pool via `PoolManager` | ||
| - State management: `AppState` holds `local_db` (SQLite) and `pool_manager` | ||
| - SSH tunneling: Transparent port forwarding for remote database access | ||
| - Error messages: Use `conn_failed_error()` to provide context-aware hints (TLS issues, auth failures, network problems) | ||
|
|
||
| ### Testing Strategy | ||
|
|
||
| DbPaw uses a **3-layer testing approach** (see [TESTING.md](TESTING.md) for full details): | ||
|
|
||
| ``` | ||
| Frontend Layer → Unit tests (*.unit.test.ts) + Service tests (*.service.test.ts) | ||
| Tauri Commands → Command integration tests (*_command_integration.rs) | ||
| Database Drivers → Driver integration tests (*_integration.rs) | ||
| ``` | ||
|
|
||
| **Test Coverage by Database:** | ||
| - ✅ **MySQL & PostgreSQL**: Complete (driver + command + stateful tests) | ||
| - 🟢 **MariaDB, MSSQL, ClickHouse, SQLite, DuckDB**: Driver + command tests (stateful tests pending) | ||
|
|
||
| **TypeScript Tests:** | ||
| - Unit tests: `*.unit.test.ts` - Pure logic, no external dependencies | ||
| - Service tests: `*.service.test.ts` - Mock-based service layer tests | ||
| - Test runner: Bun's built-in test runner | ||
|
|
||
| **Rust Tests:** | ||
| - Unit tests: `#[test]` in source files, run with `cargo test --lib` | ||
| - Driver integration tests: `src-tauri/tests/<db>_integration.rs` - Direct driver method testing | ||
| - Command integration tests: `src-tauri/tests/<db>_command_integration.rs` - Ephemeral connection commands | ||
| - Stateful command tests: `src-tauri/tests/<db>_stateful_command_integration.rs` - Saved connection workflows | ||
| - All integration tests: | ||
| - Use testcontainers for real database instances | ||
| - Marked with `#[ignore]` (only run explicitly) | ||
| - Environment: `IT_DB` (mysql/postgres/mariadb/clickhouse/mssql/sqlite/duckdb/all) | ||
| - Helpers in `src-tauri/tests/common/` provide database context setup | ||
|
|
||
| ### Database Driver Development | ||
|
|
||
| When adding/modifying database drivers: | ||
| 1. Implement `DatabaseDriver` trait in `src-tauri/src/db/drivers/<driver>.rs` | ||
| 2. Add to driver enum in `src-tauri/src/db/drivers/mod.rs` | ||
| 3. Handle driver-specific connection strings and options | ||
| 4. Use `conn_failed_error()` for user-friendly connection error messages | ||
| 5. Add integration tests in `src-tauri/tests/<driver>_integration.rs` | ||
| 6. Update `scripts/test-integration.sh` to include new driver | ||
|
|
||
| ### Common Patterns | ||
|
|
||
| **Frontend-Backend Communication:** | ||
| ```typescript | ||
| // Frontend | ||
| import { api } from '@/services/api'; | ||
| const result = await api.execute_query(connectionId, database, sql); | ||
| ``` | ||
|
|
||
| ```rust | ||
| // Backend | ||
| #[tauri::command] | ||
| async fn execute_query( | ||
| state: State<'_, AppState>, | ||
| connection_id: i64, | ||
| database: Option<String>, | ||
| sql: String, | ||
| ) -> Result<QueryResult, String> { | ||
| // Implementation | ||
| } | ||
| ``` | ||
|
|
||
| **Mock Development:** | ||
| - Use `bun dev:mock` for rapid UI iteration without Rust compilation | ||
| - Mocks defined in `src/services/mocks.ts` | ||
| - Useful for working on: themes, UI components, layouts, i18n | ||
|
|
||
| **SSH Tunneling:** | ||
| - Handled transparently in connection layer | ||
| - SSH config in connection form, tunnel established before database connection | ||
| - Port forwarding lifetime managed with connection pool | ||
|
|
||
| ## Build System | ||
|
|
||
| - Frontend: Vite with React plugin and TailwindCSS | ||
| - Backend: Cargo with sqlx (compile-time SQL checking disabled), tiberius (SQL Server), bb8 (pooling) | ||
| - Platform toolchain: Follows Tauri v2 prerequisites (see https://tauri.app/start/prerequisites/) | ||
| - Package manager: Bun (preferred) or npm/pnpm | ||
|
|
||
| ## CI/GitHub Actions | ||
|
|
||
| - `.github/workflows/ci.yml` - Main CI pipeline | ||
| - Tests run on: Ubuntu (Linux), macOS, Windows | ||
| - Integration tests use Docker containers (testcontainers) | ||
| - Release builds triggered on tags | ||
|
|
||
| ## Translation/i18n | ||
|
|
||
| - Framework: i18next + react-i18next | ||
| - Locale files: `src/lib/i18n/locales/*.ts` (TypeScript, not JSON) | ||
| - Supported: English (en), Chinese (zh), Japanese (ja) | ||
| - To add language: Create locale file and register in `src/lib/i18n/index.ts` |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Copilot Autofix
AI 2 months ago
In general, the fix is to add a
permissions:block to the workflow (either at the root level or for the specific job) specifying the minimal permissions the GITHUB_TOKEN needs. For a pure build-and-artifact-upload workflow like this,contents: readis typically sufficient, since no step pushes code, creates releases, or modifies issues or pull requests.The single best way to fix this without changing functionality is to add a root-level
permissions:block right after thename:declaration. This will apply to all jobs in the workflow that do not set their ownpermissions. Based on the shown steps (checkout, caching, installing dependencies, building, and uploading artifacts), the workflow only needs read access to repository contents, so we set:You only need to edit
.github/workflows/build-multiplatform.yml, inserting these lines near the top; no imports or additional methods are required.