-
Notifications
You must be signed in to change notification settings - Fork 1
288 lines (239 loc) · 8.8 KB
/
ros_docker.yaml
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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
name: ROS - Build/Publish Docker Image and Run Tests
on:
workflow_dispatch:
release:
types: [published]
jobs:
build_push_testing:
runs-on: ubuntu-20.04
outputs:
random1: ${{ steps.random1.outputs.random }}
random2: ${{ steps.random2.outputs.random }}
random3: ${{ steps.random3.outputs.random }}
steps:
- id: random1
run: echo "random=$RANDOM" >> $GITHUB_OUTPUT
- id: random2
run: echo "random=$RANDOM" >> $GITHUB_OUTPUT
- id: random3
run: echo "random=$RANDOM" >> $GITHUB_OUTPUT
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (latest only)
if: github.ref_name == 'main'
uses: docker/build-push-action@v2
with:
platforms: "linux/amd64"
file: Dockerfile.ros
push: true
build-args: |
ROS_DISTRO=iron
TAG=core
tags: husarnet/ros:iron-ros-core-testing
# Without Husarnet
test_no_husarnet:
name: Test no-Husarnet setup
needs: build_push_testing
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run test for ${{ matrix.hostname }}
continue-on-error: true
timeout-minutes: 2
run: |
cd demo-ros
export ROS_DISTRO=iron
export CHATTER_ROLE=talker
docker compose -f compose.no-husarnet.yaml up
- name: tree
run: cd demo-ros && docker compose logs chatter | tee output.txt
- name: tree
run: tree
- name: show demo-ros/output.txt content
run: cat demo-ros/output.txt
- name: "Check if the log contains 'Hello World' string"
run: "if [[ $(grep 'Hello World' demo-ros/output.txt | wc -l) -eq 0 ]]; then exit 1; fi"
# Fast DDS simple
test_fastdds_simple:
name: Test Fast DDS simple
needs: build_push_testing
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
ros-distro: [iron]
chatter-role: [talker, listener]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run test for ${{ matrix.chatter-role }}
continue-on-error: true
timeout-minutes: 2
run: |
cd demo-ros
export ROS_DISTRO=${{ matrix.ros-distro }}
export CHATTER_ROLE=${{ matrix.chatter-role }}
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=/husarnet-fastdds-simple.xml
export WAIT_HOSTNAMES=talker-${{needs.build_push_testing.outputs.random1}},listener-${{needs.build_push_testing.outputs.random1}}
export JOINCODE=${{ secrets.JOINCODE }}
export HOSTNAME=${{ matrix.chatter-role }}-${{needs.build_push_testing.outputs.random1}}
export HUSARNET_DDS_DEBUG=TRUE
docker compose up husarnet chatter
- name: tree
run: cd demo-ros && docker compose logs chatter | tee output.txt
- name: tree
run: tree
- name: show demo-ros/output.txt content
run: cat demo-ros/output.txt
- name: "Check if the log contains 'Hello World' string"
run: "if [[ $(grep 'Hello World' demo-ros/output.txt | wc -l) -eq 0 ]]; then exit 1; fi"
# Fast DDS discovery server
test_fastdds_ds:
name: Test Fast DDS Discovery Server
needs: build_push_testing
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
include:
- chatter-role: talker
dds-xml: /husarnet-fastdds-ds.xml
hostname: talker
services: husarnet chatter
- chatter-role: listener
dds-xml: /husarnet-fastdds-ds.xml
hostname: listener
services: husarnet chatter
- chatter-role: "listener"
dds-xml: "/husarnet-fastdds-ds.xml"
hostname: ds
services: husarnet chatter discovery-server
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run test for ${{ matrix.hostname }}
continue-on-error: true
timeout-minutes: 2
run: |
cd demo-ros
export ROS_DISTRO=iron
export CHATTER_ROLE=${{ matrix.chatter-role }}
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp
export FASTRTPS_DEFAULT_PROFILES_FILE=${{ matrix.dds-xml }}
export WAIT_HOSTNAMES=ds-${{needs.build_push_testing.outputs.random2}}
export ROS_DISCOVERY_SERVER=ds-${{needs.build_push_testing.outputs.random2}}:11811
export JOINCODE=${{ secrets.JOINCODE }}
export HOSTNAME=${{ matrix.hostname }}-${{needs.build_push_testing.outputs.random2}}
export HUSARNET_DDS_DEBUG=TRUE
docker compose up ${{ matrix.services }}
- name: tree
run: cd demo-ros && docker compose logs chatter | tee output.txt
- name: tree
run: tree
- name: show demo-ros/output.txt content
run: cat demo-ros/output.txt
- name: "Check if the log contains 'Hello World' string"
run: "if [[ $(grep 'Hello World' demo-ros/output.txt | wc -l) -eq 0 ]]; then exit 1; fi"
# Cyclone DDS simple
test_cyclonedds_simple:
name: Test Cyclone DDS simple
needs: build_push_testing
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
ros-distro: [iron]
chatter-role: [talker, listener]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: run test for ${{ matrix.chatter-role }}
continue-on-error: true
timeout-minutes: 2
run: |
cd demo-ros
export ROS_DISTRO=${{ matrix.ros-distro }}
export CHATTER_ROLE=${{ matrix.chatter-role }}
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export CYCLONEDDS_URI=file:///husarnet-cyclonedds-simple.xml
export WAIT_HOSTNAMES=talker-${{needs.build_push_testing.outputs.random2}},listener-${{needs.build_push_testing.outputs.random3}}
export JOINCODE=${{ secrets.JOINCODE }}
export HOSTNAME=${{ matrix.chatter-role }}-${{needs.build_push_testing.outputs.random3}}
export HUSARNET_DDS_DEBUG=TRUE
docker compose up husarnet chatter
- name: tree
run: cd demo-ros && docker compose logs chatter | tee output.txt
- name: tree
run: tree
- name: show demo-ros/output.txt content
run: cat demo-ros/output.txt
- name: "Check if the log contains 'Hello World' string"
run: "if [[ $(grep 'Hello World' demo-ros/output.txt | wc -l) -eq 0 ]]; then exit 1; fi"
# Push on Docker Hub if tests were finished positively
build_push_production:
runs-on: ubuntu-20.04
needs:
- test_no_husarnet
- test_fastdds_simple
- test_fastdds_ds
- test_cyclonedds_simple
strategy:
fail-fast: false
matrix:
ros-distro: [iron, humble]
tag: [core, base]
steps:
- name: Print event name and ref name
run: echo "Event name - ${{ github.event_name }}, ref name - ${{ github.ref_name}}"
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
version: latest
- name: Login to Docker Registry
uses: docker/login-action@v1
with:
registry: docker.io
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push (latest only)
if: github.ref_name == 'main' && github.event_name != 'release'
uses: docker/build-push-action@v2
with:
platforms: "linux/amd64, linux/arm64"
file: Dockerfile.ros
push: true
build-args: |
ROS_DISTRO=${{ matrix.ros-distro }}
TAG=${{ matrix.tag }}
tags: husarnet/ros:${{ matrix.ros-distro }}-ros-${{ matrix.tag }}
- name: Build and push (release)
if: github.event_name == 'release'
uses: docker/build-push-action@v2
with:
platforms: "linux/amd64, linux/arm64"
file: Dockerfile.ros
push: true
build-args: |
ROS_DISTRO=${{ matrix.ros-distro }}
TAG=${{ matrix.tag }}
tags: |
husarnet/ros:${{ matrix.ros-distro }}-ros-${{ matrix.tag }}
husarnet/ros:${{ matrix.ros-distro }}-ros-${{ matrix.tag }}-${{ github.ref_name}}