-
Notifications
You must be signed in to change notification settings - Fork 2
94 lines (82 loc) · 3.28 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
# 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 ]
jobs:
default:
strategy:
fail-fast: false
matrix:
distro: [ melodic, noetic ]
include:
- distro: noetic
env:
CLANG_TIDY: pedantic
env:
CXXFLAGS: "-Werror -Wall -Wextra -Wwrite-strings -Wunreachable-code -Wpointer-arith -Wredundant-decls"
ROS_DISTRO: ${{ matrix.distro }}
ROS_REPO: ${{ matrix.repo || 'ros' }}
CATKIN_LINT: true
CCACHE_DIR: ${{ github.workspace }}/.ccache
BASEDIR: /home/runner/work
DOCKER_COMMIT: rhaschke/ici:agni_tf_tools-${{ matrix.distro }}-${{ matrix.repo || 'ros' }}
CLANG_TIDY: ${{ matrix.env.CLANG_TIDY || 'false' }}
CLANG_TIDY_BASE_REF: ${{ github.base_ref || '' }}
name: "${{ matrix.distro }}${{ matrix.repo != 'ros' && format(' {0}', matrix.repo) || '' }}"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# 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_ws
uses: rhaschke/cache@main
with:
path: ${{ env.BASEDIR }}/target_ws
key: ${{ env.CACHE_PREFIX }}-${{ github.run_id }}
restore-keys: ${{ env.CACHE_PREFIX }}
env:
CACHE_PREFIX: target_ws-${{ matrix.distro }}-${{ matrix.builder }}-${{ hashFiles('**/CMakeLists.txt', '**/package.xml', '.github/workflows/ci.yaml') }}
GHA_CACHE_SAVE: always
- 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:
CACHE_PREFIX: ccache-${{ matrix.distro }}
GHA_CACHE_SAVE: always
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Fetch cached docker image
if: ${{ env.DOCKER_COMMIT && ! env.DOCKER_IMAGE }}
run: |
if docker pull ${{ env.DOCKER_COMMIT }} ; then
echo "DOCKER_IMAGE=$DOCKER_COMMIT" >> $GITHUB_ENV
fi
- name: industrial_ci
uses: ros-industrial/industrial_ci@master
- name: Upload docker image as cache
if: ${{ env.DOCKER_COMMIT }}
run: |
docker push ${{ env.DOCKER_COMMIT }} || true
- name: Upload test artifacts (on failure)
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-results-${{ matrix.distro }}
path: ${{ env.BASEDIR }}/target_ws/**/test_results/**/*.xml
- name: Prepare target_ws for cache
if: ${{ always() && ! matrix.env.CCOV }}
run: |
sudo find ${{ env.BASEDIR }}/target_ws -wholename '*/test_results/*' -delete
sudo rm -rf ${{ env.BASEDIR }}/target_ws/src