Skip to content

Commit ad60577

Browse files
authored
Setup CI (#240)
* Add ROS2 installation to Dockerfile * Add github workflows * Add ROS2 dependencies to dockerfile * Fix docker detection * Fix ROS2 deps installation inside docker * Add missing config entry for docker build * Add load-env validation * Add clarification comment * Source radar_msgs when testing ROS2 on dev environment
1 parent be71c26 commit ad60577

File tree

7 files changed

+377
-8
lines changed

7 files changed

+377
-8
lines changed
Lines changed: 201 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
name: build-and-test
2+
3+
run-name: Build & test for PR '${{ github.event.pull_request.title }}'
4+
5+
on: [pull_request]
6+
7+
# Cancel previous runs if new changes on PR/branch
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
###### PREPARE WORKFLOW ######
14+
checkout-repository:
15+
runs-on: self-hosted
16+
steps:
17+
- name: Checkout repository code
18+
uses: actions/checkout@v3
19+
- name: Import private extensions
20+
run: vcs import < extensions.repos
21+
22+
load-env:
23+
uses: ./.github/workflows/load-env-subworkflow.yml
24+
25+
###### BUILD USING RGL DOCKER ######
26+
build-core:
27+
needs: [checkout-repository, load-env]
28+
uses: ./.github/workflows/build-subworkflow.yml
29+
with:
30+
build-command: ./setup.py --build-dir build-core
31+
self-hosted-user-id: ${{ needs.load-env.outputs.user-id }}
32+
optix-install-dir: ${{ needs.load-env.outputs.optix-install-dir }}
33+
docker-image: localhost:5000/rgl:latest
34+
35+
build-pcl:
36+
needs: [checkout-repository, load-env]
37+
uses: ./.github/workflows/build-subworkflow.yml
38+
with:
39+
build-command: './setup.py --with-pcl --build-dir build-pcl'
40+
self-hosted-user-id: ${{ needs.load-env.outputs.user-id }}
41+
optix-install-dir: ${{ needs.load-env.outputs.optix-install-dir }}
42+
docker-image: localhost:5000/rgl:latest
43+
44+
build-ros2:
45+
needs: [ checkout-repository, load-env ]
46+
uses: ./.github/workflows/build-subworkflow.yml
47+
with:
48+
build-command: '
49+
source /opt/ros/humble/setup.bash &&
50+
./setup.py --with-ros2-standalone --build-dir build-ros2'
51+
self-hosted-user-id: ${{ needs.load-env.outputs.user-id }}
52+
optix-install-dir: ${{ needs.load-env.outputs.optix-install-dir }}
53+
docker-image: localhost:5000/rgl:latest
54+
55+
build-udp:
56+
needs: [ checkout-repository, load-env ]
57+
uses: ./.github/workflows/build-subworkflow.yml
58+
with:
59+
build-command: './setup.py --with-udp --build-dir build-udp'
60+
self-hosted-user-id: ${{ needs.load-env.outputs.user-id }}
61+
optix-install-dir: ${{ needs.load-env.outputs.optix-install-dir }}
62+
docker-image: localhost:5000/rgl:latest
63+
64+
build-snow:
65+
needs: [ checkout-repository, load-env ]
66+
uses: ./.github/workflows/build-subworkflow.yml
67+
with:
68+
build-command: './setup.py --with-snow --build-dir build-snow'
69+
self-hosted-user-id: ${{ needs.load-env.outputs.user-id }}
70+
optix-install-dir: ${{ needs.load-env.outputs.optix-install-dir }}
71+
docker-image: localhost:5000/rgl:latest
72+
73+
build-all:
74+
needs: [ checkout-repository, load-env ]
75+
uses: ./.github/workflows/build-subworkflow.yml
76+
with:
77+
build-command: '
78+
source /opt/ros/humble/setup.bash &&
79+
./setup.py --with-pcl --with-ros2-standalone --with-udp --with-snow --build-dir build-all'
80+
self-hosted-user-id: ${{ needs.load-env.outputs.user-id }}
81+
optix-install-dir: ${{ needs.load-env.outputs.optix-install-dir }}
82+
docker-image: localhost:5000/rgl:latest
83+
84+
###### TEST WITH RGL DOCKER IMAGE ######
85+
test-core-dev:
86+
needs: [build-core]
87+
uses: ./.github/workflows/test-subworkflow.yml
88+
with:
89+
test-command: 'cd build-core/test && ./RobotecGPULidar_test'
90+
docker-image: localhost:5000/rgl:latest
91+
92+
test-pcl-dev:
93+
needs: [ build-pcl ]
94+
uses: ./.github/workflows/test-subworkflow.yml
95+
with:
96+
test-command: 'cd build-pcl/test && ./RobotecGPULidar_test'
97+
docker-image: localhost:5000/rgl:latest
98+
99+
test-ros2-dev:
100+
needs: [ build-ros2 ]
101+
uses: ./.github/workflows/test-subworkflow.yml
102+
with:
103+
# Source ROS2 and radar_msgs, standalone build is tested in prod environment
104+
# Run tests twice, each for different RMW implementation
105+
test-command: '
106+
source /opt/ros/humble/setup.bash &&
107+
source /rgldep/radar_msgs/install/setup.bash &&
108+
cd build-ros2/test &&
109+
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp && ./RobotecGPULidar_test &&
110+
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp && ./RobotecGPULidar_test'
111+
docker-image: localhost:5000/rgl:latest
112+
113+
test-udp-dev:
114+
needs: [ build-udp ]
115+
uses: ./.github/workflows/test-subworkflow.yml
116+
with:
117+
test-command: 'cd build-udp/test && ./RobotecGPULidar_test'
118+
docker-image: localhost:5000/rgl:latest
119+
120+
test-snow-dev:
121+
needs: [ build-snow ]
122+
uses: ./.github/workflows/test-subworkflow.yml
123+
with:
124+
test-command: 'cd build-snow/test && ./RobotecGPULidar_test'
125+
docker-image: localhost:5000/rgl:latest
126+
127+
test-all-dev:
128+
needs: [ build-all ]
129+
uses: ./.github/workflows/test-subworkflow.yml
130+
with:
131+
# Source ROS2 and radar_msgs, standalone build is tested in prod environment
132+
# Set `RGL_TEST_VLP16_CALIB_FILE` for UDP-ROS2 integration test
133+
# Run tests twice, each for different RMW implementation
134+
test-command: '
135+
source /opt/ros/humble/setup.bash &&
136+
source /rgldep/radar_msgs/install/setup.bash &&
137+
export RGL_TEST_VLP16_CALIB_FILE=$(pwd)/extensions/udp/test/resources/Ros2Vlp16Calib.yaml &&
138+
cd build-all/test &&
139+
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp && ./RobotecGPULidar_test &&
140+
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp && ./RobotecGPULidar_test'
141+
docker-image: localhost:5000/rgl:latest
142+
143+
###### TEST WITH CLEAN UBUNTU DOCKER IMAGE ######
144+
test-core-prod:
145+
needs: [build-core]
146+
uses: ./.github/workflows/test-subworkflow.yml
147+
with:
148+
test-command: 'cd build-core/test && ./RobotecGPULidar_test'
149+
docker-image: nvidia/cuda:11.7.1-base-ubuntu22.04
150+
151+
test-pcl-prod:
152+
needs: [ build-pcl ]
153+
uses: ./.github/workflows/test-subworkflow.yml
154+
with:
155+
# Additionally, install PCL extension dependent libraries for runtime
156+
test-command: '
157+
apt update && apt install -y libxcursor1 libgl1 &&
158+
cd build-pcl/test && ./RobotecGPULidar_test'
159+
docker-image: nvidia/cuda:11.7.1-base-ubuntu22.04
160+
161+
test-ros2-prod:
162+
needs: [ build-ros2 ]
163+
uses: ./.github/workflows/test-subworkflow.yml
164+
with:
165+
# Copy ROS2 libraries to be visible for libRobotecGPULidar.so
166+
# Run tests twice, each for different RMW implementation
167+
test-command: '
168+
cd build-ros2/test &&
169+
cp -r ../ros2_standalone/*.so* ../ &&
170+
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp && ./RobotecGPULidar_test &&
171+
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp && ./RobotecGPULidar_test'
172+
docker-image: nvidia/cuda:11.7.1-base-ubuntu22.04
173+
174+
test-udp-prod:
175+
needs: [ build-udp ]
176+
uses: ./.github/workflows/test-subworkflow.yml
177+
with:
178+
test-command: 'cd build-udp/test && ./RobotecGPULidar_test'
179+
docker-image: nvidia/cuda:11.7.1-base-ubuntu22.04
180+
181+
test-snow-prod:
182+
needs: [ build-snow ]
183+
uses: ./.github/workflows/test-subworkflow.yml
184+
with:
185+
test-command: 'cd build-snow/test && ./RobotecGPULidar_test'
186+
docker-image: nvidia/cuda:11.7.1-base-ubuntu22.04
187+
188+
test-all-prod:
189+
needs: [ build-all ]
190+
uses: ./.github/workflows/test-subworkflow.yml
191+
with:
192+
# Install PCL extension dependent libraries for runtime
193+
# Copy ROS2 libraries to be visible for libRobotecGPULidar.so
194+
# Run tests twice, each for different RMW implementation
195+
test-command: '
196+
apt update && apt install -y libxcursor1 libgl1 &&
197+
cd build-all/test &&
198+
cp -r ../ros2_standalone/*.so* ../ &&
199+
export RMW_IMPLEMENTATION=rmw_fastrtps_cpp && ./RobotecGPULidar_test &&
200+
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp && ./RobotecGPULidar_test'
201+
docker-image: nvidia/cuda:11.7.1-base-ubuntu22.04
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: build-subworkflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
build-command:
7+
required: true
8+
type: string
9+
docker-image:
10+
required: true
11+
type: string
12+
# User id is used to run the docker container as the self-hosted user
13+
# It allows to delete build files created in the docker while on the host (checkout-repository job)
14+
# By default, those files are owned by the docker user, and root privileges are required to delete them
15+
self-hosted-user-id:
16+
required: true
17+
type: string
18+
optix-install-dir:
19+
required: true
20+
type: string
21+
22+
permissions:
23+
contents: read
24+
25+
jobs:
26+
build:
27+
defaults:
28+
run:
29+
shell: bash
30+
runs-on: self-hosted
31+
container:
32+
image: ${{ inputs.docker-image }}
33+
env:
34+
OptiX_INSTALL_DIR: /optix
35+
NVIDIA_DRIVER_CAPABILITIES: all
36+
volumes:
37+
- ${{ inputs.optix-install-dir }}:/optix
38+
options:
39+
--rm
40+
--gpus all
41+
--user ${{ inputs.self-hosted-user-id }}
42+
steps:
43+
- name: fix git
44+
run: git config --global --add safe.directory $PWD
45+
- name: build
46+
run: ${{ inputs.build-command }}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: load-env-subworkflow
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
optix-install-dir:
7+
value: ${{ jobs.load-env.outputs.optix-install-dir }}
8+
user-id:
9+
value: ${{ jobs.load-env.outputs.user-id }}
10+
11+
jobs:
12+
load-env:
13+
runs-on: self-hosted
14+
outputs:
15+
optix-install-dir: ${{ steps.set-envs.outputs.optix-install-dir }}
16+
user-id: ${{ steps.set-envs.outputs.user-id }}
17+
steps:
18+
- id: check-envs
19+
run: |
20+
if [[ -z "${OptiX_INSTALL_DIR}" ]]; then
21+
echo "OptiX_INSTALL_DIR env is empty"
22+
exit 1
23+
fi
24+
if [[ -z "$(id -u $USER)" ]]; then
25+
echo "Cannot deduce id of the USER"
26+
exit 1
27+
fi
28+
- id: set-envs
29+
run: |
30+
echo "optix-install-dir=$OptiX_INSTALL_DIR" | tee -a $GITHUB_OUTPUT
31+
echo "user-id=$(id -u $USER)" | tee -a $GITHUB_OUTPUT
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: test-subworkflow
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
test-command:
7+
required: true
8+
type: string
9+
docker-image:
10+
required: true
11+
type: string
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
test:
18+
defaults:
19+
run:
20+
shell: bash
21+
runs-on: self-hosted
22+
container:
23+
image: ${{ inputs.docker-image }}
24+
env:
25+
NVIDIA_DRIVER_CAPABILITIES: all
26+
options:
27+
--rm
28+
--gpus all
29+
steps:
30+
- name: test
31+
run: ${{ inputs.test-command }}

0 commit comments

Comments
 (0)