Skip to content

Commit

Permalink
Add the monitor and github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mehmetkillioglu committed Jan 30, 2024
1 parent 5d5fad9 commit b6b7d0a
Show file tree
Hide file tree
Showing 8 changed files with 541 additions and 0 deletions.
13 changes: 13 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

.circleci/
.github/
.git/
.github/
fognav_msgs/.git/
fognav_msgs/.github/
.vscode/
.dockerignore
.gitignore
**Dockerfile
**.Dockerfile
Dockerfile.**
46 changes: 46 additions & 0 deletions .github/workflows/fastdds-locator-monitor.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

on:
push:
pull_request:
workflow_dispatch:

permissions:
contents: read
packages: write

jobs:
main:
name: Build & push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/tiiuae/tii-fastdds-locator-monitor
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=sha
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build image and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
build/*
install/*
log/*
site/*
43 changes: 43 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Copyright 2022 Proyectos y Sistemas de Mantenimiento SL (eProsima).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

cmake_minimum_required(VERSION 3.8)
project(fastdds_monitor_tutorial)
set(CMAKE_BUILD_TYPE RelWithDebInfo) #Debug, Release

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

# find dependencies
find_package(ament_cmake REQUIRED)
find_package(fastcdr REQUIRED)
find_package(fastrtps REQUIRED)
find_package(fastdds_statistics_backend REQUIRED)

# Compile executable and link with dependencies
add_executable(fastdds_monitor src/monitor.cpp)
# Do not use ament as dependencies are not linked with ament
target_link_libraries(fastdds_monitor fastrtps fastcdr fastdds_statistics_backend)

# Install executable
install(
TARGETS fastdds_monitor
DESTINATION lib/${PROJECT_NAME}
)
ament_export_include_directories(include)
ament_export_libraries(${library_name})
ament_export_dependencies(${dependencies})

ament_package()
37 changes: 37 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
FROM ghcr.io/tiiuae/fog-ros-baseimage-builder:v3.1.0

# config dependencies install
ARG DEBIAN_FRONTEND=noninteractive
RUN echo -e '\
APT::Install-Recommends "0";\n\
APT::Install-Suggests "0";\n\
' > /etc/apt/apt.conf.d/01norecommend

ARG UNDERLAY_WS=/main_ws/underlay_ws
ARG OVERLAY_WS=/main_ws/overlay_ws

WORKDIR $UNDERLAY_WS
COPY fastdds_statistics_backend.repos $UNDERLAY_WS/src/fastdds_monitor_tutorial/underlay.repos

# Import the underlay dependencies that doesn't exist in SDK image
RUN vcs import ./src/ < $UNDERLAY_WS/src/fastdds_monitor_tutorial/underlay.repos

RUN ls -la $UNDERLAY_WS/src && \
. /usr/bin/ros_setup.bash && \
colcon build --cmake-args -DBUILD_TESTING=0

RUN apt-get update && \
apt-get install -y \
nlohmann-json-dev \
&& rm -rf /var/lib/apt/lists/*

WORKDIR $OVERLAY_WS

COPY . $OVERLAY_WS/src/fastdds_monitor_tutorial

RUN . $UNDERLAY_WS/install/setup.sh && \
. /usr/bin/ros_setup.bash && \
colcon build --cmake-args -DBUILD_TESTING=0 && \
cp $OVERLAY_WS/install/fastdds_monitor_tutorial/lib/fastdds_monitor_tutorial/fastdds_monitor $OVERLAY_WS/

ENTRYPOINT ["/bin/bash", "-c", ". /main_ws/overlay_ws/install/setup.bash && ros2 run fastdds_monitor_tutorial fastdds_monitor"]
25 changes: 25 additions & 0 deletions fastdds_statistics_backend.repos
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
repositories:
# foonathan_memory_vendor:
# type: git
# url: https://github.com/eProsima/foonathan_memory_vendor.git
# version: v1.3.0
# fastcdr:
# type: git
# url: https://github.com/eProsima/Fast-CDR.git
# version: v1.0.27
# fastdds:
# type: git
# url: https://github.com/eProsima/Fast-DDS.git
# version: v2.10.1
fastdds_statistics_backend:
type: git
url: https://github.com/eProsima/Fast-DDS-statistics-backend.git
version: v0.10.0
fastddsgen:
type: git
url: https://github.com/eProsima/Fast-DDS-Gen.git
version: v2.4.0
fastddsgen/thirdparty/idl-parser:
type: git
url: https://github.com/eProsima/IDL-Parser.git
version: v1.5.0
20 changes: 20 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>fastdds_monitor_tutorial</name>
<version>0.0.0</version>
<description>First application as a ROS 2 package to monitor your ROS 2 deployment.</description>
<maintainer email="irenebandera@eprosima.com">Irene Bandera</maintainer>
<maintainer email="raul@eprosima.com">Raul Sanchez-Mateos Lizano</maintainer>
<license>Apache License, Version 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>

<depend>fastcdr</depend>
<depend>fastrtps</depend>
<depend>fastdds_statistics_backend</depend>

<export>
<build_type>ament_cmake</build_type>
</export>
</package>
Loading

0 comments on commit b6b7d0a

Please sign in to comment.