Skip to content
Open
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
33 changes: 33 additions & 0 deletions .github/workflows/setup_and_build_caret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build CARET

on:
schedule:
- cron: 0 17 * * * # run at 2 AM JST
pull_request:
workflow_dispatch:

jobs:
build:
strategy:
matrix:
ros_distro: [humble, iron, jazzy]

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v5

- name: Clean up disk space
run: |
sudo apt-get autoremove -y
sudo apt-get clean
sudo rm -rf /usr/share/dotnet

- name: Docker Build
run: |
docker image build \
--no-cache \
--build-arg ROS_DISTRO=${{ matrix.ros_distro }} \
-t caret:${{ matrix.ros_distro }} \
-f ./docker/build_caret.dockerfile \
.
65 changes: 65 additions & 0 deletions docker/build_caret.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
ARG ROS_DISTRO=humble
ARG CARET_VERSION="main"

FROM ros:${ROS_DISTRO}

ENV DEBIAN_FRONTEND=noninteractive

RUN apt-get update -y && \
apt-get install -y --no-install-recommends \
locales \
&& \
apt-get clean && \
rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8
ENV LANG=en_US.UTF-8
ENV TZ=Asia/Tokyo

# Do not use cache
ADD "https://www.random.org/sequences/?min=1&max=52&col=1&format=plain&rnd=new" /dev/null

RUN git clone https://github.com/tier4/caret.git /ros2_caret_ws && \
cd /ros2_caret_ws && \
git checkout ${CARET_VERSION}

# cspell: disable
RUN if [ "$ROS_DISTRO" = "jazzy" ]; then \
apt-get update && \
apt-get install -y python3-pip python3-virtualenv && \
virtualenv -p python3 --system-site-packages $HOME/venv/jazzy ; \
fi
# cspell: enable

# cspell: disable
RUN apt update && apt install -y git && \
apt-get install -y tzdata && \
ln -fs /usr/share/zoneinfo/Asia/Tokyo /etc/localtime && \
dpkg-reconfigure --frontend noninteractive tzdata
# cspell: enable

RUN echo "===== Setup CARET ====="
RUN cd ros2_caret_ws && \
mkdir src && \
if [ "$ROS_DISTRO" = "humble" ]; then \
REPOS_FILE=caret.repos ; \
elif [ "$ROS_DISTRO" = "iron" ]; then \
REPOS_FILE=caret_iron.repos ; \
elif [ "$ROS_DISTRO" = "jazzy" ]; then \
REPOS_FILE=caret_jazzy.repos ; \
else \
echo "Unsupported ROS_DISTRO: $ROS_DISTRO" && exit 1 ; \
fi && \
vcs import src < $REPOS_FILE && \
. /opt/ros/"$ROS_DISTRO"/setup.sh && \
if [ "$ROS_DISTRO" = "jazzy" ]; then \
. $HOME/venv/jazzy/bin/activate ; \
fi && \
./setup_caret.sh -c -d "$ROS_DISTRO"

RUN echo "===== Build CARET ====="
RUN cd ros2_caret_ws && \
. /opt/ros/"$ROS_DISTRO"/setup.sh && \
if [ "$ROS_DISTRO" = "jazzy" ]; then \
. $HOME/venv/jazzy/bin/activate ; \
fi && \
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF
Loading