-
Notifications
You must be signed in to change notification settings - Fork 4
137 lines (133 loc) · 5.35 KB
/
generate-and-test.yml
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
name: Generate and test packages
# avoiding duplicate jobs on push with open pull_request: https://github.com/orgs/community/discussions/26940#discussioncomment-6656489
on: [push, pull_request]
jobs:
generate:
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork)
runs-on: ubuntu-latest
strategy:
matrix:
include:
- package_name: pkg_default
template: ros2_cpp_pkg
auto_shutdown: true
- package_name: pkg_component
template: ros2_cpp_pkg
is_component: true
auto_shutdown: true
- package_name: pkg_lifecycle
template: ros2_cpp_pkg
is_lifecycle: true
auto_shutdown: true
- package_name: pkg_service
template: ros2_cpp_pkg
has_service_server: true
auto_shutdown: true
- package_name: pkg_action
template: ros2_cpp_pkg
has_action_server: true
auto_shutdown: true
- package_name: pkg_timer
template: ros2_cpp_pkg
has_timer: true
auto_shutdown: true
- package_name: pkg_no_params
template: ros2_cpp_pkg
has_params: false
auto_shutdown: true
- package_name: pkg_no_launch_file
template: ros2_cpp_pkg
has_launch_file: false
auto_shutdown: true
- package_name: pkg_all
template: ros2_cpp_pkg
is_component: true
is_lifecycle: true
has_service_server: true
has_action_server: true
has_timer: true
auto_shutdown: true
- package_name: pkg_interfaces
template: ros2_interfaces_pkg
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Install dependencies
run: |
pip install "copier~=9.2.0" "jinja2-strcase~=0.0.2"
- name: Configure git to run copier
run: |
git config --global user.name "dummy"
git config --global user.email "[email protected]"
- name: Generate packages
run: |
copier copy --trust --defaults \
-d template=${{ matrix.template }} \
-d auto_shutdown=${{ matrix.auto_shutdown }} \
-d package_name=${{ matrix.package_name }} \
$( [ "${{ matrix.is_component }}" = "true" ] && echo "-d is_component=true" ) \
$( [ "${{ matrix.is_lifecycle }}" = "true" ] && echo "-d is_lifecycle=true" ) \
$( [ "${{ matrix.has_service_server }}" = "true" ] && echo "-d has_service_server=true" ) \
$( [ "${{ matrix.has_action_server }}" = "true" ] && echo "-d has_action_server=true" ) \
$( [ "${{ matrix.has_timer }}" = "true" ] && echo "-d has_timer=true" ) \
$( [ "${{ matrix.has_params }}" = "false" ] && echo "-d has_params=false" ) \
$( [ "${{ matrix.has_launch_file }}" = "false" ] && echo "-d has_launch_file=false" ) \
. packages
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.package_name }}
path: packages/${{ matrix.package_name }}
build:
if: (github.event_name != 'pull_request' && ! github.event.pull_request.head.repo.fork) || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork)
runs-on: ubuntu-latest
container:
image: rwthika/ros2:jazzy
needs: generate
strategy:
matrix:
include:
- package: pkg_default
command: ros2 launch pkg_default pkg_default_launch.py
- package: pkg_component
command: ros2 launch pkg_component pkg_component_launch.py
- package: pkg_lifecycle
command: ros2 launch pkg_lifecycle pkg_lifecycle_launch.py
- package: pkg_service
command: ros2 launch pkg_service pkg_service_launch.py
- package: pkg_action
command: ros2 launch pkg_action pkg_action_launch.py
- package: pkg_timer
command: ros2 launch pkg_timer pkg_timer_launch.py
- package: pkg_no_params
command: ros2 launch pkg_no_params pkg_no_params_launch.py
- package: pkg_no_launch_file
command: ros2 run pkg_no_launch_file pkg_no_launch_file --ros-args -p param:=1.0
- package: pkg_all
command: ros2 launch pkg_all pkg_all_launch.py
- package: pkg_interfaces
command: |
ros2 interface show pkg_interfaces/msg/Message && \
ros2 interface show pkg_interfaces/srv/Service && \
ros2 interface show pkg_interfaces/action/Action
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.package }}
- name: Build
shell: bash
run: |
source /opt/ros/$ROS_DISTRO/setup.bash
colcon build --packages-up-to ${{ matrix.package }}
- name: Run
shell: bash
run: |
source install/setup.bash
${{ matrix.command }}