-
Notifications
You must be signed in to change notification settings - Fork 7
164 lines (139 loc) · 5.73 KB
/
ci.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
# the "if" flag with event.json is for running the workflow locally with `act`.
name: CI
on:
push:
pull_request:
branches:
- ros2
- master
schedule: # Trigger a job on master at midnight UTC every day
- cron: '0 0 * * *'
env:
PACKAGES_TO_TEST: # This limits the packages that are checked in CI. This is to avoid testing upstream packages passed in via .repos files.
uwrt_mars_rover
uwrt_mars_rover_drivetrain
uwrt_mars_rover_drivetrain_description
uwrt_mars_rover_drivetrain_hw
ROS_DISTRO: galactic
IMAGE: "rostooling/setup-ros-docker:ubuntu-focal-ros-galactic-desktop-latest"
jobs:
prepare-actions-environment:
if: ${{ !github.event.act }}
# workaround to use variable for IMAGE. Based off of: https://github.community/t/how-to-use-env-with-container-image/17252/25
runs-on: ubuntu-latest
outputs:
image: ${{ steps.export_variable.outputs.image }}
steps:
- id: export_variable
run: echo "::set-output name=image::${{ env.IMAGE }}"
linters:
if: ${{ !github.event.act }}
name: ament-${{ matrix.linter }}
needs: prepare-actions-environment
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-actions-environment.outputs.image }}
options: -u root
strategy:
fail-fast: false # We want all the linters to run even if one fails
matrix:
linter: [ cppcheck, xmllint ]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: ROS2 Linter - [ament-${{ matrix.linter }}]
uses: ros-tooling/action-ros-lint@master
with:
distribution: ${{ env.ROS_DISTRO }}
linter: ${{ matrix.linter }}
package-name: ${{ env.PACKAGES_TO_TEST }}
linters-clang-format:
if: ${{ !github.event.act }}
name: ament-clang-format
needs: prepare-actions-environment
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-actions-environment.outputs.image }}
options: -u root
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: ROS2 Linter - [ament-clang-format]
uses: ros-tooling/action-ros-lint@master
with:
distribution: ${{ env.ROS_DISTRO }}
linter: clang-format
arguments: "--config .clang-format"
package-name: ${{ env.PACKAGES_TO_TEST }}
linters-flake8:
if: ${{ !github.event.act }}
name: ament-flake8
needs: prepare-actions-environment
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-actions-environment.outputs.image }}
options: -u root
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: ROS2 Linter - [ament-flake8]
uses: ros-tooling/action-ros-lint@master
with:
distribution: ${{ env.ROS_DISTRO }}
linter: flake8
arguments: "--config .flake8"
package-name: ${{ env.PACKAGES_TO_TEST }}
linux-amd64-build-and-test:
needs: prepare-actions-environment
runs-on: ubuntu-latest
container:
image: ${{ needs.prepare-actions-environment.outputs.image }}
steps:
- name: Build ROS2 Packages and Run Tests
uses: ros-tooling/action-ros-ci@v0.2
with:
colcon-defaults: |
{
"build": {
"mixin": ["asan-gcc"]
}
}
colcon-mixin-repository: https://raw.githubusercontent.com/colcon/colcon-mixin-repository/3e627e0fa30db85aea05a50e2c61a9832664d236/index.yaml
target-ros2-distro: ${{ env.ROS_DISTRO }}
vcs-repo-file-url: |
https://raw.githubusercontent.com/${{ github.repository }}/${{ github.sha }}/common_upstream_dependencies.repos
package-name: ${{ env.PACKAGES_TO_TEST }}
linux-arm64-build-and-test:
runs-on: ubuntu-latest
# Cannot use action-ros-ci since cant trigger action steps from within the docker container. Must use `docker exec`
# to run actions within docker container since we cannot directly use arm64v8/ros:${{ env.ROS_DISTRO }} container because there
# exists no way of setting up Docker to work with Qemu before loading a docker image onto the Github Action runner.
# Possibly resolveable with https://github.com/actions/runner/issues/320
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Install Docker/QEMU dependencies
id: qemu
uses: docker/setup-qemu-action@v2
with:
image: tonistiigi/binfmt:latest
platforms: arm64
- name: Setup Docker to Run ARM64 Containers in QEMU
run: |
docker run --privileged --rm multiarch/qemu-user-static --reset --credential yes --persistent yes
- name: Start ARM64 ROS2 Container
run: |
docker run --name arm64-ros --mount type=bind,source=$(pwd),target=/rosws/src/$(basename $(pwd)) --workdir /rosws --detach -i --rm arm64v8/ros:${{ env.ROS_DISTRO }}
- name: Download ROS Source Dependencies
run: |
docker exec --workdir /rosws/src arm64-ros vcs import --input uwrt_mars_rover/common_upstream_dependencies.repos
# TODO: add linux_arm64_upstream_dependencies.repos
- name: Install ROS Binary Package Dependencies
run: |
docker exec arm64-ros sudo apt update
docker exec arm64-ros rosdep install -r --from-paths . --ignore-src --rosdistro ${{ env.ROS_DISTRO }} -y
- name: Build ROS2 Packages and Run Tests
run: >
docker exec arm64-ros bash -c "source /opt/ros/${{ env.ROS_DISTRO }}/setup.bash &&
colcon build --event-handlers console_cohesion+ &&
colcon test --packages-select ${{ env.PACKAGES_TO_TEST }} --return-code-on-test-failure --event-handlers console_cohesion+"