From 6bb9361a5d32d0a5ad13af49ba472cfab24e14e7 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Tue, 29 Jul 2025 13:53:39 +0200 Subject: [PATCH 1/2] ci: add aarch64-apple-darwin and cargo test --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5456431..604cfc5d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -54,7 +54,7 @@ jobs: strategy: matrix: rust: [stable, 1.65.0] - TARGET: [x86_64-apple-darwin] + TARGET: [x86_64-apple-darwin, aarch64-apple-darwin] steps: - uses: actions/checkout@v3 @@ -64,3 +64,4 @@ jobs: target: ${{ matrix.TARGET }} - run: cargo build --target=${{ matrix.TARGET }} + - run: cargo test --target=${{ matrix.TARGET }} From 955b3856fa27d5c92fe89d9c2f988480bac873e5 Mon Sep 17 00:00:00 2001 From: Byron Hambly Date: Tue, 29 Jul 2025 15:06:45 +0200 Subject: [PATCH 2/2] doctest: add target_os gates to fix test compilation on macos --- src/lib.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 8757c317..692be8e8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -24,11 +24,13 @@ //! use std::time::Duration; //! //! use i2cdev::core::*; +//! #[cfg(any(target_os = "linux", target_os = "android"))] //! use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; //! //! const NUNCHUCK_SLAVE_ADDR: u16 = 0x52; //! //! // real code should probably not use unwrap() +//! #[cfg(any(target_os = "linux", target_os = "android"))] //! fn i2cfun() -> Result<(), LinuxI2CError> { //! let mut dev = LinuxI2CDevice::new("/dev/i2c-1", NUNCHUCK_SLAVE_ADDR)?; //! @@ -52,10 +54,12 @@ //! extern crate i2cdev; //! //! use i2cdev::core::*; +//! #[cfg(any(target_os = "linux", target_os = "android"))] //! use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError, LinuxI2CMessage}; //! //! const SLAVE_ADDR: u16 = 0x57; //! +//! #[cfg(any(target_os = "linux", target_os = "android"))] //! fn write_read_transaction() -> Result<(), LinuxI2CError> { //! let mut dev = LinuxI2CDevice::new("/dev/i2c-1", SLAVE_ADDR)?; //! @@ -76,10 +80,12 @@ //! extern crate i2cdev; //! //! use i2cdev::core::*; +//! #[cfg(any(target_os = "linux", target_os = "android"))] //! use i2cdev::linux::{LinuxI2CBus, LinuxI2CError, LinuxI2CMessage}; //! //! const SLAVE_ADDR: u16 = 0x57; //! +//! #[cfg(any(target_os = "linux", target_os = "android"))] //! fn write_read_transaction_using_bus() -> Result<(), LinuxI2CError> { //! let mut dev = LinuxI2CBus::new("/dev/i2c-1")?; //!