ddsrouter-docker-tests #979
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: docker_test | |
on: | |
workflow_dispatch: | |
inputs: | |
fastdds_branch: | |
description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)' | |
required: true | |
default: 'master' | |
ddspipe_branch: | |
description: 'Branch or tag of DDS Pipe repository (https://github.com/eProsima/DDS-Pipe)' | |
required: true | |
default: 'main' | |
ddsrouter_branch: | |
description: 'Branch or tag of DDS Router repository (https://github.com/eProsima/DDS-Router)' | |
required: true | |
default: 'main' | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
docker_test: | |
runs-on: ubuntu-20.04 | |
env: | |
DEFAULT_FASTDDS_BRANCH: 'master' | |
DEFAULT_DDSPIPE_BRANCH: 'main' | |
DEFAULT_DDSROUTER_BRANCH: 'main' | |
DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE: "ddsrouter:ci" | |
DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE: "vulcanexus:ci" | |
steps: | |
# Sync current branch | |
- name: Sync eProsima/DDS-Router repository | |
uses: actions/checkout@v3 | |
with: | |
path: src/DDS-Router | |
# Echo Env Var to debug workflow | |
- name: Echo env variables | |
run: | | |
echo "--- Input Variables ---" | |
echo "github.event.inputs.fastdds_branch: ${{ github.event.inputs.fastdds_branch }}" | |
echo "github.event.inputs.ddspipe_branch: ${{ github.event.inputs.ddspipe_branch }}" | |
echo "github.event.inputs.ddsrouter_branch: ${{ github.event.inputs.ddsrouter_branch }}" | |
echo "--- Github Environment Variables ---" | |
echo "github.head_ref: ${{ github.head_ref }}" | |
echo "--- Environment Variables ---" | |
echo "DEFAULT_FASTDDS_BRANCH: ${{ env.DEFAULT_FASTDDS_BRANCH }}" | |
echo "DEFAULT_DDSPIPE_BRANCH: ${{ env.DEFAULT_DDSPIPE_BRANCH }}" | |
echo "DEFAULT_DDSROUTER_BRANCH: ${{ env.DEFAULT_DDSROUTER_BRANCH }}" | |
# Build Vulcanexus Docker image | |
- name: Build custom Vulcanexus Docker image | |
run: | | |
cd src/DDS-Router/.github/docker/vulcanexus | |
docker build \ | |
--no-cache \ | |
--build-arg docker_image_base=eprosima/vulcanexus:humble-core \ | |
-t ${{ env.DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE }} \ | |
-f Dockerfile . | |
# Build DDS Router Docker image | |
- name: Build DDS Router Docker image | |
run: | | |
cd src/DDS-Router/.github/docker/ddsrouter | |
docker build \ | |
--no-cache \ | |
--build-arg fastdds_branch=${{ github.event.inputs.fastdds_branch || env.DEFAULT_FASTDDS_BRANCH }} \ | |
--build-arg ddspipe_branch=${{ github.event.inputs.ddspipe_branch || env.DEFAULT_DDSPIPE_BRANCH }} \ | |
--build-arg ddsrouter_branch=${{ github.event.inputs.ddsrouter_branch || github.head_ref || env.DEFAULT_DDSROUTER_BRANCH }} \ | |
-t ${{ env.DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE }} \ | |
-f Dockerfile . | |
echo "DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE: ${{ env.DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE }}" | |
# Install colcon and required apt packages | |
- name: Install apt packages | |
uses: ./src/DDS-Router/.github/actions/install-apt-packages | |
# Install colcon and required python packages | |
- name: Install Python packages | |
uses: ./src/DDS-Router/.github/actions/install-python-packages | |
# Check Docker images exist | |
- name: Check if Docker images exist | |
run: | | |
[ -n "$(docker images -q ${{ env.DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE }})" ] || echo "DDS Router Docker image does not exists" | |
[ -n "$(docker images -q ${{ env.DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE }})" ] || echo "Vulcanexus image does not exists" | |
# Get artifact to use cmake_utils | |
- name: Get build eProsima dependencies Job Id | |
run: | | |
export JOB_ID=$(curl -sL $GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/workflows/build_fastdds.yml/runs | \ | |
jq '.workflow_runs[] | select(.status == "completed") | .id' | \ | |
head -n 1) | |
echo "fastdds_job_id=${JOB_ID}" >> $GITHUB_ENV | |
- name: Download eProsima dependencies | |
uses: dawidd6/action-download-artifact@v2 | |
with: | |
workflow: build_fastdds.yml | |
path: /home/runner/work/fastdds/install | |
name: ubuntu-20.04_fastdds_install | |
run_id: ${{ env.fastdds_job_id }} | |
# Run ddsrouter_test compose tests | |
- name: Run tests | |
run: | | |
export DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE=${{ env.DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE }} | |
export DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE=${{ env.DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE }} | |
source /home/runner/work/fastdds/install/setup.bash | |
colcon build --event-handlers console_direct+ --packages-up-to ddsrouter_test --cmake-args -DBUILD_COMPOSE_TESTS=ON | |
colcon test \ | |
--packages-select ddsrouter_test \ | |
--event-handlers console_direct+ \ | |
--return-code-on-test-failure \ | |
--ctest-args \ | |
--label-exclude xfail \ | |
--timeout 120 | |
- name: Run flaky tests | |
continue-on-error: true | |
run: | | |
export DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE=${{ env.DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE }} | |
export DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE=${{ env.DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE }} | |
colcon build --event-handlers console_direct+ --packages-up-to ddsrouter_test --cmake-args -DBUILD_COMPOSE_TESTS=ON | |
colcon test \ | |
--packages-select ddsrouter_test \ | |
--event-handlers console_direct+ \ | |
--return-code-on-test-failure \ | |
--ctest-args \ | |
--label-regex xfail \ | |
--timeout 120 |