-
Notifications
You must be signed in to change notification settings - Fork 31
138 lines (122 loc) · 4.17 KB
/
test.yml
File metadata and controls
138 lines (122 loc) · 4.17 KB
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
name: Test
on:
pull_request:
paths-ignore:
- conanfile.py
- '**.md'
workflow_dispatch:
inputs:
no-tidy:
type: boolean
description: set to true to build without clang-tidy (2x faster)
jobs:
test_ubuntu:
if: github.repository_owner == 'viamrobotics'
runs-on: ubuntu-latest
container:
image: debian:bookworm
strategy:
fail-fast: false
matrix:
include:
- BUILD_SHARED: ON
- BUILD_SHARED: OFF
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
apt-get update
apt-get -y dist-upgrade
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install \
build-essential \
ca-certificates \
cmake \
curl \
doxygen \
g++ \
gettext \
gdb \
git \
gnupg \
gpg \
less \
libboost-all-dev \
libc-ares-dev \
libgrpc++-dev \
libprotobuf-dev \
libre2-dev \
libssl-dev \
lsof \
ninja-build \
pkg-config \
protobuf-compiler-grpc \
software-properties-common \
sudo \
wget \
zlib1g-dev
bash -c 'wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|apt-key add -'
apt-add-repository -y 'deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main'
apt-add-repository -y 'deb http://apt.llvm.org/bookworm/ llvm-toolchain-bookworm-15 main'
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get -y --no-install-recommends install -t llvm-toolchain-bookworm-15 \
clang-15 \
clang-tidy-15 \
clang-format
- name: Build viam server
run: |
curl https://storage.googleapis.com/packages.viam.com/apps/viam-server/viam-server-latest-x86_64 -o viam-server
chmod 755 viam-server
mv viam-server /usr/local/bin
- name: cmake
run: |
mkdir build
cd build
cmake .. -G Ninja \
-DBUILD_SHARED_LIBS=${{ matrix.BUILD_SHARED }} \
-DVIAMCPPSDK_OFFLINE_PROTO_GENERATION=ON \
-DVIAMCPPSDK_BUILD_TESTS=ON \
-DVIAMCPPSDK_BUILD_EXAMPLES=ON \
-DVIAMCPPSDK_CLANG_TIDY=${{ inputs.no-tidy && 'OFF' || 'ON' }} \
-DVIAMCPPSDK_SANITIZED_BUILD=${{ matrix.BUILD_SHARED }}
- name: build
run: |
cmake --build build --target install
cmake --install build
- name: Module test
run: etc/module_test/entrypoint.sh
- name: test
working-directory: build
run: ../etc/docker/tests/run_test.sh
test_windows:
if: github.repository_owner == 'viamrobotics'
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-windows
platform: windows_x86_64
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
ref: ${{ needs.prepare.outputs.sha }}
- name: Install dependencies
run: choco install -y conan git
- name: Build SDK
shell: powershell
run: |
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1
refreshenv
conan profile detect
conan install . --build=missing -o "&:shared=False"
cmake . --preset conan-default -DVIAMCPPSDK_BUILD_EXAMPLES=ON
cmake --build --preset=conan-release --target ALL_BUILD install -j 8
env:
CONAN_USER_HOME: c:/cache
CONAN_USER_HOME_SHORT: c:/cache/conan_shortpaths
- name: Test examples
shell: powershell
run: |
Start-Job -Init ([ScriptBlock]::Create("Set-Location '$pwd/build/install/bin'")) -ScriptBlock { .\simple_module.exe asdf 2>&1 > output.txt} | Wait-Job -Timeout 2 | Receive-Job
if (-not $(Select-String -Pattern "Module listening" -Path ./build/install/bin/output.txt)) { throw "Module did not start listening" }