Skip to content

Commit b7947c8

Browse files
authored
ci: add macos-latest (#12)
1 parent 016a90c commit b7947c8

File tree

3 files changed

+56
-13
lines changed

3 files changed

+56
-13
lines changed

.github/workflows/ci.yml

Lines changed: 53 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -43,17 +43,23 @@ jobs:
4343
run: nix build .#checks.x86_64-linux.pre-commit-check -L
4444

4545
no-ros:
46-
name: ROS-independent Test
47-
runs-on: ubuntu-latest
46+
name: ROS-independent Test (${{ matrix.os }})
47+
runs-on: ${{ matrix.os }}
4848
permissions:
4949
id-token: write
5050
contents: read
51+
strategy:
52+
fail-fast: false
53+
matrix:
54+
os: [ubuntu-latest, macos-latest]
5155

5256
steps:
5357
- name: Checkout repository
5458
uses: actions/checkout@v4
5559

60+
# Linux-specific setup
5661
- name: Free Disk Space (Ubuntu)
62+
if: runner.os == 'Linux'
5763
uses: jlumbroso/free-disk-space@main
5864
with:
5965
large-packages: true
@@ -64,39 +70,75 @@ jobs:
6470
docker-images: false
6571
swap-storage: false
6672

67-
- name: Install Determinate Nix
73+
- name: Install Determinate Nix (Linux)
74+
if: runner.os == 'Linux'
6875
uses: DeterminateSystems/determinate-nix-action@v3
6976

70-
- name: Setup sccache
71-
uses: mozilla-actions/sccache-action@v0.0.9
72-
73-
- name: Install Nushell
77+
- name: Install Nushell (Linux via Nix)
78+
if: runner.os == 'Linux'
7479
run: |
7580
nix profile install nixpkgs#nushell
7681
chmod +x scripts/test-pure-rust.nu
7782
78-
- name: Setup nix environment
83+
- name: Setup nix environment (Linux)
84+
if: runner.os == 'Linux'
7985
run: |
8086
nix print-dev-env '.#pureRust-ci' --accept-flake-config > /tmp/nix-dev-env.sh
8187
echo "export SCCACHE_GHA_ENABLED=true" >> /tmp/nix-dev-env.sh
8288
echo "export SCCACHE_CACHE_SIZE=2G" >> /tmp/nix-dev-env.sh
8389
echo "export RUSTC_WRAPPER=sccache" >> /tmp/nix-dev-env.sh
8490
echo "export CI=true" >> /tmp/nix-dev-env.sh
8591
92+
# macOS-specific setup
93+
- name: Install Rust toolchain (macOS)
94+
if: runner.os == 'macOS'
95+
uses: actions-rust-lang/setup-rust-toolchain@v1
96+
with:
97+
toolchain: stable
98+
components: clippy, rustfmt
99+
100+
- name: Install dependencies (macOS)
101+
if: runner.os == 'macOS'
102+
run: |
103+
brew install nushell protobuf
104+
cargo install cargo-nextest --locked
105+
chmod +x scripts/test-pure-rust.nu
106+
107+
# Common setup
108+
- name: Setup sccache
109+
uses: mozilla-actions/sccache-action@v0.0.9
110+
111+
- name: Set environment variables (macOS)
112+
if: runner.os == 'macOS'
113+
run: |
114+
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
115+
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
116+
echo "CI=true" >> $GITHUB_ENV
117+
118+
# Test steps
86119
- name: Clippy (default workspace)
87120
run: |
88-
source /tmp/nix-dev-env.sh
121+
if [ "$RUNNER_OS" == "Linux" ]; then
122+
source /tmp/nix-dev-env.sh
123+
fi
89124
nu scripts/test-pure-rust.nu clippy-workspace
125+
shell: bash
90126

91127
- name: Run tests
92128
run: |
93-
source /tmp/nix-dev-env.sh
129+
if [ "$RUNNER_OS" == "Linux" ]; then
130+
source /tmp/nix-dev-env.sh
131+
fi
94132
nu scripts/test-pure-rust.nu run-tests
133+
shell: bash
95134

96135
- name: Check ros-z-msgs feature flags
97136
run: |
98-
source /tmp/nix-dev-env.sh
137+
if [ "$RUNNER_OS" == "Linux" ]; then
138+
source /tmp/nix-dev-env.sh
139+
fi
99140
nu scripts/test-pure-rust.nu check-bundled-msgs
141+
shell: bash
100142

101143
python-tests:
102144
name: Python Tests (ros-z-py) (${{ matrix.distro }})

ros-z/tests/action/wait.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ mod tests {
192192
Ok(())
193193
}
194194

195-
#[tokio::test(flavor = "multi_thread", worker_threads = 1)]
195+
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
196196
async fn test_action_status_async_wait() -> Result<()> {
197197
let (_client_node, _server_node, client, server) = setup_test_with_client_server().await?;
198198

ros-z/tests/pubsub_qos.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,8 @@ mod tests {
628628
.build_with_callback(move |msg: RosString| {
629629
println!("Received: {}", msg.data);
630630
received_count_clone.fetch_add(1, Ordering::SeqCst);
631-
std::thread::sleep(std::time::Duration::from_secs(10));
631+
// Sleep to simulate slow callback - publish() should not block on this
632+
std::thread::sleep(std::time::Duration::from_millis(100));
632633
})?;
633634

634635
// Wait for discovery

0 commit comments

Comments
 (0)