Skip to content

Commit

Permalink
Add Docker tests
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Lopez Fernandez <[email protected]>
  • Loading branch information
juanlofer-eprosima committed Sep 26, 2024
1 parent fd2ba0d commit 22ccf92
Show file tree
Hide file tree
Showing 15 changed files with 889 additions and 0 deletions.
22 changes: 22 additions & 0 deletions .github/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM ubuntu:22.04
LABEL [email protected]

# Avoid interactuation with installation of some package that needs the locale.
ENV TZ=Europe/Madrid
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

# Avoids using interactions during building
ENV DEBIAN_FRONTEND=noninteractive

# Use a bash shell so it is possigle to run things like `source` (required for colcon builds)
SHELL ["/bin/bash", "-c"]

COPY linux_bisource_installation.bash /tmp/linux_bisource_installation.bash
RUN chmod +x /tmp/linux_bisource_installation.bash
RUN /tmp/linux_bisource_installation.bash
RUN rm /tmp/linux_bisource_installation.bash

COPY run.bash /root/run.bash
RUN chmod +x /root/run.bash

ENTRYPOINT ["/root/run.bash" ]
142 changes: 142 additions & 0 deletions .github/docker/linux_bisource_installation.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/bin/bash

set -e

if (( $EUID == 0 )); then
shopt -s expand_aliases
alias sudo=''
fi

if !(locale | grep -e 'utf8' -e 'UTF-8') >/dev/null 2>&1; then

##LINUX_BINARY_LOCALE
locale # check for UTF-8

sudo apt update && sudo apt install -y locales
# Any UTF-8 locale will work. Using en_US as an example
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
##!

locale

fi

##LINUX_BINARY_UBUNTU_UNIVERSE
apt-cache policy | grep universe

# This should print something similar to:
#
# 500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
# release v=22.04,o=Ubuntu,a=jammy,n=jammy,l=Ubuntu,c=universe,b=amd64
#
# Otherwise run

sudo apt install -y software-properties-common
sudo add-apt-repository universe -y
##!

##LINUX_BINARY_KEYSTORE
sudo apt update && sudo apt install -y curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
##!

##LINUX_BINARY_REPO_SOURCELIST
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
##!

##LINUX_BINARY_ROS_UPDATE
sudo apt update -y
##!

##LINUX_BINARY_ROS_INSTALL
sudo apt install -y ros-iron-desktop
##!

##SETUP_ROS_ENV
source "/opt/ros/iron/setup.bash"
##!

##CREATE_WORKSPACE
mkdir -p ~/vulcanexus_iron/src
cd ~/vulcanexus_iron
##!

##LINUX_SOURCE_ROS2_DEPS
sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
python3-colcon-common-extensions \
python3-flake8 \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-docstrings \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-pytest-repeat \
python3-pytest-rerunfailures \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget
##!

##LINUX_SOURCE_VULCA_DEPS
sudo apt update && sudo apt install -y \
libasio-dev \
libdocopt-dev \
libengine-pkcs11-openssl \
liblog4cxx-dev \
liblz4-dev \
libp11-dev \
libqt5charts5-dev \
libssl-dev \
libtinyxml2-dev \
libxerces-c-dev \
libyaml-cpp-dev \
libzstd-dev \
openjdk-8-jdk \
python3-sphinx \
python3-sphinx-rtd-theme \
qtbase5-dev \
qtdeclarative5-dev \
qtquickcontrols2-5-dev \
swig
##!

# Get Vulcanexus sources
wget https://raw.githubusercontent.com/eProsima/vulcanexus/iron/vulcanexus.repos
wget https://raw.githubusercontent.com/eProsima/vulcanexus/iron/colcon.meta
vcs import --force src < vulcanexus.repos

# Avoid compilation of some documentation and demo packages
touch src/eProsima/Fast-DDS-QoS-Profiles-Manager/docs/COLCON_IGNORE
touch src/eProsima/Vulcanexus-Base/docs/COLCON_IGNORE
touch src/eProsima/Vulcanexus-Base/code/COLCON_IGNORE
##!

#################################################################################################
#################################################################################################
#################################################################################################
###### TEMP ######
cd /tmp
git clone https://github.com/eProsima/vulcanexus.git
cd vulcanexus
git checkout feature/fastdds-cli-package
mv fastdds_cli ~/vulcanexus_iron/src/eProsima/Vulcanexus-Base
#################################################################################################
#################################################################################################
#################################################################################################

##LINUX_SOURCE_VULCA_COMPILE
cd ~/vulcanexus_iron
colcon build --cmake-args -DBUILD_TESTING=OFF
##!
7 changes: 7 additions & 0 deletions .github/docker/run.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

# Setup environment
source "/opt/ros/iron/setup.bash"
source "/root/vulcanexus_iron/install/setup.bash"

exec "$@"
59 changes: 59 additions & 0 deletions .github/workflows/test_docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: test-docker-workflow
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- humble
- iron
- jazzy

schedule:
- cron: '0 0 * * *'

jobs:
docker-tests:
runs-on: ubuntu-22.04

env:
VULCANEXUS_COMPOSE_TEST_DOCKER_IMAGE: "vulcanexus:ci"

steps:

