forked from viam-modules/viam-cartographer
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (88 loc) · 2.98 KB
/
test.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
name: Test
on:
workflow_dispatch:
workflow_call:
jobs:
build_and_test:
name: Build and Test Cartographer
strategy:
matrix:
include:
- arch: [x64, qemu-host]
image: ghcr.io/viamrobotics/canon:amd64-cache
platform: linux/amd64
- arch: [arm64, qemu-host]
image: ghcr.io/viamrobotics/canon:arm64-cache
platform: linux/arm64
runs-on: ${{ matrix.arch }}
container:
image: ${{ matrix.image }}
options: --platform ${{ matrix.platform }}
timeout-minutes: 30
steps:
# Now that viam-cartographer is public, can't directly comment without token having full read/write access
# appimage-comment.yml will trigger separately and post the actual comments
- name: Set PR Number variable
run: |
echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> pr.env
- name: Set appimage variable
if: contains(github.event.pull_request.labels.*.name, 'appimage') || contains(github.event.pull_request.labels.*.name, 'appimage-ignore-tests')
run: |
echo "APPIMAGE=true" >> pr.env
- name: Upload PR variables
uses: actions/upload-artifact@v3
with:
name: pr-variables
path: |
pr.env
retention-days: 1
- name: Check out main branch code
if: github.event_name != 'pull_request_target'
uses: actions/checkout@v3
with:
submodules: recursive
- name: Check out PR branch code
if: github.event_name == 'pull_request_target'
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
submodules: recursive
- name: Verify no uncommitted changes from make lint
run: |
git init
git add .
chown -R testbot:testbot .
sudo -u testbot bash -lc 'make lint-setup lint'
GEN_DIFF=$(git status -s)
if [ -n "$GEN_DIFF" ]; then
echo '"make lint" resulted in changes not in git' 1>&2
git status
exit 1
fi
- name: make bufinstall buf setup
uses: nick-fields/retry@v2
with:
timeout_minutes: 5
max_attempts: 3
retry_on: timeout
shell: bash
command: |
chown -R testbot:testbot .
sudo -u testbot bash -lc 'make bufinstall buf setup'
- name: make build
run: |
sudo -u testbot bash -lc 'make build'
- name: make install-lua-files
run: |
sudo -u testbot bash -lc 'make install-lua-files'
- name: make test
run: |
sudo -u testbot bash -lc 'make test'
- name: Copy carto_grpc_server binary
if: matrix.platform == 'linux/amd64'
run: |
sudo cp viam-cartographer/build/carto_grpc_server /usr/local/bin/carto_grpc_server
- name: Run viam-cartographer cartographer integration tests
if: matrix.platform == 'linux/amd64'
run: |
sudo -u testbot bash -lc 'sudo go test -v -race -run TestCartographerIntegration'