-
Notifications
You must be signed in to change notification settings - Fork 38
238 lines (206 loc) · 7.4 KB
/
tracker-service.yaml
File metadata and controls
238 lines (206 loc) · 7.4 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
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
---
# SPDX-FileCopyrightText: (C) 2026 Intel Corporation
# SPDX-License-Identifier: Apache-2.0
name: "[CI] Tracker Service"
run-name: "[CI] Tracker Service"
on: # yamllint disable-line rule:truthy
pull_request:
branches:
- main
- release-*
- tracker-service-*
push:
branches:
- main
workflow_dispatch: {}
concurrency:
group: tracker-service-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
detect-changes:
name: "Detect Tracker Changes"
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
run-jobs: ${{ steps.changes.outputs.tracker }}
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0 # Fetch all history for accurate diff
- name: "Detect tracker changes"
id: changes
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
filters: |
tracker:
- 'tracker/**'
- '.github/workflows/tracker-service.yaml'
lint-cpp-code:
name: "Lint C++ code"
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run-jobs == 'true' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install clang-format"
run: |
sudo apt-get update
sudo apt-get install -y clang-format
- name: "Check C++ formatting"
run: make -C tracker lint-cpp
lint-dockerfile:
name: "Lint Dockerfile"
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run-jobs == 'true' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install hadolint"
run: |
wget -qO /usr/local/bin/hadolint https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-Linux-x86_64
chmod +x /usr/local/bin/hadolint
- name: "Lint Dockerfile"
run: make -C tracker lint-dockerfile
lint-python:
name: "Lint Python code"
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run-jobs == 'true' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install autopep8"
run: pip install autopep8
- name: "Lint Python files"
run: make -C tracker lint-python
trivy-scan:
name: "Trivy security scan (optional)"
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run-jobs == 'true' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install Trivy"
run: |
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | sudo apt-key add -
echo "deb https://aquasecurity.github.io/trivy-repo/deb $(lsb_release -sc) main" | sudo tee -a /etc/apt/sources.list.d/trivy.list
sudo apt-get update
sudo apt-get install -y trivy
- name: "Run Trivy scan"
continue-on-error: true
run: make -C tracker lint-trivy
native-build-and-test:
name: "Native build and unit tests"
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run-jobs == 'true' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Install build tools"
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential \
cmake \
ninja-build \
pkg-config \
libopencv-dev \
libeigen3-dev \
libopenblas-dev \
lcov
pip install conan gcovr
- name: "Configure Conan"
run: |
conan profile detect --force
- name: "Cache Conan packages"
uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
with:
path: ~/.conan2
key: conan-${{ runner.os }}-${{ hashFiles('tracker/conanfile.txt') }}
restore-keys: |
conan-${{ runner.os }}-
- name: "Build release"
run: make -C tracker build
- name: "Build debug with tests"
run: make -C tracker build-debug
- name: "Run unit tests with coverage"
run: make -C tracker test-unit-coverage
- name: "Upload coverage reports"
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: coverage-reports
path: |
tracker/build-debug/coverage/coverage.xml
tracker/build-debug/coverage/html/
retention-days: 30
- name: "Display coverage summary"
if: always()
run: |
{
echo "## 📊 Coverage Summary"
echo ""
echo "Coverage reports have been generated and uploaded as artifacts."
echo ""
gcovr tracker/build-debug \
--root tracker \
--exclude '.*test.*' \
--exclude '.*/build-debug/.*' \
--exclude '.*/usr/.*' \
--exclude '.*/.conan.*' \
--exclude '.*/.conan2/.*' \
--exclude '.*robot_vision.*' \
--exclude '.*controller.*' \
--exclude '.*external.*' \
--exclude '.*third_party.*' \
--exclude '.*/src/main.cpp' || true
} >> "$GITHUB_STEP_SUMMARY"
docker-build-and-test:
name: "Docker build and service tests"
needs: detect-changes
if: ${{ github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.run-jobs == 'true' }}
runs-on: ubuntu-latest
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
- name: "Build Docker image"
uses: docker/build-push-action@d08e5c354a6adb9ed34480a06d141179aa583294 # v7.0.0
with:
context: .
file: tracker/Dockerfile
target: runtime
push: false
load: true
tags: scenescape-tracker:latest
build-args: |
GIT_COMMIT=${{ github.sha }}
BUILD_TYPE=Release
cache-from: type=gha,scope=tracker-service
cache-to: type=gha,mode=max,scope=tracker-service
- name: "Install Python dependencies"
run: |
pip install -r tracker/test/service/requirements.txt
- name: "Run service tests"
run: make -C tracker test-service