From e12a084bfb1015371f8700aa4b79917744adb613 Mon Sep 17 00:00:00 2001 From: Jalon Wong Date: Mon, 11 Aug 2025 20:00:28 -0500 Subject: [PATCH 1/2] Fix the warning to pass CI --- freertos-rust/src/critical.rs | 6 +++--- freertos-rust/src/mutex.rs | 2 +- freertos-rust/src/semaphore.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/freertos-rust/src/critical.rs b/freertos-rust/src/critical.rs index 79f8dea..405d711 100644 --- a/freertos-rust/src/critical.rs +++ b/freertos-rust/src/critical.rs @@ -37,7 +37,7 @@ impl ExclusiveData { } } - pub fn lock(&self) -> Result, FreeRtosError> { + pub fn lock(&self) -> Result, FreeRtosError> { Ok(ExclusiveDataGuard { __data: &self.data, __lock: CriticalRegion::enter(), @@ -47,7 +47,7 @@ impl ExclusiveData { pub fn lock_from_isr( &self, _context: &mut crate::isr::InterruptContext, - ) -> Result, FreeRtosError> { + ) -> Result, FreeRtosError> { Ok(ExclusiveDataGuardIsr { __data: &self.data }) } } @@ -106,7 +106,7 @@ impl SuspendScheduler { } } - pub fn lock(&self) -> SuspendSchedulerGuard { + pub fn lock(&self) -> SuspendSchedulerGuard<'_,T> { unsafe { freertos_rs_vTaskSuspendAll(); } diff --git a/freertos-rust/src/mutex.rs b/freertos-rust/src/mutex.rs index fb43eff..6d71542 100644 --- a/freertos-rust/src/mutex.rs +++ b/freertos-rust/src/mutex.rs @@ -36,7 +36,7 @@ where } /// Try to obtain a lock and mutable access to our inner value - pub fn lock(&self, max_wait: D) -> Result, FreeRtosError> { + pub fn lock(&self, max_wait: D) -> Result, FreeRtosError> { self.mutex.take(max_wait)?; Ok(MutexGuard { diff --git a/freertos-rust/src/semaphore.rs b/freertos-rust/src/semaphore.rs index 75ccef6..cb5d476 100644 --- a/freertos-rust/src/semaphore.rs +++ b/freertos-rust/src/semaphore.rs @@ -50,7 +50,7 @@ impl Semaphore { } /// Lock this semaphore in a RAII fashion - pub fn lock(&self, max_wait: D) -> Result { + pub fn lock(&self, max_wait: D) -> Result, FreeRtosError> { self.take(max_wait).map(|()| SemaphoreGuard { owner: self }) } From c9bf4e1bde0eab65e8858cee4ceed565bfc2f5b7 Mon Sep 17 00:00:00 2001 From: Jalon Wong Date: Sat, 16 Aug 2025 08:30:27 -0500 Subject: [PATCH 2/2] Add a CI to publish crates to crate.io --- .github/workflows/release.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..bc74a9b --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,24 @@ +name: Release + +on: + workflow_dispatch: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + # environment: release # Optional: for enhanced security + permissions: + id-token: write # Required for OIDC token exchange + steps: + - uses: actions/checkout@v4 + - uses: rust-lang/crates-io-auth-action@v1 + if: github.ref_type == 'tag' + id: auth + - uses: katyo/publish-crates@v2 + with: + registry-token: ${{ steps.auth.outputs.token }} + dry-run: ${{ github.ref_type != 'tag' }} + ignore-unpublished-changes: true