- name: Sync repository
uses: eProsima/eProsima-CI/external/checkout@v0
with:
path: src
# ref: main
ref: feature/fastdds-cli-package

- name: Build Vulcanexus Docker image
run: |
cd ./src/.github/docker
docker build \
--no-cache \
-t ${{ env.VULCANEXUS_COMPOSE_TEST_DOCKER_IMAGE }} \
-f Dockerfile .
- name: Check if Docker images exist
run: |
[ -n "$(docker images -q ${{ env.VULCANEXUS_COMPOSE_TEST_DOCKER_IMAGE }})" ] || echo "Vulcanexus Docker image does not exist"
- name: Compile docker tests
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
workspace: ${{ github.workspace }}
colcon_build_args: --packages-up-to vulcanexus_test
cmake_args: -DBUILD_COMPOSE_TESTS=ON

- name: Run tests
run: |
export VULCANEXUS_COMPOSE_TEST_DOCKER_IMAGE=${{ env.VULCANEXUS_COMPOSE_TEST_DOCKER_IMAGE }}
source install/setup.bash
colcon test \
--packages-select vulcanexus_test \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--ctest-args \
--timeout 120
142 changes: 142 additions & 0 deletions docs/resources/scripts/linux_bisource_installation.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
#!/bin/bash

set -e

if (( $EUID == 0 )); then
shopt -s expand_aliases
alias sudo=''
fi

if !(locale | grep -e 'utf8' -e 'UTF-8') >/dev/null 2>&1; then

##LINUX_BINARY_LOCALE
locale # check for UTF-8

sudo apt update && sudo apt install -y locales
# Any UTF-8 locale will work. Using en_US as an example
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8
##!

locale

fi

##LINUX_BINARY_UBUNTU_UNIVERSE
apt-cache policy | grep universe

# This should print something similar to:
#
# 500 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 Packages
# release v=22.04,o=Ubuntu,a=jammy,n=jammy,l=Ubuntu,c=universe,b=amd64
#
# Otherwise run

sudo apt install -y software-properties-common
sudo add-apt-repository universe -y
##!

##LINUX_BINARY_KEYSTORE
sudo apt update && sudo apt install -y curl gnupg lsb-release
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
##!

##LINUX_BINARY_REPO_SOURCELIST
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu $(source /etc/os-release && echo $UBUNTU_CODENAME) main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
##!

##LINUX_BINARY_ROS_UPDATE
sudo apt update -y
##!

##LINUX_BINARY_ROS_INSTALL
sudo apt install -y ros-iron-desktop
##!

##SETUP_ROS_ENV
source "/opt/ros/iron/setup.bash"
##!

##CREATE_WORKSPACE
mkdir -p ~/vulcanexus_iron/src
cd ~/vulcanexus_iron
##!

##LINUX_SOURCE_ROS2_DEPS
sudo apt update && sudo apt install -y \
build-essential \
cmake \
git \
python3-colcon-common-extensions \
python3-flake8 \
python3-flake8-blind-except \
python3-flake8-builtins \
python3-flake8-class-newline \
python3-flake8-comprehensions \
python3-flake8-deprecated \
python3-flake8-docstrings \
python3-flake8-import-order \
python3-flake8-quotes \
python3-pip \
python3-pytest \
python3-pytest-cov \
python3-pytest-repeat \
python3-pytest-rerunfailures \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget
##!

##LINUX_SOURCE_VULCA_DEPS
sudo apt update && sudo apt install -y \
libasio-dev \
libdocopt-dev \
libengine-pkcs11-openssl \
liblog4cxx-dev \
liblz4-dev \
libp11-dev \
libqt5charts5-dev \
libssl-dev \
libtinyxml2-dev \
libxerces-c-dev \
libyaml-cpp-dev \
libzstd-dev \
openjdk-8-jdk \
python3-sphinx \
python3-sphinx-rtd-theme \
qtbase5-dev \
qtdeclarative5-dev \
qtquickcontrols2-5-dev \
swig
##!

# Get Vulcanexus sources
wget https://raw.githubusercontent.com/eProsima/vulcanexus/iron/vulcanexus.repos
wget https://raw.githubusercontent.com/eProsima/vulcanexus/iron/colcon.meta
vcs import --force src < vulcanexus.repos

# Avoid compilation of some documentation and demo packages
touch src/eProsima/Fast-DDS-QoS-Profiles-Manager/docs/COLCON_IGNORE
touch src/eProsima/Vulcanexus-Base/docs/COLCON_IGNORE
touch src/eProsima/Vulcanexus-Base/code/COLCON_IGNORE
##!

#################################################################################################
#################################################################################################
#################################################################################################
###### TEMP ######
cd /tmp
git clone https://github.com/eProsima/vulcanexus.git
cd vulcanexus
git checkout feature/fastdds-cli-package
mv fastdds_cli ~/vulcanexus_iron/src/eProsima/Vulcanexus-Base
#################################################################################################
#################################################################################################
#################################################################################################

##LINUX_SOURCE_VULCA_COMPILE
cd ~/vulcanexus_iron
colcon build --cmake-args -DBUILD_TESTING=OFF
##!
Loading

0 comments on commit 22ccf92

Please sign in to comment.