Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
shuhaowu committed Aug 3, 2024
1 parent 1b87223 commit 6764e45
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .github/ros2-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
FROM ubuntu:jammy

RUN echo "hello world"
7 changes: 7 additions & 0 deletions .github/ros2-ci/build-docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

set -xe
cd ${GITHUB_WORKSPACE}/.github/ros2-ci
source ./common.sh
docker build -t ${IMAGE_NAME}:latest .
docker run --rm ${IMAGE_NAME}:latest echo hi
1 change: 1 addition & 0 deletions .github/ros2-ci/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
IMAGE_NAME=${GITHUB_WORKFLOW}-${GITHUB_REF_NAME//\//-}-ros2-ci
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"
13 changes: 13 additions & 0 deletions scripts/test-ros-in-docker
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/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 \
-it \
-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 6764e45

Please sign in to comment.