-
Notifications
You must be signed in to change notification settings - Fork 91
91 lines (83 loc) · 2.81 KB
/
test.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
# This file is automatically deployed from https://github.com/at-wat/.rospkg-assets.
# Please don't directly edit; update at-wat/.rospkg-assets instead.
name: build
on:
pull_request:
branches:
- master
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
env:
- ROS_DISTRO=noetic
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache test data
uses: actions/cache@v3
with:
path: .cached-dataset
key: dataset-${{ hashFiles('test/CMakeLists.txt') }}
restore-keys: dataset-
- name: Cache docker layers
uses: actions/cache@v3
with:
path: /home/runner/layers.tar
key: docker-layers-${{ matrix.env }}-${{ github.sha }}
restore-keys: docker-layers-${{ matrix.env }}-
- name: Set env
run: echo "${{ matrix.env }}" | tee ${GITHUB_ENV}
- name: Get dataset
run: if [ -x .github/get_dataset.sh ]; then .github/get_dataset.sh; fi
- name: Load docker layer cache
run: if [ -f /home/runner/layers.tar ]; then docker load -i /home/runner/layers.tar; fi
- name: Install gh-pr-comment
uses: at-wat/setup-gh-pr-comment@v0
- name: Copy gh-pr-comment for container
run: cp $(which gh-pr-comment) .github/
- name: Test
run: |
eval export $(cat .github/test.conf)
echo "ROS_DISTRO=${ROS_DISTRO}" >> ${GITHUB_ENV}
BUILD_LINK="[${GITHUB_RUN_NUMBER}]"
touch .rosinstall .rosinstall-isolated
echo '::group::docker build'
docker build \
-t tester \
-f .github/Dockerfile \
--build-arg ROS_DISTRO \
--pull=true . \
|| (gh-pr-comment "${BUILD_LINK} FAILED on ${ROS_DISTRO}" "docker build failed"; false)
echo '::endgroup::'
mkdir -p /tmp/log
docker run --rm \
-e BUILD_LINK=${BUILD_LINK} \
$(gh-pr-comment-env.sh) \
-e GITHUB_ACTIONS \
-e CATKIN_MAKE_OPTIONS \
-v ${GITHUB_WORKSPACE}:/orig-src \
-v /tmp/log:/root/.ros/log \
tester \
/catkin_ws/src/self/.github/test.sh
- name: Compress logs
if: always()
run: cd /tmp; tar -cJf logs.tar.xz log
- name: Upload ROS logs
if: always()
uses: actions/upload-artifact@v3
with:
name: logs-${{ env.ROS_DISTRO }}.tar.xz
path: /tmp/logs.tar.xz
retention-days: 1
- uses: codecov/codecov-action@v3
- name: Save layer cache
run: |
LAYERS=$(docker history -q tester | grep -v missing)
echo "layers: $(echo ${LAYERS})"
docker save -o /home/runner/layers.tar ${LAYERS}