forked from moveit/moveit
-
Notifications
You must be signed in to change notification settings - Fork 0
187 lines (178 loc) · 8.47 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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
# This config uses industrial_ci (https://github.com/ros-industrial/industrial_ci.git).
# For troubleshooting, see readme (https://github.com/ros-industrial/industrial_ci/blob/master/README.rst)
name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
permissions:
contents: read # to fetch code (actions/checkout)
concurrency: # cancel any previous workflow(s) from the same PR or branch/tag
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
default:
strategy:
fail-fast: false
matrix:
env:
- IMAGE: noetic-ci
CCOV: true
BUILDER: catkin_tools_devel
- IMAGE: noetic-ci-testing
IKFAST_TEST: true
CATKIN_LINT: true
CLANG_TIDY: pedantic
- IMAGE: master-ci # ROS Melodic with all dependencies required for master
CATKIN_LINT: true
env:
CXXFLAGS: -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls
CLANG_TIDY_ARGS: --fix --fix-errors --format-style=file
DOCKER_IMAGE: moveit/moveit:${{ matrix.env.IMAGE }}
UPSTREAM_WORKSPACE: .github/workflows/upstream.rosinstall
TARGET_WORKSPACE: $TARGET_REPO_PATH github:ros-planning/moveit_resources#master
DOWNSTREAM_WORKSPACE: .github/workflows/downstream.rosinstall
# Pull any updates to the upstream workspace (after restoring it from cache)
AFTER_SETUP_UPSTREAM_WORKSPACE: vcs pull $BASEDIR/upstream_ws/src
AFTER_SETUP_DOWNSTREAM_WORKSPACE: vcs pull $BASEDIR/downstream_ws/src
# Clear the ccache stats before and log the stats after the build
AFTER_SETUP_CCACHE: ccache --zero-stats --max-size=10.0G
AFTER_BUILD_TARGET_WORKSPACE: ccache --show-stats
AFTER_BUILD_DOWNSTREAM_WORKSPACE: ccache --show-stats
# Compile CCOV with Debug. Enable -Werror.
TARGET_CMAKE_ARGS: >
-DCMAKE_BUILD_TYPE=${{ matrix.env.CCOV && 'Debug' || 'Release'}}
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS${{ matrix.env.CCOV && ' --coverage -O2 -fno-omit-frame-pointer'}}"
UPSTREAM_CMAKE_ARGS: "-DCMAKE_CXX_FLAGS=''"
DOWNSTREAM_CMAKE_ARGS: -DCMAKE_CXX_FLAGS="-Wall -Wextra"
CCACHE_DIR: ${{ github.workspace }}/.ccache
BASEDIR: ${{ github.workspace }}/.work
CLANG_TIDY_BASE_REF: ${{ github.event_name != 'workflow_dispatch' && (github.base_ref || github.ref) || '' }}
BEFORE_CLANG_TIDY_CHECKS: |
# Show list of applied checks
(cd $TARGET_REPO_PATH; clang-tidy --list-checks)
# Disable clang-tidy for ikfast plugins as we cannot fix the generated code
find $BASEDIR/target_ws/build -iwholename "*_ikfast_plugin/compile_commands.json" -exec rm {} \;
BUILDER: ${{ matrix.env.BUILDER || 'catkin_tools' }}
CC: ${{ matrix.env.CLANG_TIDY && 'clang' }}
CXX: ${{ matrix.env.CLANG_TIDY && 'clang++' }}
name: "${{ matrix.env.IMAGE }}${{ matrix.env.CATKIN_LINT && ' + catkin_lint' || ''}}${{ matrix.env.CCOV && ' + ccov' || ''}}${{ matrix.env.IKFAST_TEST && ' + ikfast' || ''}}${{ matrix.env.CLANG_TIDY && (github.event_name != 'workflow_dispatch' && ' + clang-tidy (delta)' || ' + clang-tidy (all)') || '' }}"
runs-on: ubuntu-20.04
steps:
- name: "Free up disk space"
if: matrix.env.CCOV
run: |
sudo apt-get -qq purge build-essential "ghc*"
sudo apt-get clean
# cleanup docker images not used by us
docker system prune -af
# shift ccache folder to /mnt on a separate disk
sudo mkdir /mnt/ccache
mkdir ${{ env.CCACHE_DIR }}
sudo mount --bind ${{ env.CCACHE_DIR }} /mnt/ccache
# free up a lot of stuff from /usr/local
sudo rm -rf /usr/local
df -h
- uses: actions/checkout@v3
- name: Cache upstream workspace
uses: rhaschke/cache@main
with:
path: ${{ env.BASEDIR }}/upstream_ws
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }}
restore-keys: ${{ env.CACHE_PREFIX }}
env:
GHA_CACHE_SAVE: always
CACHE_PREFIX: upstream_ws-${{ matrix.env.IMAGE }}-${{ hashFiles('.github/workflows/upstream.rosinstall', '.github/workflows/ci.yaml') }}
- name: Cache downstream workspace
uses: rhaschke/cache@main
with:
path: ${{ env.BASEDIR }}/downstream_ws
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }}
restore-keys: ${{ env.CACHE_PREFIX }}
env:
GHA_CACHE_SAVE: always
CACHE_PREFIX: downstream_ws-${{ matrix.env.IMAGE }}-${{ hashFiles('.github/workflows/downstream.rosinstall', '.github/workflows/ci.yaml') }}
# The target directory cache doesn't include the source directory because
# that comes from the checkout. See "prepare target_ws for cache" task below
- name: Cache target workspace
if: "!matrix.env.CCOV"
uses: rhaschke/cache@main
with:
path: ${{ env.BASEDIR }}/target_ws
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }}
restore-keys: ${{ env.CACHE_PREFIX }}
env:
GHA_CACHE_SAVE: always
CACHE_PREFIX: target_ws${{ matrix.env.CCOV && '-ccov' || '' }}-${{ matrix.env.IMAGE }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml', '.github/workflows/ci.yaml') }}
- name: Cache ccache
uses: rhaschke/cache@main
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ env.CACHE_PREFIX }}-${{ github.sha }}-${{ github.run_id }}
restore-keys: |
${{ env.CACHE_PREFIX }}-${{ github.sha }}
${{ env.CACHE_PREFIX }}
env:
GHA_CACHE_SAVE: always
CACHE_PREFIX: ccache-${{ matrix.env.IMAGE }}${{ matrix.env.CCOV && '-ccov' || '' }}
- name: Generate ikfast packages
if: matrix.env.IKFAST_TEST
run: moveit_kinematics/test/test_ikfast_plugins.sh
env:
ROS_DISTRO: noetic
- id: ici
name: Run industrial_ci
uses: ros-industrial/industrial_ci@master
env: ${{ matrix.env }}
- name: Upload test artifacts (on failure)
uses: actions/upload-artifact@v3
if: failure() && (steps.ici.outputs.run_target_test || steps.ici.outputs.target_test_results)
with:
name: test-results-${{ matrix.env.IMAGE }}
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml
- name: Generate codecov report
uses: rhaschke/lcov-action@main
if: always() && matrix.env.CCOV && steps.ici.outputs.target_test_results == '0'
with:
docker: $DOCKER_IMAGE
workdir: ${{ env.BASEDIR }}/target_ws
ignore: '"*/target_ws/build/*" "*/target_ws/install/*" "*/test/*"'
- name: Upload codecov report
uses: codecov/codecov-action@v4
if: always() && matrix.env.CCOV && steps.ici.outputs.target_test_results == '0'
with:
files: ${{ env.BASEDIR }}/target_ws/coverage.info
- name: Upload clang-tidy changes
uses: rhaschke/upload-git-patch-action@main
if: always() && matrix.env.CLANG_TIDY
with:
name: clang-tidy
path: ${{ env.BASEDIR }}/target_ws/src/$(basename $(pwd))
- name: Prepare target_ws for cache
if: always() && !matrix.env.CCOV
run: |
du -sh ${{ env.BASEDIR }}/target_ws
sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete
sudo rm -rf ${{ env.BASEDIR }}/target_ws/src ${{ env.BASEDIR }}/target_ws/logs
du -sh ${{ env.BASEDIR }}/target_ws
# Sync noetic-devel branch with master on successful build
sync-noetic-devel:
runs-on: ubuntu-latest
needs: default # only trigger on success of default build job
if: github.event_name == 'push' && github.repository_owner == 'ros-planning' && github.ref == 'refs/heads/master'
permissions:
contents: write # allow pushing
steps:
- uses: actions/checkout@v3
- name: Fast-forward noetic-devel to sync with master
run: |
# Configure push user+url
git config --global user.name 'GHA sync bot'
git config --global user.email '[email protected]'
git remote set-url origin https://x-access-token:${{ secrets.GH_PAGES_TOKEN }}@github.com/${{ github.repository }}
# Extend shallow copy from actions/checkout to connect noetic-devel..master
git fetch --depth=1 origin noetic-devel
git fetch --depth=200 origin master
git push origin master:noetic-devel