Skip to content

Commit fef36dc

Browse files
committed
Add GitHub build and test actions
1 parent 74392a0 commit fef36dc

3 files changed

Lines changed: 188 additions & 2 deletions

File tree

.github/workflows/jazzy-build.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Jazzy Build
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: jazzy-build-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-24.04
18+
container:
19+
image: ubuntu:noble
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
env:
26+
ROS_DISTRO: jazzy
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Set up ROS 2 Jazzy
33+
uses: ros-tooling/setup-ros@v0.7
34+
with:
35+
required-ros-distributions: ${{ env.ROS_DISTRO }}
36+
37+
- name: Install package dependencies
38+
run: |
39+
rosdep update
40+
rosdep install \
41+
--from-paths . frontier_exploration_ros2_rviz \
42+
--ignore-src \
43+
--rosdistro "$ROS_DISTRO" \
44+
-r \
45+
-y
46+
47+
- name: Build core package
48+
run: |
49+
source /opt/ros/$ROS_DISTRO/setup.bash
50+
colcon build \
51+
--event-handlers console_direct+ \
52+
--build-base build-core \
53+
--install-base install \
54+
--packages-select frontier_exploration_ros2 \
55+
--cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
56+
57+
- name: Build RViz plugin package
58+
run: |
59+
source /opt/ros/$ROS_DISTRO/setup.bash
60+
source install/setup.bash
61+
colcon build \
62+
--event-handlers console_direct+ \
63+
--base-paths . frontier_exploration_ros2_rviz \
64+
--build-base build-all \
65+
--install-base install \
66+
--packages-select frontier_exploration_ros2_rviz \
67+
--cmake-args \
68+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
69+
-DPython3_EXECUTABLE=/usr/bin/python3

.github/workflows/jazzy-test.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Jazzy Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: jazzy-tests-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
test:
17+
runs-on: ubuntu-24.04
18+
container:
19+
image: ubuntu:noble
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
env:
26+
ROS_DISTRO: jazzy
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Set up ROS 2 Jazzy
33+
uses: ros-tooling/setup-ros@v0.7
34+
with:
35+
required-ros-distributions: ${{ env.ROS_DISTRO }}
36+
37+
- name: Install package dependencies
38+
run: |
39+
rosdep update
40+
rosdep install \
41+
--from-paths . frontier_exploration_ros2_rviz \
42+
--ignore-src \
43+
--rosdistro "$ROS_DISTRO" \
44+
-r \
45+
-y
46+
47+
- name: Build packages for testing
48+
run: |
49+
source /opt/ros/$ROS_DISTRO/setup.bash
50+
colcon build \
51+
--event-handlers console_direct+ \
52+
--build-base build-core \
53+
--install-base install \
54+
--test-result-base test-results \
55+
--packages-select frontier_exploration_ros2 \
56+
--cmake-args -DCMAKE_BUILD_TYPE=RelWithDebInfo
57+
58+
source install/setup.bash
59+
colcon build \
60+
--event-handlers console_direct+ \
61+
--base-paths . frontier_exploration_ros2_rviz \
62+
--build-base build-all \
63+
--install-base install \
64+
--test-result-base test-results \
65+
--packages-select frontier_exploration_ros2_rviz \
66+
--cmake-args \
67+
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
68+
-DPython3_EXECUTABLE=/usr/bin/python3
69+
70+
- name: Run tests
71+
run: |
72+
source /opt/ros/$ROS_DISTRO/setup.bash
73+
source install/setup.bash
74+
75+
core_status=0
76+
rviz_status=0
77+
results_status=0
78+
79+
colcon test \
80+
--event-handlers console_direct+ \
81+
--return-code-on-test-failure \
82+
--build-base build-core \
83+
--install-base install \
84+
--test-result-base test-results \
85+
--packages-select frontier_exploration_ros2 || core_status=$?
86+
87+
colcon test \
88+
--event-handlers console_direct+ \
89+
--return-code-on-test-failure \
90+
--base-paths . frontier_exploration_ros2_rviz \
91+
--build-base build-all \
92+
--install-base install \
93+
--test-result-base test-results \
94+
--packages-select frontier_exploration_ros2_rviz || rviz_status=$?
95+
96+
colcon test-result \
97+
--test-result-base test-results \
98+
--verbose || results_status=$?
99+
100+
if (( core_status != 0 || rviz_status != 0 || results_status != 0 )); then
101+
exit 1
102+
fi
103+
104+
- name: Upload test results
105+
if: always()
106+
uses: actions/upload-artifact@v4
107+
with:
108+
name: jazzy-test-results
109+
path: |
110+
test-results
111+
build-core/**/Testing/**/*.log
112+
build-all/**/Testing/**/*.log
113+
if-no-files-found: warn

test/test_preemption_flow.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,13 @@ TEST(PreemptionFlowTests, ReplacementDebounceTracksSelectedFrontierOnly)
205205
TEST(PreemptionFlowTests, BlockedGoalWithoutReplacementUsesExplicitCancel)
206206
{
207207
std::vector<std::string> info_logs;
208+
std::vector<std::string> debug_logs;
208209
auto core = make_preemption_core(&info_logs);
209210
auto fake_handle = std::make_shared<FakeGoalHandle>();
210211
core->goal_handle = fake_handle;
212+
core->callbacks.log_debug = [&debug_logs](const std::string & message) {
213+
debug_logs.push_back(message);
214+
};
211215

212216
auto blocked_costmap = build_grid(20, 20, 0);
213217
set_cell(blocked_costmap, 1, 1, 100);
@@ -230,8 +234,8 @@ TEST(PreemptionFlowTests, BlockedGoalWithoutReplacementUsesExplicitCancel)
230234
core->consider_preempt_active_goal("map");
231235

232236
EXPECT_EQ(fake_handle->cancel_calls, 1);
233-
ASSERT_FALSE(info_logs.empty());
234-
EXPECT_NE(info_logs.back().find("no replacement frontier is available"), std::string::npos);
237+
ASSERT_FALSE(debug_logs.empty());
238+
EXPECT_NE(debug_logs.back().find("no replacement frontier is available"), std::string::npos);
235239
}
236240

237241
TEST(PreemptionFlowTests, BlockedGoalReplacementLogsSkipVerb)

0 commit comments

Comments
 (0)