forked from commaai/openpilot
-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (147 loc) · 4.78 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
name: Openpilot Tests
on: [push, pull_request]
env:
RUN: docker run --shm-size 1G --rm tmppilot /bin/sh -c
LOAD: docker load -i tmppilot.tar.gz/tmppilot.tar.gz
UNIT_TEST: cd /tmp/openpilot && python -m unittest discover
jobs:
build:
name: build
runs-on: ubuntu-16.04
steps:
- uses: actions/checkout@v2
- name: Checkout submodules
run: |
git submodule update --init
- name: Build docker image
run: |
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile.openpilot) || true
docker pull docker.io/commaai/openpilot:latest || true
docker build --cache-from docker.io/commaai/openpilot:latest -t tmppilot -f Dockerfile.openpilot .
docker save tmppilot:latest | gzip > tmppilot.tar.gz
- uses: actions/upload-artifact@v1
with:
name: tmppilot.tar.gz
path: tmppilot.tar.gz
push:
name: push
runs-on: ubuntu-16.04
needs: build
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/openpilot'
steps:
- uses: actions/download-artifact@v1
with:
name: tmppilot.tar.gz
- name: Load image
run: $LOAD
- name: Login to dockerhub
run: docker login -u wmelching -p ${{ secrets.DOCKERHUB_TOKEN }}
- name: Tag image
run: docker tag tmppilot docker.io/commaai/openpilot:latest
- name: Push image
run: docker push docker.io/commaai/openpilot:latest
linter:
name: linter
runs-on: ubuntu-16.04
needs: build
steps:
- uses: actions/download-artifact@v1
with:
name: tmppilot.tar.gz
- name: Load image
run: $LOAD
- name: flake8
run: $RUN "cd /tmp/openpilot/ && ./flake8_openpilot.sh"
- name: pylint
run: $RUN "cd /tmp/openpilot/ && ./pylint_openpilot.sh"
unit_tests:
name: unit tests
runs-on: ubuntu-16.04
needs: build
steps:
- uses: actions/download-artifact@v1
with:
name: tmppilot.tar.gz
- name: Load image
run: $LOAD
- name: Run unit tests
run: |
$RUN /tmp/openpilot/selfdrive/test/test_fingerprints.py
$RUN "$UNIT_TEST common"
$RUN "$UNIT_TEST opendbc/can"
$RUN "$UNIT_TEST selfdrive/boardd"
$RUN "$UNIT_TEST selfdrive/controls"
$RUN "$UNIT_TEST selfdrive/loggerd"
$RUN "$UNIT_TEST selfdrive/car"
$RUN "$UNIT_TEST selfdrive/locationd"
$RUN "$UNIT_TEST selfdrive/athena"
$RUN "$UNIT_TEST tools/lib/tests"
process_replay:
name: process replay
runs-on: ubuntu-16.04
needs: build
timeout-minutes: 30
steps:
- uses: actions/download-artifact@v1
with:
name: tmppilot.tar.gz
- name: Load image
run: $LOAD
- name: Run replay
run: |
CONTAINER_NAME="tmppilot_${GITHUB_SHA}"
docker run --shm-size 1G --name ${CONTAINER_NAME} tmppilot /bin/sh -c "cd /tmp/openpilot/selfdrive/test/process_replay && CI=1 ./test_processes.py"
- name: Copy diff
if: always()
run: |
CONTAINER_NAME="tmppilot_${GITHUB_SHA}"
docker cp $CONTAINER_NAME:/tmp/openpilot/selfdrive/test/process_replay/diff.txt diff.txt
docker rm $CONTAINER_NAME
- name: Print diff
if: always()
run: cat diff.txt
- uses: actions/upload-artifact@v1
if: always()
with:
name: process_replay_diff.txt
path: diff.txt
test_longitudinal:
name: longitudinal
runs-on: ubuntu-16.04
needs: build
timeout-minutes: 30
steps:
- uses: actions/download-artifact@v1
with:
name: tmppilot.tar.gz
- name: Load image
run: $LOAD
- name: Test longitudinal
run: |
CONTAINER_NAME="tmppilot_${GITHUB_SHA}"
docker run --shm-size 1G --name ${CONTAINER_NAME} tmppilot /bin/sh -c "cd /tmp/openpilot/selfdrive/test/longitudinal_maneuvers && OPTEST=1 ./test_longitudinal.py"
- name: Copy artifacts
if: always()
run: |
CONTAINER_NAME="tmppilot_${GITHUB_SHA}"
mkdir out
docker cp $CONTAINER_NAME:/tmp/openpilot/selfdrive/test/longitudinal_maneuvers/out/longitudinal/ out/
docker rm $CONTAINER_NAME
- uses: actions/upload-artifact@v1
if: always()
with:
name: longitudinal
path: out
test_car_models:
name: test car models
runs-on: ubuntu-16.04
needs: build
timeout-minutes: 30
steps:
- uses: actions/download-artifact@v1
with:
name: tmppilot.tar.gz
- name: Load image
run: $LOAD
- name: Test car models
run: $RUN "mkdir -p /data/params && cd /tmp/openpilot/selfdrive/test/ && ./test_car_models.py"