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
1 change: 1 addition & 0 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Checks: >
-misc-include-cleaner,
-readability-isolate-declaration,
-hicpp-braces-around-statements,
-hicpp-signed-bitwise,
-google-readability-braces-around-statements,
-clang-diagnostic-unknown-warning-option

Expand Down
155 changes: 155 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
name: CI

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

env:
MUJOCO_VERSION: "3.2.6"

jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: Release
build_type: Release
cmake_extra: ""
- name: ASan
build_type: Debug
cmake_extra: "-DENABLE_ASAN=ON"
- name: TSan
build_type: Debug
cmake_extra: "-DENABLE_TSAN=ON"
name: ${{ matrix.name }}
steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake \
libglfw3-dev libgl-dev \
clang-tidy

- name: Cache MuJoCo
id: cache-mujoco
uses: actions/cache@v4
with:
path: ~/.mujoco/mujoco
key: mujoco-${{ env.MUJOCO_VERSION }}-linux-x86_64

- name: Install MuJoCo
if: steps.cache-mujoco.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.mujoco
curl -fsSL \
"https://github.com/google-deepmind/mujoco/releases/download/${{ env.MUJOCO_VERSION }}/mujoco-${{ env.MUJOCO_VERSION }}-linux-x86_64.tar.gz" \
| tar xz -C ~/.mujoco
mv ~/.mujoco/mujoco-${{ env.MUJOCO_VERSION }} ~/.mujoco/mujoco

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

- name: Cache Rust (renoir)
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
renoir/target
key: renoir-${{ runner.os }}-${{ hashFiles('renoir/Cargo.lock', 'renoir/Cargo.toml') }}
restore-keys: renoir-${{ runner.os }}-

- name: Clone renoir
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/renoir
path: renoir

- name: Build renoir
run: |
cd renoir
cargo build --release --features c-api

- name: Configure
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
-DENABLE_IPC=ON \
-DRENOIR_DIR=${{ github.workspace }}/renoir \
${{ matrix.cmake_extra }}

- name: Build
run: cmake --build build -j$(nproc)

lint:
runs-on: ubuntu-latest
name: Static Analysis
steps:
- uses: actions/checkout@v4

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential cmake \
libglfw3-dev libgl-dev \
clang-tidy

- name: Cache MuJoCo
id: cache-mujoco
uses: actions/cache@v4
with:
path: ~/.mujoco/mujoco
key: mujoco-${{ env.MUJOCO_VERSION }}-linux-x86_64

- name: Install MuJoCo
if: steps.cache-mujoco.outputs.cache-hit != 'true'
run: |
mkdir -p ~/.mujoco
curl -fsSL \
"https://github.com/google-deepmind/mujoco/releases/download/${{ env.MUJOCO_VERSION }}/mujoco-${{ env.MUJOCO_VERSION }}-linux-x86_64.tar.gz" \
| tar xz -C ~/.mujoco
mv ~/.mujoco/mujoco-${{ env.MUJOCO_VERSION }} ~/.mujoco/mujoco

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

- name: Cache Rust (renoir)
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
renoir/target
key: renoir-${{ runner.os }}-${{ hashFiles('renoir/Cargo.lock', 'renoir/Cargo.toml') }}
restore-keys: renoir-${{ runner.os }}-

- name: Clone renoir
uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/renoir
path: renoir

- name: Build renoir
run: |
cd renoir
cargo build --release --features c-api

- name: Configure
run: |
mkdir -p build && cd build
cmake .. \
-DCMAKE_BUILD_TYPE=Release \
-DENABLE_IPC=ON \
-DRENOIR_DIR=${{ github.workspace }}/renoir

- name: Run clang-tidy
run: cmake --build build --target lint
12 changes: 11 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ find_package(glfw3 QUIET)
find_package(OpenGL QUIET)

option(ENABLE_IPC "Enable IPC transport (requires renoir)" ON)
option(ENABLE_FOXGLOVE "Enable Foxglove WebSocket bridge (requires IPC)" OFF)
option(ENABLE_ASAN "Enable AddressSanitizer + UndefinedBehaviorSanitizer" OFF)
option(ENABLE_TSAN "Enable ThreadSanitizer" OFF)

Expand Down Expand Up @@ -55,6 +56,10 @@ if(ENABLE_IPC)
src/sensors/sensors.c
src/transport/transport_renoir.c
)

if(ENABLE_FOXGLOVE)
list(APPEND SOURCES src/foxglove/foxglove.c)
endif()
endif()

add_executable(hummingbird ${SOURCES})
Expand Down Expand Up @@ -109,6 +114,12 @@ if(ENABLE_IPC)
target_link_libraries(hummingbird PRIVATE renoir)
target_compile_definitions(hummingbird PRIVATE ENABLE_IPC)

if(ENABLE_FOXGLOVE)
target_link_libraries(hummingbird PRIVATE pthread)
target_compile_definitions(hummingbird PRIVATE ENABLE_FOXGLOVE)
message(STATUS "Foxglove WebSocket bridge enabled")
Comment on lines +117 to +120

Copilot AI Mar 26, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CMake links pthread directly when ENABLE_FOXGLOVE is on. On many toolchains the correct flags are provided via find_package(Threads) + Threads::Threads (which may add -pthread to both compile and link, and is more portable than -lpthread). Please switch to the CMake Threads package to avoid platform/toolchain-specific failures.

Copilot uses AI. Check for mistakes.
endif()

set_target_properties(hummingbird PROPERTIES
BUILD_RPATH "${RENOIR_LIB_DIR};${MUJOCO_DIR}/lib"
INSTALL_RPATH "${RENOIR_LIB_DIR};${MUJOCO_DIR}/lib"
Expand Down Expand Up @@ -153,7 +164,6 @@ if(ENABLE_TSAN)
target_link_options(hummingbird PRIVATE -fsanitize=thread)
endif()

# ---- Lint target (clang-tidy) ----
find_program(CLANG_TIDY clang-tidy)
if(CLANG_TIDY)
set(TIDY_SRCS "")
Expand Down
Loading
Loading