fix: update workspace paths and optimize Rust caching in CI workflows

This commit is contained in:
t8y2 2026-05-05 21:45:17 +08:00
parent 15498b70fd
commit 8cc4dfb268
6 changed files with 19 additions and 110 deletions

View File

@ -37,7 +37,7 @@ jobs:
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
workspaces: './ -> target'
shared-key: release-x86_64-unknown-linux-gnu
- name: Install system dependencies (Linux)
@ -46,9 +46,7 @@ jobs:
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf libssl-dev
- name: Cargo fmt check
working-directory: src-tauri
run: cargo fmt --check
- name: Cargo check
working-directory: src-tauri
run: cargo check
run: cargo check --workspace --locked

View File

@ -49,13 +49,13 @@ jobs:
id: deps-hash
shell: bash
run: |
hash=$(grep -v '^version = ' src-tauri/Cargo.lock | sha256sum | cut -d' ' -f1)
hash=$(grep -v '^version = ' Cargo.lock | sha256sum | cut -d' ' -f1)
echo "hash=${hash:0:20}" >> "$GITHUB_OUTPUT"
- name: Rust cache
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
workspaces: './ -> target'
shared-key: release-${{ matrix.target }}-${{ steps.deps-hash.outputs.hash }}
cache-on-failure: true

97
Cargo.lock generated
View File

