forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
240 lines (227 loc) · 8.28 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
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
239
240
name: openpilot tests
on:
push:
pull_request:
status:
env:
RUN: docker run --shm-size 1G --rm tmppilot /bin/sh -c
PERSIST: docker run --shm-size 1G --name tmppilot tmppilot /bin/sh -c
CI_RUN: docker run -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID --rm tmppilotci /bin/bash -c
UNIT_TEST: coverage run --append -m unittest discover
BUILD: |
# build the openpilot docker base image
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile.openpilot_base) || true
docker pull docker.io/commaai/openpilot-base:latest || true
docker build --cache-from docker.io/commaai/openpilot-base:latest -t commaai/openpilot-base:latest -f Dockerfile.openpilot_base .
# build the final CI image
docker pull docker.io/commaai/openpilotci:latest || true
docker build --cache-from docker.io/commaai/openpilotci:latest -t tmppilot -f Dockerfile.openpilotci .
jobs:
build_release:
name: build release
runs-on: ubuntu-16.04
timeout-minutes: 50
env:
TEST_DIR: tmppilot
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Strip non-release files
run: |
mkdir $TEST_DIR
cp -pR --parents $(cat release/files_common) $TEST_DIR
cp Dockerfile.openpilot_base Dockerfile.openpilotci $TEST_DIR
# need this to build on x86
cp -pR --parents phonelibs/libyuv phonelibs/snpe \
external/bin selfdrive/modeld/runners $TEST_DIR
# need these so docker copy won't fail
cp Pipfile Pipfile.lock .pylintrc .pre-commit-config.yaml $TEST_DIR
cd $TEST_DIR
mkdir laika laika_repo tools
- name: Build Docker image
run: cd $TEST_DIR && eval "$BUILD"
- name: Build openpilot and run quick check
run: |
$RUN "cd /tmp/openpilot && \
scons -j$(nproc) && \
$UNIT_TEST selfdrive/car"
#build_mac:
# name: build macos
# runs-on: macos-10.15
# timeout-minutes: 60
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: true
# - name: Cache dependencies
# id: dependency-cache
# uses: actions/cache@v2
# with:
# path: |
# ~/.pyenv
# ~/Library/Caches/pip
# ~/Library/Caches/pipenv
# ~/Library/Caches/Homebrew
# key: ${{ hashFiles('tools/mac_setup.sh') }}
# - name: Install dependencies
# run: ./tools/mac_setup.sh
# - name: Build openpilot
# run: eval "$(pyenv init -)" && scons -j$(nproc)
# - name: Brew cleanup
# run: brew cleanup # keeps our cache small
docker_push:
name: docker push
runs-on: ubuntu-16.04
timeout-minutes: 50
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/openpilot'
needs: static_analysis # hack to ensure slow tests run first since this and static_analysis are fast
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: eval "$BUILD"
- name: Push to dockerhub
run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}}
docker tag commaai/openpilot-base:latest docker.io/commaai/openpilot-base:latest
docker push docker.io/commaai/openpilot-base:latest
docker tag tmppilot docker.io/commaai/openpilotci:latest
docker push docker.io/commaai/openpilotci:latest
docker_push_prebuilt:
name: docker push prebuilt
runs-on: ubuntu-16.04
timeout-minutes: 50
if: github.event_name == 'status' && github.repository == 'commaai/openpilot'
needs: [static_analysis, unit_tests, process_replay, test_longitudinal, test_car_models]
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: echo "RUN cd /tmp/openpilot && scons -c && scons -j\$(nproc)" >> Dockerfile.openpilotci && eval "$BUILD"
- name: Push to dockerhub
run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}}
docker tag tmppilot docker.io/commaai/openpilot:latest
docker push docker.io/commaai/openpilot:latest
static_analysis:
name: static analysis
runs-on: ubuntu-16.04
timeout-minutes: 50
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: eval "$BUILD"
- name: pre-commit
run: $RUN "cd /tmp/openpilot/ && git init && git add -A && pre-commit run --all"
unit_tests:
name: unit tests
runs-on: ubuntu-16.04
timeout-minutes: 50
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: eval "$BUILD"
- name: Run unit tests
run: |
$PERSIST "cd /tmp/openpilot && \
scons -j$(nproc) && \
coverage run selfdrive/test/test_fingerprints.py && \
$UNIT_TEST common && \
$UNIT_TEST opendbc/can && \
$UNIT_TEST selfdrive/boardd && \
$UNIT_TEST selfdrive/controls && \
$UNIT_TEST selfdrive/monitoring && \
$UNIT_TEST selfdrive/loggerd && \
$UNIT_TEST selfdrive/car && \
$UNIT_TEST selfdrive/locationd && \
$UNIT_TEST selfdrive/athena && \
$UNIT_TEST selfdrive/thermald && \
$UNIT_TEST tools/lib/tests"
- name: Upload coverage to Codecov
run: |
docker commit tmppilot tmppilotci
$CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -v -F unit_tests"
process_replay:
name: process replay
runs-on: ubuntu-16.04
timeout-minutes: 50
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: eval "$BUILD"
- name: Run replay
run: |
$PERSIST "cd /tmp/openpilot && \
scons -j$(nproc) && \
CI=1 coverage run selfdrive/test/process_replay/test_processes.py"
- name: Upload coverage to Codecov
run: |
docker commit tmppilot tmppilotci
$CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -v -F process_replay"
- name: Print diff
if: always()
run: |
docker cp tmppilot:/tmp/openpilot/selfdrive/test/process_replay/diff.txt diff.txt
cat diff.txt
- uses: actions/upload-artifact@v2
if: always()
with:
name: process_replay_diff.txt
path: diff.txt
test_longitudinal:
name: longitudinal
runs-on: ubuntu-16.04
timeout-minutes: 50
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: eval "$BUILD"
- name: Test longitudinal
run: |
$PERSIST "mkdir -p /tmp/openpilot/selfdrive/test/out && \
cd /tmp/openpilot/ && \
scons -j$(nproc) && \
cd selfdrive/test/longitudinal_maneuvers && \
OPTEST=1 ./test_longitudinal.py"
- name: Copy artifacts
if: always()
run: |
mkdir out
docker cp tmppilot:/tmp/openpilot/selfdrive/test/longitudinal_maneuvers/out/longitudinal/ out/
- uses: actions/upload-artifact@v2
if: always()
with:
name: longitudinal
path: out
test_car_models:
name: test car models
runs-on: ubuntu-16.04
timeout-minutes: 50
steps:
- uses: actions/checkout@v2
with:
submodules: true
- name: Build Docker image
run: eval "$BUILD"
- name: Test car models
run: |
$PERSIST "cd /tmp/openpilot && \
scons -j$(nproc) && \
coverage run --parallel-mode -m nose --processes=4 --process-timeout=60 \
selfdrive/test/test_models.py && \
coverage combine"
- name: Upload coverage to Codecov
run: |
docker commit tmppilot tmppilotci
$CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -v -F test_car_models"