-
Notifications
You must be signed in to change notification settings - Fork 38
183 lines (162 loc) · 6.38 KB
/
ros1.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
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
name: ROS1 Interface
on:
pull_request:
branches: [ main ]
env:
DOCKER_REGISTRY: ghcr.io
DOCKER_CI_IMAGE_NAME: ci_wavemap_ros1
USER_HOME: /home/ci
CATKIN_WS_PATH: /home/ci/catkin_ws
CCACHE_DIR: /home/ci/ccache
PRE_COMMIT_DIR: /home/ci/pre-commit
jobs:
workspace-container:
name: Build ROS1 container
runs-on: ubuntu-20.04
outputs:
image: ${{ steps.ref-names.outputs.ci_image }}
steps:
- name: Common variables
id: ref-names
run: |
echo "cache=${{ env.DOCKER_REGISTRY }}/ethz-asl/${{ env.DOCKER_CI_IMAGE_NAME }}:buildcache" >> $GITHUB_OUTPUT
echo "ci_image=${{ env.DOCKER_REGISTRY }}/ethz-asl/${{ env.DOCKER_CI_IMAGE_NAME }}:${{ github.sha }}" >> $GITHUB_OUTPUT
- name: Fetch the package's repository
uses: actions/checkout@v4
with:
path: ${{ github.repository }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to ${{ env.DOCKER_REGISTRY }} registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build the image
uses: docker/build-push-action@v6
with:
context: ${{ github.repository }}
file: ${{ github.repository }}/tooling/docker/ros1/full.Dockerfile
target: workspace
build-args: |
REPOSITORY_NAME=${{ github.repository }}
USER_HOME=${{ env.USER_HOME }}
CATKIN_WS_PATH=${{ env.CATKIN_WS_PATH }}
CCACHE_DIR=${{ env.CCACHE_DIR }}
load: true
cache-from: type=registry,ref=${{ steps.ref-names.outputs.cache }}
cache-to: type=registry,mode=max,ref=${{ steps.ref-names.outputs.cache }}
tags: ${{ steps.ref-names.outputs.ci_image }}
- name: Test the image
run: docker run --rm ${{ steps.ref-names.outputs.ci_image }}
- name: Push the image
uses: docker/build-push-action@v6
with:
context: ${{ github.repository }}
file: ${{ github.repository }}/tooling/docker/ros1/full.Dockerfile
target: workspace
build-args: |
REPOSITORY_NAME=${{ github.repository }}
USER_HOME=${{ env.USER_HOME }}
CATKIN_WS_PATH=${{ env.CATKIN_WS_PATH }}
CCACHE_DIR=${{ env.CCACHE_DIR }}
push: true
cache-from: type=registry,ref=${{ steps.ref-names.outputs.cache }}
tags: ${{ steps.ref-names.outputs.ci_image }}
build:
name: Build
needs: workspace-container
runs-on: ubuntu-20.04
container:
image: ${{ needs.workspace-container.outputs.image }}
steps:
- name: Fetch the package's repository
uses: actions/checkout@v4
# NOTE: Even though the repo is already present in the container, we
# also need to check it out at GitHub Actions' preferred location
# for private actions and problem matchers to work.
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ secrets.CCACHE_CACHE_VERSION }}|ubuntu-20.04-gcc-ros1
create-symlink: true
- name: Build all wavemap packages
working-directory: ${{ env.CATKIN_WS_PATH }}
shell: bash
run: |
echo "::add-matcher::./.github/problem-matchers/gcc.json"
catkin build wavemap_all --no-status --force-color
echo "::remove-matcher owner=problem-matcher-gcc::"
install:
name: Install
needs: [ workspace-container, build ]
runs-on: ubuntu-20.04
container:
image: ${{ needs.workspace-container.outputs.image }}
steps:
- name: Fetch the package's repository
uses: actions/checkout@v4
# NOTE: Even though the repo is already present in the container, we
# also need to check it out at GitHub Actions' preferred location
# for private actions and problem matchers to work.
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ secrets.CCACHE_CACHE_VERSION }}|ubuntu-20.04-gcc-ros1
create-symlink: true
- name: Enable catkin install mode
working-directory: ${{ env.CATKIN_WS_PATH }}
shell: bash
run: |
catkin config --install
catkin clean -bdi -y
- name: Build all wavemap packages
working-directory: ${{ env.CATKIN_WS_PATH }}
shell: bash
run: |
. /opt/ros/noetic/setup.sh
echo "::add-matcher::./.github/problem-matchers/gcc.json"
catkin build wavemap_all --no-status --force-color
echo "::remove-matcher owner=problem-matcher-gcc::"
test:
name: Test
needs: [ workspace-container, build ]
runs-on: ubuntu-20.04
container:
image: ${{ needs.workspace-container.outputs.image }}
steps:
- name: Fetch the package's repository
uses: actions/checkout@v4
# NOTE: Even though the repo is already present in the container, we
# also need to check it out at GitHub Actions' preferred location
# for private actions and problem matchers to work.
- name: Setup ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ secrets.CCACHE_CACHE_VERSION }}|ubuntu-20.04-gcc-ros1
create-symlink: true
- name: Build regular code
working-directory: ${{ env.CATKIN_WS_PATH }}
shell: bash
run: catkin build wavemap_all --no-status --force-color --cmake-args -DDCHECK_ALWAYS_ON=ON
- name: Build unit tests
working-directory: ${{ env.CATKIN_WS_PATH }}
shell: bash
run: |
echo "::add-matcher::./.github/problem-matchers/gcc.json"
catkin build wavemap_all --no-status --force-color --no-deps --cmake-args -DDCHECK_ALWAYS_ON=ON --catkin-make-args tests
echo "::remove-matcher owner=problem-matcher-gcc::"
- name: Run unit tests
working-directory: ${{ env.CATKIN_WS_PATH }}
shell: bash
run: |
all_tests_passed=1
source devel/setup.bash
for f in devel/lib/wavemap*/test_*
do $f --gtest_color=yes || all_tests_passed=0
done
if [ $all_tests_passed -ne 1 ]; then
echo "Not all tests passed!"
exit 1
fi