-
Notifications
You must be signed in to change notification settings - Fork 20
155 lines (140 loc) · 6.69 KB
/
docker_test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
name: ddsrouter-docker-tests
on:
workflow_dispatch:
inputs:
fastcdr_branch:
description: 'Branch or tag of Fast CDR repository (https://github.com/eProsima/Fast-CDR)'
required: true
default: 'master'
fastdds_branch:
description: 'Branch or tag of Fast DDS repository (https://github.com/eProsima/Fast-DDS)'
required: true
default: 'master'
devutils_branch:
description: 'Branch or tag of dev-utils repository (https://github.com/eProsima/dev-utils)'
required: true
default: 'main'
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'
dependencies_artifact_postfix:
description: 'Postfix name to add to artifact name to download dependencies. This is use to download a specific artifact version from eProsima-CI.'
required: true
default: '_nightly'
pull_request:
push:
branches:
- main
schedule:
- cron: '0 0 * * *'
env:
code_packages_names: 'ddsrouter_test'
docs_packages_names: ''
default_dependencies_artifact_postfix: '_nightly'
jobs:
docker-test:
runs-on: ubuntu-22.04
env:
DEFAULT_FASTCDR_BRANCH: 'master'
DEFAULT_FASTDDS_BRANCH: 'master'
DEFAULT_DEVUTILS_BRANCH: 'main'
DEFAULT_DDSPIPE_BRANCH: 'main'
DEFAULT_DDSROUTER_BRANCH: 'main'
DDSROUTER_COMPOSE_TEST_DOCKER_IMAGE: "ddsrouter:ci"
DDSROUTER_COMPOSE_TEST_ROS2_DOCKER_IMAGE: "vulcanexus:ci"
steps:
- name: Sync repository
uses: eProsima/eProsima-CI/external/checkout@v0
with:
path: ${{ github.workspace }}/src
# Echo Env Var to debug workflow
- name: Echo env variables
run: |
echo "--- Input Variables ---"
echo "github.event.inputs.fastcdr_branch: ${{ github.event.inputs.fastcdr_branch }}"
echo "github.event.inputs.fastdds_branch: ${{ github.event.inputs.fastdds_branch }}"
echo "github.event.inputs.devutils_branch: ${{ github.event.inputs.devutils_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_FASTCDR_BRANCH: ${{ env.DEFAULT_FASTCDR_BRANCH }}"
echo "DEFAULT_FASTDDS_BRANCH: ${{ env.DEFAULT_FASTDDS_BRANCH }}"
echo "DEFAULT_DEVUTILS_BRANCH: ${{ env.DEFAULT_DEVUTILS_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/.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/.github/docker/ddsrouter
docker build \
--no-cache \
--build-arg fastcdr_branch=${{ github.event.inputs.fastcdr_branch || env.DEFAULT_FASTCDR_BRANCH }} \
--build-arg fastdds_branch=${{ github.event.inputs.fastdds_branch || env.DEFAULT_FASTDDS_BRANCH }} \
--build-arg devutils_branch=${{ github.event.inputs.devutils_branch || env.DEFAULT_DEVUTILS_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 }}"
# 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"
- name: Download dependencies and install requirements
uses: ./src/.github/actions/project_dependencies
with:
os: ubuntu-22.04
cmake_build_type: "Release"
dependencies_artifact_postfix: ${{ github.event.inputs.dependencies_artifact_postfix || env.default_dependencies_artifact_postfix }}
secret_token: ${{ secrets.GITHUB_TOKEN }}
- name: Compile docker tests
uses: eProsima/eProsima-CI/multiplatform/colcon_build@v0
with:
workspace: ${{ github.workspace }}
colcon_build_args: --packages-up-to ddsrouter_test
cmake_args: -DBUILD_COMPOSE_TESTS=ON -DCMAKE_BUILD_TYPE=Release
workspace_dependencies: ${{ github.workspace }}/install
colcon_meta_file: ${{ github.workspace }}/src/.github/workflows/configurations/${{ runner.os }}/colcon.meta
# Run ddsrouter_test compose tests
- 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 }}
source ${{ github.workspace }}/install/setup.bash
colcon test \
--packages-select ddsrouter_test \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--ctest-args \
--label-regex xfail \
--timeout 120
- 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 ${{ github.workspace }}/install/setup.bash
colcon test \
--packages-select ddsrouter_test \
--event-handlers console_direct+ \
--return-code-on-test-failure \
--ctest-args \
--label-exclude xfail \
--timeout 120