Skip to content
Closed
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
46 changes: 46 additions & 0 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: macOS CI

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
macos-build:
name: macOS Build Examples
runs-on: macos-latest

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

- name: Install Rust
uses: dtolnay/rust-toolchain@stable

- name: Setup Rust cache
uses: Swatinem/rust-cache@v2

- name: Fetch dependencies and update submodules
run: |
cargo fetch
# Ensure git submodules in the cargo git checkouts are initialized
for dir in ~/.cargo/git/checkouts/roslibrust-*/*/; do
if [ -d "$dir" ]; then
echo "Updating submodules in $dir"
(cd "$dir" && git submodule update --init --recursive) || true
fi
done

- name: Debug - Check cargo git checkouts
run: |
echo "HOME: $HOME"
echo "CARGO_HOME: ${CARGO_HOME:-not set}"
echo "Checking for roslibrust checkouts:"
ls -la ~/.cargo/git/checkouts/ 2>/dev/null || echo "No checkouts directory"
find ~/.cargo/git/checkouts -name "roslibrust-*" -type d 2>/dev/null || echo "No roslibrust directories found"
echo "Checking for assets directory:"
find ~/.cargo/git/checkouts -name "assets" -type d 2>/dev/null || echo "No assets directories found"

- name: Build examples without ROS dependencies
run: cargo build --examples
50 changes: 27 additions & 23 deletions ros-z-msgs/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,29 +220,33 @@ fn discover_bundled_packages(bundled_packages: &[&str]) -> Result<Vec<PathBuf>>
fn find_roslibrust_assets() -> PathBuf {
// Search in cargo's git checkout directory
// The path will be something like: ~/.cargo/git/checkouts/roslibrust-{hash}/{commit}/assets
if let Ok(home) = env::var("CARGO_HOME").or_else(|_| env::var("HOME")) {
let cargo_git = PathBuf::from(home).join(".cargo/git/checkouts");

if let Ok(entries) = std::fs::read_dir(&cargo_git) {
for entry in entries.flatten() {
let path = entry.path();
if path.is_dir()
&& path
.file_name()
.and_then(|n| n.to_str())
.is_some_and(|n| n.starts_with("roslibrust-"))
{
// Look for the assets directory in any commit subdirectory
if let Ok(commits) = std::fs::read_dir(&path) {
for commit_entry in commits.flatten() {
let assets_path = commit_entry.path().join("assets");
if assets_path.exists() {
println!(
"cargo:warning=Using roslibrust git assets at {}",
assets_path.display()
);
return assets_path;
}
let cargo_git = if let Ok(cargo_home) = env::var("CARGO_HOME") {
PathBuf::from(cargo_home).join("git/checkouts")
} else if let Ok(home) = env::var("HOME") {
PathBuf::from(home).join(".cargo/git/checkouts")
} else {
panic!("Neither CARGO_HOME nor HOME environment variable is set");
};

if let Ok(entries) = std::fs::read_dir(&cargo_git) {
for entry in entries.flatten() {
let path = entry.path();
if path.is_dir()
&& path
.file_name()
.and_then(|n| n.to_str())
.is_some_and(|n| n.starts_with("roslibrust-"))
{
// Look for the assets directory in any commit subdirectory
if let Ok(commits) = std::fs::read_dir(&path) {
for commit_entry in commits.flatten() {
let assets_path = commit_entry.path().join("assets");
if assets_path.exists() {
println!(
"cargo:warning=Using roslibrust git assets at {}",
assets_path.display()
);
return assets_path;
}
}
}
Expand Down
Loading