From a41805e1a0b7da6a88717c18992f10ed86fde547 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 20:06:23 -0500 Subject: [PATCH 01/12] ci: add build workflow --- .github/actions/setup/action.yml | 14 +++++++ .github/workflows/build.yml | 65 ++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+) create mode 100644 .github/actions/setup/action.yml create mode 100644 .github/workflows/build.yml diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml new file mode 100644 index 0000000..bc4de21 --- /dev/null +++ b/.github/actions/setup/action.yml @@ -0,0 +1,14 @@ +name: "Setup" +description: "Checkout code and install mise" + +runs: + using: "composite" + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..05c843a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +name: Build + +on: + push: + branches-ignore: + - main + pull_request: + workflow_dispatch: + +env: + cache_nonce: 0 + +jobs: + lint: + name: Lint - ${{ matrix.task }} + runs-on: ubuntu-latest + timeout-minutes: 30 + strategy: + fail-fast: false + matrix: + task: + - check + - fmt + - clippy + + steps: + - name: Setup + uses: ./.github/actions/setup + + - name: Run cargo check + if: matrix.task == 'check' + run: cargo check --all-targets --all-features + + - name: Run cargo fmt + if: matrix.task == 'fmt' + run: cargo fmt --all -- --check + + - name: Run cargo clippy + if: matrix.task == 'clippy' + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Setup + uses: ./.github/actions/setup + + - name: Run cargo test + run: cargo test --all-features + + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: [lint, test] + + steps: + - name: Setup + uses: ./.github/actions/setup + + - name: Run cargo build + run: cargo build --all-features --release From 33e70ebeac99f5b71d154f6d09146119d493cc68 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 20:07:40 -0500 Subject: [PATCH 02/12] chore(lefthook): update pre-commit hook commands --- .github/actions/setup/action.yml | 14 ---------- .github/workflows/{build.yml => check.yml} | 30 +++++++++++++++++----- lefthook.yml | 6 ++--- 3 files changed, 27 insertions(+), 23 deletions(-) delete mode 100644 .github/actions/setup/action.yml rename .github/workflows/{build.yml => check.yml} (66%) diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml deleted file mode 100644 index bc4de21..0000000 --- a/.github/actions/setup/action.yml +++ /dev/null @@ -1,14 +0,0 @@ -name: "Setup" -description: "Checkout code and install mise" - -runs: - using: "composite" - steps: - - name: Checkout code - uses: actions/checkout@v6 - - - name: Install mise - uses: jdx/mise-action@v3 - with: - enable: true - cache: true diff --git a/.github/workflows/build.yml b/.github/workflows/check.yml similarity index 66% rename from .github/workflows/build.yml rename to .github/workflows/check.yml index 05c843a..aea3cce 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/check.yml @@ -24,8 +24,14 @@ jobs: - clippy steps: - - name: Setup - uses: ./.github/actions/setup + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true - name: Run cargo check if: matrix.task == 'check' @@ -45,8 +51,14 @@ jobs: timeout-minutes: 30 steps: - - name: Setup - uses: ./.github/actions/setup + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true - name: Run cargo test run: cargo test --all-features @@ -58,8 +70,14 @@ jobs: needs: [lint, test] steps: - - name: Setup - uses: ./.github/actions/setup + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true - name: Run cargo build run: cargo build --all-features --release diff --git a/lefthook.yml b/lefthook.yml index 1a4728d..796e64a 100644 --- a/lefthook.yml +++ b/lefthook.yml @@ -43,6 +43,6 @@ pre-commit: parallel: true jobs: - - run: cargo check --workspace - - run: cargo fmt -- --check - - run: cargo clippy + - run: cargo check --all-targets --all-features + - run: cargo fmt --all -- --check + - run: cargo clippy --all-targets --all-features -- -D warnings From b1aacaf0dca363eeb9814e52e761f92a4ce47410 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 21:02:24 -0500 Subject: [PATCH 03/12] ci(check): rename build workflow to check and add missing deps to it --- .github/workflows/check.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index aea3cce..23fea32 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -27,12 +27,20 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + - name: Install mise uses: jdx/mise-action@v3 with: enable: true cache: true + - name: Install rustfmt and clippy + run: rustup component add rustfmt clippy + - name: Run cargo check if: matrix.task == 'check' run: cargo check --all-targets --all-features @@ -54,6 +62,11 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + - name: Install mise uses: jdx/mise-action@v3 with: @@ -73,6 +86,11 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + - name: Install mise uses: jdx/mise-action@v3 with: From ab426338fc353d47d2e85022a7b871b752ee1db5 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 21:57:22 -0500 Subject: [PATCH 04/12] ci(check): add caching to workflow --- .github/workflows/check.yml | 134 +++++++++++++++++++++++++++--------- 1 file changed, 103 insertions(+), 31 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 23fea32..d80b083 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,17 +11,10 @@ env: cache_nonce: 0 jobs: - lint: - name: Lint - ${{ matrix.task }} + build: + name: Build runs-on: ubuntu-latest timeout-minutes: 30 - strategy: - fail-fast: false - matrix: - task: - - check - - fmt - - clippy steps: - name: Checkout code @@ -32,31 +25,60 @@ jobs: sudo apt-get update sudo apt-get install -y clang libclang-dev + - name: Restore Rust toolchain cache + id: rust-cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.rustup + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-rust-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Restore build cache + id: build-cache + uses: actions/cache/restore@v4 + with: + path: | + target + ~/.cache/storage-bindings + key: ${{ runner.os }}-build-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install mise uses: jdx/mise-action@v3 with: enable: true cache: true - - name: Install rustfmt and clippy - run: rustup component add rustfmt clippy - - - name: Run cargo check - if: matrix.task == 'check' - run: cargo check --all-targets --all-features - - - name: Run cargo fmt - if: matrix.task == 'fmt' - run: cargo fmt --all -- --check + - name: Run cargo build + run: cargo build --all-features --release - - name: Run cargo clippy - if: matrix.task == 'clippy' - run: cargo clippy --all-targets --all-features -- -D warnings + - name: Save Rust toolchain cache + if: steps.rust-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + ~/.rustup + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + key: ${{ steps.rust-cache.outputs.cache-primary-key }} + + - name: Save build cache + if: steps.build-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: | + target + ~/.cache/storage-bindings + key: ${{ steps.build-cache.outputs.cache-primary-key }} - test: - name: Test + lint: + name: Lint runs-on: ubuntu-latest timeout-minutes: 30 + needs: build steps: - name: Checkout code @@ -67,20 +89,50 @@ jobs: sudo apt-get update sudo apt-get install -y clang libclang-dev + - name: Restore Rust toolchain cache + id: rust-cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.rustup + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-rust-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Restore build cache + id: build-cache + uses: actions/cache/restore@v4 + with: + path: | + target + ~/.cache/storage-bindings + key: ${{ runner.os }}-build-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install mise uses: jdx/mise-action@v3 with: enable: true cache: true - - name: Run cargo test - run: cargo test --all-features + - name: Install rustfmt and clippy + if: steps.rust-cache.outputs.cache-hit != 'true' + run: rustup component add rustfmt clippy - build: - name: Build + - name: Run cargo check + run: cargo check --all-targets --all-features + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Run cargo clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test runs-on: ubuntu-latest timeout-minutes: 30 - needs: [lint, test] + needs: build steps: - name: Checkout code @@ -91,11 +143,31 @@ jobs: sudo apt-get update sudo apt-get install -y clang libclang-dev + - name: Restore Rust toolchain cache + id: rust-cache + uses: actions/cache/restore@v4 + with: + path: | + ~/.rustup + ~/.cargo/bin + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-rust-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} + + - name: Restore build cache + id: build-cache + uses: actions/cache/restore@v4 + with: + path: | + target + ~/.cache/storage-bindings + key: ${{ runner.os }}-build-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install mise uses: jdx/mise-action@v3 with: enable: true cache: true - - name: Run cargo build - run: cargo build --all-features --release + - name: Run cargo test + run: cargo test --all-features From 5d0fceb94317877297bbffd92b27d23745efc216 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 22:36:44 -0500 Subject: [PATCH 05/12] ci(check): install rustfmt and clippy during build job --- .github/workflows/check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index d80b083..c4648e7 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -51,6 +51,9 @@ jobs: enable: true cache: true + - name: Install rustfmt and clippy + run: rustup component add rustfmt clippy + - name: Run cargo build run: cargo build --all-features --release From 480a8b0ac90a58ed9034d0427fc6dc2fd69432f5 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 22:48:43 -0500 Subject: [PATCH 06/12] ci(check): replace caching by simply running all jobs in parallel --- .github/workflows/check.yml | 121 ++++++------------------------------ 1 file changed, 18 insertions(+), 103 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c4648e7..bcc806c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,8 +11,8 @@ env: cache_nonce: 0 jobs: - build: - name: Build + lint: + name: Lint runs-on: ubuntu-latest timeout-minutes: 30 @@ -25,26 +25,6 @@ jobs: sudo apt-get update sudo apt-get install -y clang libclang-dev - - name: Restore Rust toolchain cache - id: rust-cache - uses: actions/cache/restore@v4 - with: - path: | - ~/.rustup - ~/.cargo/bin - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-rust-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} - - - name: Restore build cache - id: build-cache - uses: actions/cache/restore@v4 - with: - path: | - target - ~/.cache/storage-bindings - key: ${{ runner.os }}-build-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install mise uses: jdx/mise-action@v3 with: @@ -54,34 +34,19 @@ jobs: - name: Install rustfmt and clippy run: rustup component add rustfmt clippy - - name: Run cargo build - run: cargo build --all-features --release + - name: Run cargo check + run: cargo check --all-targets --all-features - - name: Save Rust toolchain cache - if: steps.rust-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - ~/.rustup - ~/.cargo/bin - ~/.cargo/registry - ~/.cargo/git - key: ${{ steps.rust-cache.outputs.cache-primary-key }} - - - name: Save build cache - if: steps.build-cache.outputs.cache-hit != 'true' - uses: actions/cache/save@v4 - with: - path: | - target - ~/.cache/storage-bindings - key: ${{ steps.build-cache.outputs.cache-primary-key }} + - name: Run cargo fmt + run: cargo fmt --all -- --check - lint: - name: Lint + - name: Run cargo clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test runs-on: ubuntu-latest timeout-minutes: 30 - needs: build steps: - name: Checkout code @@ -92,50 +57,20 @@ jobs: sudo apt-get update sudo apt-get install -y clang libclang-dev - - name: Restore Rust toolchain cache - id: rust-cache - uses: actions/cache/restore@v4 - with: - path: | - ~/.rustup - ~/.cargo/bin - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-rust-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} - - - name: Restore build cache - id: build-cache - uses: actions/cache/restore@v4 - with: - path: | - target - ~/.cache/storage-bindings - key: ${{ runner.os }}-build-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install mise uses: jdx/mise-action@v3 with: enable: true cache: true - - name: Install rustfmt and clippy - if: steps.rust-cache.outputs.cache-hit != 'true' - run: rustup component add rustfmt clippy - - - name: Run cargo check - run: cargo check --all-targets --all-features - - - name: Run cargo fmt - run: cargo fmt --all -- --check - - - name: Run cargo clippy - run: cargo clippy --all-targets --all-features -- -D warnings + - name: Run cargo test + run: cargo test --all-features - test: - name: Test + build: + name: Build runs-on: ubuntu-latest timeout-minutes: 30 - needs: build + needs: [lint, test] steps: - name: Checkout code @@ -146,31 +81,11 @@ jobs: sudo apt-get update sudo apt-get install -y clang libclang-dev - - name: Restore Rust toolchain cache - id: rust-cache - uses: actions/cache/restore@v4 - with: - path: | - ~/.rustup - ~/.cargo/bin - ~/.cargo/registry - ~/.cargo/git - key: ${{ runner.os }}-rust-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} - - - name: Restore build cache - id: build-cache - uses: actions/cache/restore@v4 - with: - path: | - target - ~/.cache/storage-bindings - key: ${{ runner.os }}-build-${{ env.cache_nonce }}-${{ hashFiles('**/Cargo.lock') }} - - name: Install mise uses: jdx/mise-action@v3 with: enable: true cache: true - - name: Run cargo test - run: cargo test --all-features + - name: Run cargo build + run: cargo build --all-features --release From db603d237fbd43d9b8eff8a28f9080a5cb787889 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Mon, 19 Jan 2026 22:52:07 -0500 Subject: [PATCH 07/12] ci(check): on run on pull request or manually --- .github/workflows/check.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index bcc806c..4139153 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,9 +1,6 @@ name: Build on: - push: - branches-ignore: - - main pull_request: workflow_dispatch: @@ -70,7 +67,6 @@ jobs: name: Build runs-on: ubuntu-latest timeout-minutes: 30 - needs: [lint, test] steps: - name: Checkout code From a4fe7b4fc091c875d7473c44cefc3d1ea962b58e Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Sat, 31 Jan 2026 17:12:35 -0500 Subject: [PATCH 08/12] fix(callback): recover mutex lock when poisoined --- src/callback.rs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/callback.rs b/src/callback.rs index 5548d94..69b8e11 100644 --- a/src/callback.rs +++ b/src/callback.rs @@ -32,7 +32,9 @@ impl Default for CallbackContext { impl CallbackContext { pub fn new() -> Self { let id = { - let mut next_id = NEXT_CALLBACK_ID.lock().unwrap(); + let mut next_id = NEXT_CALLBACK_ID + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()); let id = *next_id; *next_id += 1; id @@ -133,6 +135,9 @@ impl Drop for CallbackContext { fn drop(&mut self) { if let Ok(mut registry) = CALLBACK_REGISTRY.lock() { registry.remove(&self.id); + } else if let Err(poisoned) = CALLBACK_REGISTRY.lock() { + let mut registry = poisoned.into_inner(); + registry.remove(&self.id); } } } @@ -152,7 +157,9 @@ impl CallbackFuture { let context = Arc::new(CallbackContext::new()); { - let mut registry = CALLBACK_REGISTRY.lock().unwrap(); + let mut registry = CALLBACK_REGISTRY + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()); registry.insert(context.id(), context.clone()); } @@ -219,7 +226,9 @@ pub fn with_libstorage_lock(f: F) -> R where F: FnOnce() -> R, { - let _lock = LIBSTORAGE_MUTEX.lock().unwrap(); + let _lock = LIBSTORAGE_MUTEX + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()); f() } @@ -253,6 +262,9 @@ pub unsafe extern "C" fn c_callback( let context = { if let Ok(registry) = CALLBACK_REGISTRY.lock() { registry.get(&callback_id).cloned() + } else if let Err(poisoned) = CALLBACK_REGISTRY.lock() { + let registry = poisoned.into_inner(); + registry.get(&callback_id).cloned() } else { None } From a1c9c041fa77a8aa8595d0ce348c0a7282ab9abc Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Sat, 31 Jan 2026 17:13:23 -0500 Subject: [PATCH 09/12] fix(tests): use tokio test in thread_safe_tests --- tests/thread_safe_tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/thread_safe_tests.rs b/tests/thread_safe_tests.rs index 2036627..79561f4 100644 --- a/tests/thread_safe_tests.rs +++ b/tests/thread_safe_tests.rs @@ -73,8 +73,8 @@ async fn test_concurrent_access() { } } -#[test] -fn test_send_sync_traits() { +#[tokio::test(flavor = "multi_thread")] +async fn test_send_sync_traits() { fn assert_send() {} fn assert_sync() {} @@ -88,8 +88,8 @@ fn test_send_sync_traits() { assert_send::>(); } -#[test] -fn test_clone_trait() { +#[tokio::test(flavor = "multi_thread")] +async fn test_clone_trait() { let temp_dir = tempdir().unwrap(); let config = StorageConfig::new().data_dir(temp_dir.path()); From 53aa621d54c689943d91ef7ab79a84e54d82d0c4 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Sat, 31 Jan 2026 17:30:42 -0500 Subject: [PATCH 10/12] ci(check): set timezone to utc --- .github/workflows/check.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 4139153..5131b95 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -1,4 +1,4 @@ -name: Build +name: Check on: pull_request: @@ -62,6 +62,8 @@ jobs: - name: Run cargo test run: cargo test --all-features + env: + TZ: UTC build: name: Build From 834aa266472e04d2209f879649b6d00d7699363f Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Sat, 31 Jan 2026 18:30:50 -0500 Subject: [PATCH 11/12] ci(publish): implement publish workflow --- .github/workflows/publish.yml | 121 ++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..2c953a0 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,121 @@ +name: Publish + +on: + push: + tags: + - "v*" + branches: + - main + workflow_dispatch: + +env: + cache_nonce: 0 + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true + + - name: Install rustfmt and clippy + run: rustup component add rustfmt clippy + + - name: Run cargo check + run: cargo check --all-targets --all-features + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Run cargo clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true + + - name: Run cargo test + run: cargo test --all-features + env: + TZ: UTC + + build: + name: Build + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true + + - name: Run cargo build + run: cargo build --all-features --release + + publish: + name: Publish + runs-on: ubuntu-latest + timeout-minutes: 30 + needs: [lint, test, build] + if: startsWith(github.ref, 'refs/tags/v') + + steps: + - name: Checkout code + uses: actions/checkout@v6 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y clang libclang-dev + + - name: Install mise + uses: jdx/mise-action@v3 + with: + enable: true + cache: true + + - name: Login to crates.io + run: echo "${{ secrets.CRATES_API_TOKEN }}" | cargo login + + - name: Publish to crates.io + run: cargo publish --all-features From c4c69139c948e56881b9f76eb56f969fc1582431 Mon Sep 17 00:00:00 2001 From: Xavier Saliniere Date: Sat, 31 Jan 2026 19:15:11 -0500 Subject: [PATCH 12/12] ci: cache prebuilt librairies --- .github/workflows/check.yml | 75 +++++++++++++++++++++---------- .github/workflows/publish.yml | 84 +++++++++++++++++++++++++---------- 2 files changed, 113 insertions(+), 46 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5131b95..0a45842 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -8,8 +8,8 @@ env: cache_nonce: 0 jobs: - lint: - name: Lint + build: + name: Build runs-on: ubuntu-latest timeout-minutes: 30 @@ -17,6 +17,15 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update @@ -28,27 +37,28 @@ jobs: enable: true cache: true - - name: Install rustfmt and clippy - run: rustup component add rustfmt clippy - - - name: Run cargo check - run: cargo check --all-targets --all-features - - - name: Run cargo fmt - run: cargo fmt --all -- --check - - - name: Run cargo clippy - run: cargo clippy --all-targets --all-features -- -D warnings + - name: Run cargo build + run: cargo build --all-features --release - test: - name: Test + lint: + name: Lint runs-on: ubuntu-latest timeout-minutes: 30 + needs: build steps: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update @@ -60,20 +70,37 @@ jobs: enable: true cache: true - - name: Run cargo test - run: cargo test --all-features - env: - TZ: UTC + - name: Install rustfmt and clippy + run: rustup component add rustfmt clippy - build: - name: Build + - name: Run cargo check + run: cargo check --all-targets --all-features + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Run cargo clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test runs-on: ubuntu-latest timeout-minutes: 30 + needs: build steps: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update @@ -85,5 +112,7 @@ jobs: enable: true cache: true - - name: Run cargo build - run: cargo build --all-features --release + - name: Run cargo test + run: cargo test --all-features + env: + TZ: UTC diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 2c953a0..8ff9414 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -12,8 +12,8 @@ env: cache_nonce: 0 jobs: - lint: - name: Lint + build: + name: Build runs-on: ubuntu-latest timeout-minutes: 30 @@ -21,6 +21,15 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update @@ -32,27 +41,28 @@ jobs: enable: true cache: true - - name: Install rustfmt and clippy - run: rustup component add rustfmt clippy - - - name: Run cargo check - run: cargo check --all-targets --all-features - - - name: Run cargo fmt - run: cargo fmt --all -- --check - - - name: Run cargo clippy - run: cargo clippy --all-targets --all-features -- -D warnings + - name: Run cargo build + run: cargo build --all-features --release - test: - name: Test + lint: + name: Lint runs-on: ubuntu-latest timeout-minutes: 30 + needs: build steps: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update @@ -64,20 +74,37 @@ jobs: enable: true cache: true - - name: Run cargo test - run: cargo test --all-features - env: - TZ: UTC + - name: Install rustfmt and clippy + run: rustup component add rustfmt clippy - build: - name: Build + - name: Run cargo check + run: cargo check --all-targets --all-features + + - name: Run cargo fmt + run: cargo fmt --all -- --check + + - name: Run cargo clippy + run: cargo clippy --all-targets --all-features -- -D warnings + + test: + name: Test runs-on: ubuntu-latest timeout-minutes: 30 + needs: build steps: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update @@ -89,8 +116,10 @@ jobs: enable: true cache: true - - name: Run cargo build - run: cargo build --all-features --release + - name: Run cargo test + run: cargo test --all-features + env: + TZ: UTC publish: name: Publish @@ -103,6 +132,15 @@ jobs: - name: Checkout code uses: actions/checkout@v6 + - name: Cache prebuilt binaries + uses: actions/cache@v4 + with: + path: ~/.cache/storage-bindings + key: storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}-${{ env.cache_nonce }} + restore-keys: | + storage-bindings-${{ runner.os }}-${{ hashFiles('Cargo.toml') }}- + storage-bindings-${{ runner.os }}- + - name: Install dependencies run: | sudo apt-get update