This is an automated email from the ASF dual-hosted git repository.

chaokunyang pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fory.git


The following commit(s) were added to refs/heads/main by this push:
     new 243755e3a perf(ci): add Cargo caching to Rust CI jobs (#3431)
243755e3a is described below

commit 243755e3abcfefeda4cce7d00c99c0830f36552d
Author: Charlie_Moon <[email protected]>
AuthorDate: Thu Mar 5 22:03:26 2026 +0900

    perf(ci): add Cargo caching to Rust CI jobs (#3431)
    
    ## Why?
    
    The Rust CI currently takes approximately 3-5 minutes to complete. By
    adding Cargo dependency caching, we can reduce build times by caching
    compiled dependencies between runs.
    
    ## What does this PR do?
    
    - Adds `Swatinem/rust-cache@v2` to the `rust` job in
    `.github/workflows/ci.yml`
    - Adds `Swatinem/rust-cache@v2` to the `rust_xlang` job in
    `.github/workflows/ci.yml`
    - Configures cache to use the `rust` workspace directory
    
    ## Related issues
    
    Closes #2889
    
    ## Does this PR introduce any user-facing change?
    
    No user-facing changes. This only affects CI execution time.
    
    - [ ] Does this PR introduce any public API change?
    - [ ] Does this PR introduce any binary protocol compatibility change?
    
    ## Benchmark
    
    **CI execution time comparison:**
    
    | Job | Before (main) | After (with cache) | Improvement |
    |-----|---------------|-------------------|-------------|
    | Rust CI (ubuntu-latest) | 3m 13s | 2m 54s | ✅ **-19s** |
    | Rust CI (macos-14) | 3m 02s | 2m 53s | ✅ **-9s** |
    | Rust CI (macos-latest) | 3m 16s | 3m 22s | ⚠️ +6s |
    
    **Cache details:**
    - Cache size: ~14MB
    - Cache includes: `~/.cargo/bin`, `~/.cargo/registry`, `~/.cargo/git`,
    `rust/target`
    - Logs confirm: `Cache restored successfully` with full match
    - Cache key format: `v0-rust-rust-Linux-x64-<env-hash>-<lockfile-hash>`
    
    **Notes:**
    - Ubuntu shows consistent improvement (~19s faster)
    - macOS results are within normal variance range for GitHub Actions
    runners
    - Cache prevents re-downloading and re-compiling Rust dependencies on
    subsequent runs
---
 .github/workflows/ci.yml | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 168db47a5..2fbeaaa97 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -512,6 +512,10 @@ jobs:
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
+      - name: Cache Cargo dependencies
+        uses: Swatinem/rust-cache@v2
+        with:
+          workspaces: rust
       - name: Run Rust CI
         run: python ./ci/run_ci.py rust
 
@@ -536,6 +540,10 @@ jobs:
           key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
           restore-keys: |
             ${{ runner.os }}-maven-
+      - name: Cache Cargo dependencies
+        uses: Swatinem/rust-cache@v2
+        with:
+          workspaces: rust
       - name: Run Rust Xlang Test
         env:
           FORY_RUST_JAVA_CI: "1"


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to