@ -367,18 +367,6 @@ dependencies = [
"tokio",
]
[[package]]
name = "async-native-tls"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d57d4cec3c647232e1094dc013546c0b33ce785d8aeb251e1f20dfaf8a9a13fe"
dependencies = [
"futures-util",
"native-tls",
"thiserror 1.0.69",
"url",
]
[[package]]
name = "async-stream"
version = "0.3.6"
@ -2528,17 +2516,6 @@ dependencies = [
"typenum",
]
[[package]]
name = "getrandom"
version = "0.1.16"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce"
dependencies = [
"cfg-if",
"libc",
"wasi 0.9.0+wasi-snapshot-preview1",
]
[[package]]
name = "getrandom"
version = "0.2.17"
@ -2548,7 +2525,7 @@ dependencies = [
"cfg-if",
"js-sys",
"libc",
"wasi 0.11.1+wasi-snapshot-preview1",
"wasi",
"wasm-bindgen",
]
@ -3852,12 +3829,6 @@ dependencies = [
"digest 0.10.7",
]
[[package]]
name = "md5"
version = "0.6.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7e6bcd6433cff03a4bfc3d9834d504467db1f1cf6d0ea765d37d330249ed629d"
[[package]]
name = "md5"
version = "0.7.0"
@ -3918,7 +3889,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50b7e5b27aa02a74bac8c3f23f448f8d87ff11f92d3aac1a6ed369ee08cc56c1"
dependencies = [
"libc",
"wasi 0.11.1+wasi-snapshot-preview1",
"wasi",
"windows-sys 0.61.2",
]
@ -5301,19 +5272,6 @@ version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09"
[[package]]
name = "rand"
version = "0.7.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03"
dependencies = [
"getrandom 0.1.16",
"libc",
"rand_chacha 0.2.2",
"rand_core 0.5.1",
"rand_hc",
]
[[package]]
name = "rand"
version = "0.8.6"
@ -5346,16 +5304,6 @@ dependencies = [
"rand_core 0.10.1",
]
[[package]]
name = "rand_chacha"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402"
dependencies = [
"ppv-lite86",
"rand_core 0.5.1",
]
[[package]]
name = "rand_chacha"
version = "0.3.1"
@ -5376,15 +5324,6 @@ dependencies = [
"rand_core 0.9.5",
]
[[package]]
name = "rand_core"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19"
dependencies = [
"getrandom 0.1.16",
]
[[package]]
name = "rand_core"
version = "0.6.4"
@ -5409,15 +5348,6 @@ version = "0.10.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69"
[[package]]
name = "rand_hc"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c"
dependencies = [
"rand_core 0.5.1",
]
[[package]]
name = "raw-window-handle"
version = "0.6.2"
@ -5789,7 +5719,7 @@ dependencies = [
"internal-russh-num-bigint",
"keccak",
"log",
"md5 0.7.0",
"md5",
"ml-kem",
"module-lattice",
"num-bigint",
@ -7674,7 +7604,6 @@ version = "0.12.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1446cb4198848d1562301a3340424b4f425ef79f35ef9ee034769a9dd92c10d"
dependencies = [
"async-native-tls",
"async-trait",
"asynchronous-codec",
"byteorder",
@ -7696,7 +7625,6 @@ dependencies = [
"tokio-util",
"tracing",
"uuid",
"winauth",
]
[[package]]
@ -8396,12 +8324,6 @@ dependencies = [
"try-lock",
]
[[package]]
name = "wasi"
version = "0.9.0+wasi-snapshot-preview1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519"
[[package]]
name = "wasi"
version = "0.11.1+wasi-snapshot-preview1"
@ -8734,19 +8656,6 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "winauth"
version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f820cd208ce9c6b050812dc2d724ba98c6c1e9db5ce9b3f58d925ae5723a5e6"
dependencies = [
"bitflags 1.3.2",
"byteorder",
"md5 0.6.1",
"rand 0.7.3",
"winapi",
]
[[package]]
name = "window-vibrancy"
version = "0.6.0"

View File

@ -5,6 +5,6 @@ members = ["src-tauri", "crates/dbx-core", "src-web"]
[profile.release]
panic = "abort"
strip = true
lto = true
lto = "thin"
codegen-units = 1
opt-level = "s"

View File

@ -9,12 +9,12 @@ RUN --mount=type=cache,target=/root/.local/share/pnpm/store \
pnpm install --frozen-lockfile
COPY src/ src/
COPY index.html vite.config.ts tsconfig.json ./
COPY tailwind.config.* postcss.config.* ./
COPY public/ public/
RUN pnpm build
# Stage 2: Cross-compile Rust backend for both platforms (native, no emulation)
# Stage 2: Cross-compile Rust backend for the requested platform (native, no emulation)
FROM --platform=$BUILDPLATFORM rust:1-bookworm AS backend
ARG TARGETARCH
WORKDIR /app
RUN apt-get update && apt-get install -y --no-install-recommends \
python3-pip gcc-aarch64-linux-gnu gcc-x86-64-linux-gnu \
@ -33,12 +33,14 @@ COPY src-tauri/tauri.conf.json src-tauri/
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/target \
cargo zigbuild --release -p dbx-web \
--target x86_64-unknown-linux-gnu \
--target aarch64-unknown-linux-gnu && \
mkdir -p /out/linux/amd64 /out/linux/arm64 && \
cp /app/target/x86_64-unknown-linux-gnu/release/dbx-web /out/linux/amd64/ && \
cp /app/target/aarch64-unknown-linux-gnu/release/dbx-web /out/linux/arm64/
case "$TARGETARCH" in \
amd64) rust_target=x86_64-unknown-linux-gnu ;; \
arm64) rust_target=aarch64-unknown-linux-gnu ;; \
*) echo "Unsupported TARGETARCH: $TARGETARCH" >&2; exit 1 ;; \
esac && \
cargo zigbuild --release -p dbx-web --target "$rust_target" && \
mkdir -p "/out/linux/$TARGETARCH" && \
cp "/app/target/$rust_target/release/dbx-web" "/out/linux/$TARGETARCH/"
# Stage 3: Final image
FROM debian:bookworm-slim

View File

@ -36,7 +36,7 @@ redis = { version = "0.32.2", features = ["tokio-comp", "tls-rustls", "tokio-rus
rustls = { version = "0.23", features = ["aws-lc-rs"] }
portpicker = "0.1.1"
duckdb = { version = "1.3.2", features = ["bundled"] }
tiberius = { version = "0.12.3", features = ["tds73", "chrono", "rust_decimal"] }
tiberius = { version = "0.12.3", default-features = false, features = ["tds73", "chrono", "rust_decimal", "rustls"] }
tokio-util = { version = "0.7", features = ["compat"] }
reqwest = { version = "0.12", features = ["json", "stream"] }
futures = "0.3"