Skip to content

Commit

Permalink
Merge pull request #102 from cactusdynamics/ros-ci
Browse files Browse the repository at this point in the history
ROS CI setup
  • Loading branch information
shuhaowu authored Aug 4, 2024
2 parents 1b87223 + 3d63ab6 commit 3463016
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 3 deletions.
18 changes: 17 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
on: [push]
on:
push:
branches:
- master
pull_request:
branches:
- master

name: cactus-rt

Expand Down Expand Up @@ -53,3 +59,13 @@ jobs:

# - name: Run example
# run: docker/scripts/04-example.sh

build-and-test-ros:
runs-on: [self-hosted, noble, real-time]
env:
image_name: ${{ github.workflow }}-ci-${{ github.ref_name }}
steps:
- uses: actions/checkout@v3

- name: Test ROS in docker
run: scripts/test-ros-in-docker
4 changes: 3 additions & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
FROM ubuntu:noble
ARG base_image=ubuntu:noble

FROM ${base_image}

RUN set -xe; \
export DEBIAN_FRONTEND=noninteractive; \
Expand Down
8 changes: 8 additions & 0 deletions docker/scripts/run-ros2.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

export WORKSPACE_DIR=/workspace

set -xe

cd $WORKSPACE_DIR
colcon build --cmake-args "-DENABLE_CLANG_TIDY=ON"
12 changes: 12 additions & 0 deletions scripts/test-ros-in-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

IMAGE_NAME=cactus-rt-ros2-test

cd docker
docker build --build-arg base_image=ros:jazzy-ros-base-noble . -t $IMAGE_NAME
cd ..
docker run --rm \
-v $(pwd):/workspace/src/cactus-rt \
$IMAGE_NAME \
-- \
"/workspace/src/cactus-rt/docker/scripts/run-ros2.sh"
2 changes: 1 addition & 1 deletion src/cactus_rt/ros2/ros2_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void Ros2Adapter::TimerCallback() {
}

void Ros2Adapter::DrainQueues() {
std::scoped_lock lock(mut_);
const std::scoped_lock lock(mut_);

for (const auto& publisher : publishers_) {
// Hopefully the thread is not publishing so quickly that a single
Expand Down

0 comments on commit 3463016

Please sign in to comment.