Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

ci(rust): add sccache to packages and agent jobs, drop gha fallback

t8y29ae10f371788
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index ea97705d94..7298a68ff0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -78,6 +78,11 @@ jobs:
env:
# Unsupported-platform package warnings are expected while validating cross-platform package metadata.
NPM_CONFIG_LOGLEVEL: error
+ # sccache cannot reuse Cargo incremental artifacts, so avoid generating them in CI.
+ CARGO_INCREMENTAL: "0"
+ # Fork PRs cannot read repository secrets, so they build without sccache
+ # (see rust-fmt-clippy) and lean on the rust-cache restore from main.
+ RUSTC_WRAPPER: ${{ secrets.SCCACHE_S3_BUCKET != '' && 'sccache' || '' }}
steps:
- uses: actions/checkout@v5
@@ -106,12 +111,63 @@ jobs:
- name: Setup Rust
uses: dtolnay/[email protected]
+ - name: Setup sccache
+ uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
+ with:
+ version: "v0.10.0"
+
+ - name: Configure S3 sccache
+ if: env.RUSTC_WRAPPER == 'sccache'
+ shell: bash
+ env:
+ CACHE_BUCKET: ${{ secrets.SCCACHE_S3_BUCKET }}
+ CACHE_ENDPOINT: ${{ secrets.SCCACHE_S3_ENDPOINT }}
+ CACHE_REGION: ${{ secrets.SCCACHE_S3_REGION }}
+ CACHE_KEY_PREFIX: ${{ secrets.SCCACHE_S3_KEY_PREFIX }}
+ CACHE_ACCESS_KEY_ID: ${{ secrets.SCCACHE_S3_ACCESS_KEY_ID }}
+ CACHE_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_S3_SECRET_ACCESS_KEY }}
+ run: |
+ {
+ echo "SCCACHE_BUCKET=${CACHE_BUCKET}"
+ echo "SCCACHE_ENDPOINT=${CACHE_ENDPOINT}"
+ echo "SCCACHE_REGION=${CACHE_REGION}"
+ echo "SCCACHE_S3_KEY_PREFIX=${CACHE_KEY_PREFIX}"
+ echo "SCCACHE_S3_USE_SSL=true"
+ echo "AWS_ACCESS_KEY_ID=${CACHE_ACCESS_KEY_ID}"
+ echo "AWS_SECRET_ACCESS_KEY=${CACHE_SECRET_ACCESS_KEY}"
+ # Keep the server alive through post-compile test/lint phases so
+ # "Show sccache stats" reflects the real counters.
+ echo "SCCACHE_IDLE_TIMEOUT=0"
+ # Also cache the C/C++ compilation of -sys crates. These jobs are
+ # native Linux builds, so plain CC/CXX select the target compiler.
+ echo "CC=${SCCACHE_PATH} cc"
+ echo "CXX=${SCCACHE_PATH} c++"
+ } >> "$GITHUB_ENV"
+
+ - name: Rust cache
+ uses: swatinem/rust-cache@v2
+ with:
+ workspaces: "./ -> target"
+ shared-key: ci-packages-x86_64-unknown-linux-gnu
+ # Release-linking (LTO) dominates this job and sccache cannot cache
+ # those crate types.
+ cache-workspace-crates: true
+ # Preserve completed dependency builds when a later test step fails.
+ cache-on-failure: true
+ # PR caches are large and branch-scoped; restore them from main without saving per-PR copies.
+ save-if: ${{ github.ref == 'refs/heads/main' }}
+
- name: Node package tests
run: pnpm test:packages
- name: Node package publish dry run
run: pnpm publish:dry-run
+ - name: Show sccache stats
+ if: always()
+ continue-on-error: true
+ run: ${SCCACHE_PATH} --show-stats
+
windows-win7-bundle:
needs: changes
if: needs.changes.outputs.windows_win7_bundle == 'true'
@@ -263,11 +319,12 @@ jobs:
env:
# sccache cannot reuse Cargo incremental artifacts, so avoid generating them in CI.
CARGO_INCREMENTAL: "0"
- RUSTC_WRAPPER: sccache
+ # Fork PRs cannot read repository secrets, and the GHA sccache backend can
+ # never hold entries for this repo because main only populates S3, so fork
+ # builds run without sccache and lean on the rust-cache restore from main.
+ RUSTC_WRAPPER: ${{ secrets.SCCACHE_S3_BUCKET != '' && 'sccache' || '' }}
# The fast lane skips only system font discovery while retaining the other default capabilities.
RUST_FEATURE_MODE: ${{ github.event_name == 'pull_request' && needs.changes.outputs.rust_full != 'true' && 'fast' || 'full' }}
- # Fork PRs cannot read repository secrets, so retain the GHA backend for them.
- SCCACHE_GHA_ENABLED: ${{ secrets.SCCACHE_S3_BUCKET == '' && 'true' || 'false' }}
steps:
- uses: actions/checkout@v5
@@ -287,7 +344,7 @@ jobs:
version: "v0.10.0"
- name: Configure S3 sccache
- if: env.SCCACHE_GHA_ENABLED != 'true'
+ if: env.RUSTC_WRAPPER == 'sccache'
shell: bash
env:
CACHE_BUCKET: ${{ secrets.SCCACHE_S3_BUCKET }}
@@ -344,11 +401,12 @@ jobs:
CARGO_INCREMENTAL: "0"
# Deep async export tests exceed the Rust test harness's default thread stack on Linux.
RUST_MIN_STACK: 8388608
- RUSTC_WRAPPER: sccache
+ # Fork PRs cannot read repository secrets, and the GHA sccache backend can
+ # never hold entries for this repo because main only populates S3, so fork
+ # builds run without sccache and lean on the rust-cache restore from main.
+ RUSTC_WRAPPER: ${{ secrets.SCCACHE_S3_BUCKET != '' && 'sccache' || '' }}
# The fast lane skips only system font discovery while retaining the other default capabilities.
RUST_FEATURE_MODE: ${{ github.event_name == 'pull_request' && needs.changes.outputs.rust_full != 'true' && 'fast' || 'full' }}
- # Fork PRs cannot read repository secrets, so retain the GHA backend for them.
- SCCACHE_GHA_ENABLED: ${{ secrets.SCCACHE_S3_BUCKET == '' && 'true' || 'false' }}
RUST_TEST_GROUP: ${{ matrix.group }}
steps:
- uses: actions/checkout@v5
@@ -368,7 +426,7 @@ jobs:
version: "v0.10.0"
- name: Configure S3 sccache
- if: env.SCCACHE_GHA_ENABLED != 'true'
+ if: env.RUSTC_WRAPPER == 'sccache'
shell: bash
env:
CACHE_BUCKET: ${{ secrets.SCCACHE_S3_BUCKET }}
@@ -791,6 +849,12 @@ jobs:
needs: [changes, fast-checks, agent-checks]
if: needs.changes.outputs.agent_rust_changed == 'true'
runs-on: ubuntu-22.04
+ env:
+ # sccache cannot reuse Cargo incremental artifacts, so avoid generating them in CI.
+ CARGO_INCREMENTAL: "0"
+ # Fork PRs cannot read repository secrets, so they build without sccache
+ # (see rust-fmt-clippy) and lean on the rust-cache restore from main.
+ RUSTC_WRAPPER: ${{ secrets.SCCACHE_S3_BUCKET != '' && 'sccache' || '' }}
defaults:
run:
working-directory: agents
@@ -798,6 +862,38 @@ jobs:
- uses: actions/checkout@v5
- name: Setup Rust
uses: dtolnay/[email protected]
+ - name: Setup sccache
+ uses: mozilla-actions/sccache-action@9e7fa8a12102821edf02ca5dbea1acd0f89a2696 # v0.0.10
+ with:
+ version: "v0.10.0"
+ - name: Configure S3 sccache
+ if: env.RUSTC_WRAPPER == 'sccache'
+ shell: bash
+ env:
+ CACHE_BUCKET: ${{ secrets.SCCACHE_S3_BUCKET }}
+ CACHE_ENDPOINT: ${{ secrets.SCCACHE_S3_ENDPOINT }}
+ CACHE_REGION: ${{ secrets.SCCACHE_S3_REGION }}
+ CACHE_KEY_PREFIX: ${{ secrets.SCCACHE_S3_KEY_PREFIX }}
+ CACHE_ACCESS_KEY_ID: ${{ secrets.SCCACHE_S3_ACCESS_KEY_ID }}
+ CACHE_SECRET_ACCESS_KEY: ${{ secrets.SCCACHE_S3_SECRET_ACCESS_KEY }}
+ run: |
+ {
+ echo "SCCACHE_BUCKET=${CACHE_BUCKET}"
+ echo "SCCACHE_ENDPOINT=${CACHE_ENDPOINT}"
+ echo "SCCACHE_REGION=${CACHE_REGION}"
+ echo "SCCACHE_S3_KEY_PREFIX=${CACHE_KEY_PREFIX}"
+ echo "SCCACHE_S3_USE_SSL=true"
+ echo "AWS_ACCESS_KEY_ID=${CACHE_ACCESS_KEY_ID}"
+ echo "AWS_SECRET_ACCESS_KEY=${CACHE_SECRET_ACCESS_KEY}"
+ # Keep the server alive through post-compile test/lint phases so
+ # "Show sccache stats" reflects the real counters.
+ echo "SCCACHE_IDLE_TIMEOUT=0"
+ # The duckdb driver builds a large bundled C++ library through its
+ # build script; wrapping CC/CXX lets sccache cache those compiles
+ # too (rust-cache alone recompiles all of it on every lock change).
+ echo "CC=${SCCACHE_PATH} cc"
+ echo "CXX=${SCCACHE_PATH} c++"
+ } >> "$GITHUB_ENV"
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
@@ -811,6 +907,11 @@ jobs:
- name: TDengine native agent build
if: matrix.driver == 'tdengine'
run: cargo build --manifest-path drivers/tdengine/Cargo.toml --locked --release --bin dbx-tdengine-driver
+ # Diagnostics only; agent jobs must not swallow build/test failures
+ # (ci-workflow.test.mjs), so keep this step best-effort at the command level.
+ - name: Show sccache stats
+ if: always()
+ run: ${SCCACHE_PATH} --show-stats || true
strategy:
fail-fast: false
max-parallel: 2