-
Notifications
You must be signed in to change notification settings - Fork 5
129 lines (114 loc) · 4.45 KB
/
ci.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
name: CI
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
Shell:
runs-on: ubuntu-20.04
name: Setup Tools Tests
steps:
- uses: actions/checkout@v3
# ${{github.workspace}} is the root folder of the cloned repo
- run: |
${{github.workspace}}/misc/setup_tools.sh
CI:
runs-on: ubuntu-latest
strategy:
matrix:
ros_distro: [ noetic ]
steps:
- name: Prepare
# Keep the compilation outputs persistent outside the docker container to use for the other steps
run: |
mkdir -p ${{github.workspace}}/src # where the repo will be cloned into
mkdir -p ${{github.workspace}}/build # compilation cache for formatter & linter
mkdir -p ${{github.workspace}}/devel # compilation cache for formatter & linter
- name: Checkout
uses: actions/checkout@v3
with:
path: src/rotools
- name: Parse ROS Distro
run: |
echo "FLAVOR=$(echo ${{ github.event.pull_request.base.ref }} | sed 's/-devel//')" >> $GITHUB_ENV
- name: Build Docker Image
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: docker/build-push-action@v2
with:
tags: rotools:${{matrix.ros_distro}}
file: .ci/Dockerfile.${{matrix.ros_distro}}
push: false
- name: Compile with Catkin Tools
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: rotools:${{matrix.ros_distro}}
options: -v ${{github.workspace}}/src:/ros/src/ # only mount source here
run: |
catkin config --workspace /ros/ --init --extend /opt/ros/${{matrix.ros_distro}} --cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
catkin build --workspace /ros/ --interleave-output --verbose
- name: Compile with Catkin Make
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: rotools:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros
shell: bash
run: |
source /opt/ros/${{matrix.ros_distro}}/setup.bash
catkin_init_workspace /ros/src
cd /ros
catkin_make -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Run Python Tests
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: rotools:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros/
shell: bash
run: |
source /ros/devel/setup.bash
if [ $ROS_DISTRO == "noetic" ]; then \
pip install pytest; \
pip install -r /ros/src/rotools/requirements.txt; \
pytest /ros/src/rotools/src/rotools/tests/test_*.py; \
fi
- name: Check C++ Format
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: rotools:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros/
shell: bash
run: |
source /ros/devel/setup.bash
cmake --build /ros/build --target check-format
- name: Check Python Format
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: rotools:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros/
shell: bash
run: |
source /ros/devel/setup.bash
cmake --build /ros/build --target check-pyformat
- name: Check Linting
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: rotools:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros/
shell: bash
run: |
source /ros/devel/setup.bash
cmake --build /ros/build --target check-tidy
# - name: Upload Tests to Artifacts
# uses: actions/upload-artifact@v2
# if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
# with:
# name: test-results
# path: build/test_results/*/rosunit-*.xml