Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 53 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,23 @@ jobs:
run: nix build .#checks.x86_64-linux.pre-commit-check -L

no-ros:
name: ROS-independent Test
runs-on: ubuntu-latest
name: ROS-independent Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
permissions:
id-token: write
contents: read
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Linux-specific setup
- name: Free Disk Space (Ubuntu)
if: runner.os == 'Linux'
uses: jlumbroso/free-disk-space@main
with:
large-packages: true
Expand All @@ -64,39 +70,75 @@ jobs:
docker-images: false
swap-storage: false

- name: Install Determinate Nix
- name: Install Determinate Nix (Linux)
if: runner.os == 'Linux'
uses: DeterminateSystems/determinate-nix-action@v3

- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9

- name: Install Nushell
- name: Install Nushell (Linux via Nix)
if: runner.os == 'Linux'
run: |
nix profile install nixpkgs#nushell
chmod +x scripts/test-pure-rust.nu

- name: Setup nix environment
- name: Setup nix environment (Linux)
if: runner.os == 'Linux'
run: |
nix print-dev-env '.#pureRust-ci' --accept-flake-config > /tmp/nix-dev-env.sh
echo "export SCCACHE_GHA_ENABLED=true" >> /tmp/nix-dev-env.sh
echo "export SCCACHE_CACHE_SIZE=2G" >> /tmp/nix-dev-env.sh
echo "export RUSTC_WRAPPER=sccache" >> /tmp/nix-dev-env.sh
echo "export CI=true" >> /tmp/nix-dev-env.sh

# macOS-specific setup
- name: Install Rust toolchain (macOS)
if: runner.os == 'macOS'
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt

- name: Install dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install nushell protobuf
cargo install cargo-nextest --locked
chmod +x scripts/test-pure-rust.nu

# Common setup
- name: Setup sccache
uses: mozilla-actions/sccache-action@v0.0.9

- name: Set environment variables (macOS)
if: runner.os == 'macOS'
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CI=true" >> $GITHUB_ENV

# Test steps
- name: Clippy (default workspace)
run: |
source /tmp/nix-dev-env.sh
if [ "$RUNNER_OS" == "Linux" ]; then
source /tmp/nix-dev-env.sh
fi
nu scripts/test-pure-rust.nu clippy-workspace
shell: bash

- name: Run tests
run: |
source /tmp/nix-dev-env.sh
if [ "$RUNNER_OS" == "Linux" ]; then
source /tmp/nix-dev-env.sh
fi
nu scripts/test-pure-rust.nu run-tests
shell: bash

- name: Check ros-z-msgs feature flags
run: |
source /tmp/nix-dev-env.sh
if [ "$RUNNER_OS" == "Linux" ]; then
source /tmp/nix-dev-env.sh
fi
nu scripts/test-pure-rust.nu check-bundled-msgs
shell: bash

python-tests:
name: Python Tests (ros-z-py) (${{ matrix.distro }})
Expand Down
2 changes: 1 addition & 1 deletion ros-z/tests/action/wait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ mod tests {
Ok(())
}

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

Expand Down
3 changes: 2 additions & 1 deletion ros-z/tests/pubsub_qos.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,8 @@ mod tests {
.build_with_callback(move |msg: RosString| {
println!("Received: {}", msg.data);
received_count_clone.fetch_add(1, Ordering::SeqCst);
std::thread::sleep(std::time::Duration::from_secs(10));
// Sleep to simulate slow callback - publish() should not block on this
std::thread::sleep(std::time::Duration::from_millis(100));
})?;

// Wait for discovery
Expand Down
Loading