-
Notifications
You must be signed in to change notification settings - Fork 22
195 lines (168 loc) · 6.1 KB
/
vxworks-ros2-build.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
# This is a workflow for the VxWorks ROS 2 build.
# It builds a ROS 2 VxWorks port against the VxWorks SDK
name: 'VxWorks ROS 2 build'
run-name: Build ${{ inputs.ros_distro }} ${{ inputs.vxworks }} ${{ inputs.sdk }}
on:
workflow_dispatch:
inputs:
ros_distro:
description: 'ROS 2 Distribution'
required: true
default: 'humble'
vxworks:
description: 'VxWorks Release'
required: true
default: '24.03'
sdk:
description: 'SDK Name'
required: true
default: 'qemu'
test:
description: 'Run tests'
required: false
default: false
debug:
description: 'Debug'
required: false
default: false
schedule:
- cron: '0 0 * * 0' # Runs at 00:00 UTC every Sunday
jobs:
build:
runs-on: ubuntu-22.04
services:
registry:
image: registry:2
ports:
- 5000:5000
env:
# Check if input variables exist, otherwise set defaults for scheduled runs
ros_distro: ${{ github.event.inputs.ros_distro || 'humble' }}
vxworks: ${{ github.event.inputs.vxworks || '24.03' }}
sdk: ${{ github.event.inputs.sdk || 'qemu' }}
test: ${{ github.event.inputs.test || 'false' }}
debug: ${{ github.event.inputs.debug || 'false' }}
steps:
- name: Checks-out a branch ${{ github.ref }}
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Use Download SDK action
uses: ./.github/actions/setup-wrsdk
with:
sdks_list: wrsdks.json
sdk: ${{ env.sdk }}
vxworks: ${{ env.vxworks }}
directory: /tmp
sdkenv: false
- name: store runners uid and gid
run: |
echo "`id -u`" > /tmp/wrsdk/uid
echo "`id -g`" > /tmp/wrsdk/gid
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
driver-opts: network=host
- name: Build vxbuild docker image
uses: docker/build-push-action@v6
with:
context: Docker/22.04/vxbuild/.
push: true
tags: localhost:5000/local/vxbuild:22.04
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Inspect
run: |
docker buildx imagetools inspect localhost:5000/local/vxbuild:22.04
- name: Build vxros2build docker image
uses: docker/build-push-action@v6
with:
context: Docker/22.04/vxros2build/.
push: false
load: true
build-args: |
ROS_DISTRO=${{ env.ros_distro }}
BASE_IMAGE=localhost:5000/local/vxbuild:22.04
tags: vxros2build:${{ env.ros_distro }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Verify Docker vxros2build:${{ env.ros_distro }} image
run: |
docker images vxros2build:${{ env.ros_distro }}
- name: Build ROS 2 ${{ env.ros_distro }} against VxWorks ${{ env.vxworks }} ${{ env.sdk }}
uses: addnab/docker-run-action@v3
with:
image: vxros2build:${{ env.ros_distro }}
options: -v ${{ github.workspace }}:/work -v /tmp/wrsdk:/wrsdk
run: |
groupadd -g "`cat /wrsdk/gid`" wruser
useradd -u "`cat /wrsdk/uid`" -m wruser -g wruser
su wruser -c 'source /wrsdk/sdkenv.sh && make -C /work'
- name: Create an SROS2 script
run: |
cat << 'EOF' > /tmp/sros2_script.sh
#!/bin/bash
. /opt/ros/humble/setup.sh
ros2 security create_keystore demo_keystore
ros2 security create_enclave demo_keystore /talker_listener/talker
ros2 security create_enclave demo_keystore /talker_listener/listener
EOF
chmod +x /tmp/sros2_script.sh
- name: Generate a keystore, keys, and certificates for the talker and listener nodes
uses: addnab/docker-run-action@v3
with:
image: vxros2build:${{ env.ros_distro }}
options: -v ${{ github.workspace }}:/work -v /tmp/sros2_script.sh:/tmp/sros2_script.sh
run: |
cd /tmp
/tmp/sros2_script.sh
mv /tmp/demo_keystore /work/output/export/deploy/.
# - name: Build ROS 2 ${{ env.ros_distro }} against VxWorks ${{ env.sdk }}
# env:
# UID: ${{ env.uid }}
# GID: ${{ env.gid }}
# uses: docker://razr/vxros2build:${{ env.ros_distro }}
# with:
# args: source /github/home/wrsdk/${{ env.script }} && make -C /github/workspace
- name: Create an HDD image
run: |
sudo apt-get update
sudo apt-get install -y dosfstools
cd ${{ github.workspace }}
dd if=/dev/zero of=ros2.img count=2048 bs=1M
mkfs.vfat -F 32 ./ros2.img
mkdir -p /tmp/mount
sudo mount -o loop -t vfat ./ros2.img /tmp/mount
sudo cp -r -L ./output/export/deploy/* /tmp/mount/.
df -h /tmp/mount/
sudo umount /tmp/mount
- name: Copy VxWorks image
run: |
cp /tmp/wrsdk/vxsdk/bsps/*/*xWorks* ${{ github.workspace }}
- name: Upload VxWorks and the HDD image
uses: actions/upload-artifact@v3
with:
name: HDD image ${{ env.sdk }} ${{ env.ros_distro }}
path: |
${{ github.workspace }}/ros2.img
${{ github.workspace }}/*xWorks*
- name: Setup tmate session
if: ${{ env.debug == 'true' }}
uses: mxschmitt/action-tmate@v3
- name: Run Tests with QEMU and expect
if: ${{ env.test == 'true' }}
run: |
# Change directory to GitHub workspace
cd ${{ github.workspace }}
# Update apt and install dependencies
sudo apt-get update
sudo apt-get install -y qemu-system-x86 expect
# Add user to kvm group
sudo usermod -aG kvm $USER
# Setup tun
sudo apt-get install uml-utilities
sudo tunctl -u $USER -t tap0
sudo ifconfig tap0 192.168.200.254 up
# Run tests
echo "Running tests..."
./tests/main_script.exp