-
Notifications
You must be signed in to change notification settings - Fork 26
205 lines (185 loc) · 8.01 KB
/
Copy pathtest.yml
File metadata and controls
205 lines (185 loc) · 8.01 KB
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
name: Interop Tests
on:
push:
branches: [main]
paths-ignore:
- '**.md'
- 'book/**'
- '.github/workflows/docs.yml'
- '.github/workflows/mkdocs-preview.yml'
- '.github/workflows/ci.yml'
- '.github/workflows/rmw-zenoh-rs.yml'
- '.github/workflows/semantic-pr.yml'
- '.github/workflows/pr-draft-check.yml'
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches: [main]
paths-ignore:
- '**.md'
- 'book/**'
- '.github/workflows/docs.yml'
- '.github/workflows/mkdocs-preview.yml'
- '.github/workflows/ci.yml'
- '.github/workflows/rmw-zenoh-rs.yml'
- '.github/workflows/semantic-pr.yml'
- '.github/workflows/pr-draft-check.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
jobs:
interop_test:
name: Interop tests with ROS 2 ${{ matrix.distro }}
runs-on: ubuntu-latest
# Skip for draft PRs to save CI time during development
if: |
github.event_name == 'push' ||
github.event.pull_request.draft == false
strategy:
fail-fast: false
matrix:
distro: [humble, jazzy, kilted, lyrical]
include:
- distro: humble
image: ros:humble-ros-base
hiroz_feature: humble
- distro: jazzy
image: ros:jazzy-ros-base
hiroz_feature: jazzy
- distro: kilted
image: ros:kilted-ros-base
hiroz_feature: kilted
- distro: lyrical
image: ros:lyrical-ros-base
hiroz_feature: lyrical
container:
image: ${{ matrix.image }}
steps:
- name: Compute weekly cache key
id: cache-week
run: echo "week=$(date -u +%Y-W%V)" >> "$GITHUB_OUTPUT"
- name: Cache apt packages
uses: actions/cache@v4
with:
path: /var/cache/apt/archives
key: apt-${{ matrix.distro }}-v3-${{ hashFiles('.github/workflows/test.yml') }}
# The apt package-index fetch (not the downloads) is the mirror bottleneck
# here (~900 B/s), costing minutes per job. Cache the index; keyed weekly
# so it can't go permanently stale — a miss just re-fetches.
- name: Cache apt package lists
uses: actions/cache@v4
with:
path: /var/lib/apt/lists
key: apt-lists-${{ matrix.distro }}-${{ steps.cache-week.outputs.week }}
restore-keys: |
apt-lists-${{ matrix.distro }}-
# GitHub runners are on Azure, but the ROS base images point at the
# generic archive/security.ubuntu.com endpoints, which are slow from here
# (~75-900 B/s). Repoint to Azure's same-datacenter mirror. Handles both
# the legacy one-line sources.list and the newer deb822 *.sources format.
- name: Point apt at the Azure Ubuntu mirror
run: |
if [ -f /etc/apt/sources.list ]; then
sed -i \
-e 's|http://archive\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
-e 's|http://security\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
/etc/apt/sources.list
fi
# Guard with `ls`: with nullglob off, a non-matching glob expands to
# the literal pattern, so don't rely on the match itself.
if ls /etc/apt/sources.list.d/*.sources > /dev/null 2>&1; then
sed -i \
-e 's|http://archive\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
-e 's|http://security\.ubuntu\.com/ubuntu|http://azure.archive.ubuntu.com/ubuntu|g' \
/etc/apt/sources.list.d/*.sources
fi
- name: Install system dependencies
run: |
# Install jq here so taiki-e/install-action's cargo-nextest step
# below doesn't trigger a second, redundant apt-get update for it.
apt-get update && apt-get install -y nodejs jq
- name: Install Nushell
run: |
NU_VERSION=0.102.0
ARCH=$(uname -m | sed 's/x86_64/x86_64/;s/aarch64/aarch64/')
NU_TARBALL="nu-${NU_VERSION}-${ARCH}-unknown-linux-gnu"
curl -fsSL "https://github.com/nushell/nushell/releases/download/${NU_VERSION}/${NU_TARBALL}.tar.gz" \
| tar -xz -C /usr/local/bin --strip-components=1 "${NU_TARBALL}/nu"
- name: Install ROS dependencies
run: |
apt-get install -y \
ros-${{ matrix.distro }}-example-interfaces \
ros-${{ matrix.distro }}-rmw-zenoh-cpp \
ros-${{ matrix.distro }}-demo-nodes-cpp \
ros-${{ matrix.distro }}-action-tutorials-cpp \
ros-${{ matrix.distro }}-geometry-msgs \
ros-${{ matrix.distro }}-sensor-msgs \
ros-${{ matrix.distro }}-nav-msgs \
protobuf-compiler
- name: Fix broken rmw_zenoh_cpp config for Kilted
if: matrix.distro == 'kilted'
run: |
# WORKAROUND: ros-kilted-rmw-zenoh-cpp 0.6.6 has invalid transport_optimization field
CONFIG_FILE="/opt/ros/kilted/share/rmw_zenoh_cpp/config/DEFAULT_RMW_ZENOH_SESSION_CONFIG.json5"
if grep -q "transport_optimization" "$CONFIG_FILE" 2>/dev/null; then
sed -i '/transport_optimization:/,/},$/d' "$CONFIG_FILE"
echo "Fixed rmw_zenoh_cpp config by removing invalid transport_optimization section"
fi
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.distro }}-interop
- name: Install cargo-nextest
uses: taiki-e/install-action@v2
with:
tool: cargo-nextest
- name: Run interop tests
shell: bash
run: |
source /opt/ros/${{ matrix.distro }}/setup.bash
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
export RUST_LOG=hiroz=debug,zenoh=warn
FEATURES="${{ matrix.hiroz_feature }}"
if [ "$FEATURES" = "humble" ]; then
cargo nextest run -p hiroz-tests --profile interop \
--no-default-features --features ros-interop,humble
else
cargo nextest run -p hiroz-tests --profile interop \
--features "ros-interop,$FEATURES"
# dynamic_subscriber tests are all #[ignore]'d in CI (ros2 topic
# pub isn't graph-visible under CI's rmw_zenoh_cpp — see
# headless_test.rs). --no-tests=warn keeps that from failing the job.
cargo nextest run -p hiroz-union --profile interop \
--features ros-interop \
-E 'test(dynamic_subscriber)' \
--no-tests=warn
fi
- uses: actions/setup-go@v5
with:
go-version: '1.23'
cache: false
- name: Build Rust FFI library + example binaries
run: |
FEATURES="ffi,${{ matrix.hiroz_feature }},rmw-zenoh"
cargo build --release --no-default-features --features "$FEATURES" \
--lib --example z_pubsub --example z_srvcli --example zenoh_router
- name: Generate Go message types (bundled IDL)
run: |
mkdir -p _tmp crates/hiroz-go/generated
cargo run -p hiroz-codegen --bin export_json -- \
--assets crates/hiroz-codegen/assets/jazzy \
--output _tmp/go-manifest.json \
--packages builtin_interfaces,service_msgs,action_msgs,unique_identifier_msgs,std_msgs,example_interfaces
cd crates/hiroz-codegen-go && go run . \
-input ../../_tmp/go-manifest.json \
-output ../hiroz-go/generated \
-prefix github.com/ZettaScaleLabs/hiroz/crates/hiroz-go
- name: Go vet (static analysis)
run: nu scripts/test-go.nu --vet-only
- name: Run Go integration tests (Go↔Go + Go↔Rust + Go↔ROS2)
shell: bash
run: |
source /opt/ros/${{ matrix.distro }}/setup.bash
export RMW_IMPLEMENTATION=rmw_zenoh_cpp
nu scripts/test-go.nu --integration