-
Notifications
You must be signed in to change notification settings - Fork 311
118 lines (105 loc) · 4.05 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
name: CI
on:
push:
branches:
- develop
pull_request:
branches:
- melodic-devel
- noetic-devel
- develop
jobs:
CI:
runs-on: ubuntu-latest
strategy:
matrix:
ros_distro: [ melodic, noetic ]
steps:
- name: Prepare
# Keep the compilation outputs persitant 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/franka_ros
- 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: franka_ros:${{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: franka_ros:${{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: franka_ros:${{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: Check C++ Format
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: franka_ros:${{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: franka_ros:${{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: franka_ros:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros/
shell: bash
run: |
source /ros/devel/setup.bash
cmake --build /ros/build --target check-tidy
- name: Run Tests
if: github.ref == 'refs/heads/develop' || ${{env.FLAVOR == matrix.ros_distro}}
uses: addnab/docker-run-action@v3
with:
image: franka_ros:${{matrix.ros_distro}}
options: -v ${{github.workspace}}:/ros/
shell: bash
run: |
source /ros/devel/setup.bash
cd /ros
catkin_make run_tests -j1 # gazebo tests cannot run in parallel
catkin_test_results
- 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