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
64 changes: 64 additions & 0 deletions .github/scripts/install_dls2_msgs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
#!/bin/bash
# Downloads the prebuilt dls2_msgs release asset from GitHub and installs it.
# Runs inside the dls2-dev container as part of the build preparation step.
# Requires: CICD_PAT or GITHUB_TOKEN env var for authentication.
set -euo pipefail

DOWNLOAD_DIR="/tmp/dls2-msgs-release"
REPO="iit-DLSLab/dls2_msgs"

echo "--- Installing dls2_msgs prebuilt artifacts ---"

# Install gh CLI if not present in the container
if ! command -v gh &>/dev/null; then
echo "gh CLI not found, installing..."
apt-get update -qq
apt-get install -y gh
fi

TOKEN="${CICD_PAT:-${GITHUB_TOKEN:-}}"
if [ -z "$TOKEN" ]; then
echo "::error::No GitHub token found (CICD_PAT or GITHUB_TOKEN). Cannot download release."
exit 1
fi
export GH_TOKEN="$TOKEN"

# Resolve the dls2_msgs submodule commit SHA pinned in this repo
SHA="$(git ls-tree HEAD dls2_msgs | awk '{print $3}')"
echo "dls2_msgs submodule is pinned to commit: $SHA"

# Find the release tag that points to that commit
TAG="$(
git ls-remote --tags "https://x-access-token:${TOKEN}@github.com/${REPO}.git" |
awk -v sha="$SHA" '
$1 == sha {
ref = $2
sub("^refs/tags/", "", ref)
sub("\\^\\{\\}$", "", ref)
print ref
exit
}
'
)"

if [ -z "$TAG" ]; then
echo "::error::No release tag found in ${REPO} for commit ${SHA}"
exit 1
fi
echo "Found release tag: $TAG"

# Download the dev .deb package from that release
mkdir -p "$DOWNLOAD_DIR"
gh release download "$TAG" \
--repo "$REPO" \
--pattern "dls-messages-dev.deb" \
--dir "$DOWNLOAD_DIR" \
--clobber

echo "Downloaded assets:"
ls -lR "$DOWNLOAD_DIR"

# Install the .deb package (apt-get handles dependencies automatically)
echo "Installing dls-messages-dev .deb..."
sudo dpkg -i "$DOWNLOAD_DIR"/dls-messages-dev.deb
echo "dls2_msgs installed successfully."
2 changes: 2 additions & 0 deletions .github/workflows/build_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
uses: iit-DLSLab/cicd_tools/.github/workflows/dls2_build_test.yml@main
with:
test-command: "ls"
build-script-path: .github/scripts/install_dls2_msgs.sh
cmake-arguments: "-DBUILD_DLS2_MSGS=OFF"
secrets:
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
CICD_PAT: ${{ secrets.CICD_PAT }}
1 change: 1 addition & 0 deletions .github/workflows/create-release-deb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
with:
test-command: "ls"
output_workflow_artifact_name: build
cmake-arguments: "-DBUILD_DLS2_MSGS=OFF"
secrets:
GHCR_USERNAME: ${{ secrets.GHCR_USERNAME }}
CICD_PAT: ${{ secrets.CICD_PAT }}
Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@
[submodule "dls2_ros2_interface"]
path = dls2_ros2_interface
url = git@github.com:iit-DLSLab/dls2_ros2_interface.git
[submodule "dls2_msgs"]
path = dls2_msgs
url = git@github.com:iit-DLSLab/dls2_msgs.git
8 changes: 7 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type" FORCE)
endif()

set(DLS_MESSAGE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/dls2/modules/messages)
set(DLS_MESSAGE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/dls2_msgs
CACHE PATH "Path to the dls2_msgs folder"
)
add_subdirectory(dls2)
option(BUILD_DLS2_MSGS "Build the dls2_msgs submodule. Disable when dls2_msgs is pre-installed (e.g. in CI)." ON)
if(BUILD_DLS2_MSGS)
add_subdirectory(dls2_msgs)
endif()
add_subdirectory(robotlib)
add_subdirectory(gluecode)
add_subdirectory(visualizers/rviz_interface)
Expand Down
5 changes: 5 additions & 0 deletions build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

cd build
make -j14
cd ..
8 changes: 8 additions & 0 deletions clean_build.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

clear
sudo rm -r ./build/*
cd build
cmake ..
make -j14
cd ..
1 change: 1 addition & 0 deletions dls2_msgs
Submodule dls2_msgs added at 4ce99d
4 changes: 2 additions & 2 deletions visualizers/rviz_interface/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ add_compile_options("-std=c++2a")

find_package(fastcdr 2 REQUIRED)
find_package(fastdds 3 REQUIRED)
find_package(dls_messages REQUIRED)

if(DEFINED DLS_MESSAGE_FOLDER)
list(APPEND CMAKE_MODULE_PATH "${DLS_MESSAGE_FOLDER}/cmake")
else()
list(APPEND CMAKE_MODULE_PATH "/usr/include/generate_msg_library/cmake")
list(APPEND CMAKE_MODULE_PATH "/usr/include/dls_messages/cmake")
endif()
include(generate_msg_library)

Expand Down Expand Up @@ -59,7 +60,6 @@ target_link_libraries(${PROJECT_NAME}
)
target_link_directories(${PROJECT_NAME}
PRIVATE
/usr/lib/dls2
${DLS_INSTALL_PERIODIC_APP_PLUGIN_DIR}/${PROJECT_NAME}
)

Expand Down
Loading