-
Notifications
You must be signed in to change notification settings - Fork 2k
130 lines (124 loc) · 4.72 KB
/
Copy pathtests.yml
File metadata and controls
130 lines (124 loc) · 4.72 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
name: tests
on:
push:
branches:
- master
pull_request:
jobs:
tests:
name: ./test.sh
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-24.04' }}
- os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-macos-8x14' || 'macos-latest' }}
steps:
- uses: actions/checkout@v4
- uses: commaai/timeout@v1
with:
timeout: ${{ github.repository == 'commaai/opendbc' && '90' || '999' }}
- run: ./test.sh
safety_tests:
name: safety
runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
steps:
- uses: commaai/timeout@v1
with:
timeout: ${{ github.repository == 'commaai/opendbc' && '60' || '999' }}
- uses: actions/checkout@v4
- name: Run safety tests
run: ./opendbc/safety/tests/test.sh
mutation:
name: Safety mutation tests
runs-on: ${{ matrix.os }}
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
- os: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-macos-8x14' || 'macos-latest' }}
steps:
- uses: actions/checkout@v4
- name: Run mutation tests
run: |
source setup.sh
python opendbc/safety/tests/mutation.py
car_diff:
name: car diff
runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
env:
GIT_REF: ${{ github.event_name == 'push' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.event.before || format('origin/{0}', github.event.repository.default_branch) }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Test car diff
if: github.event_name == 'pull_request'
run: source setup.sh && python opendbc/car/tests/car_diff.py | tee diff.txt
- name: Upload diff
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
with:
name: car_diff_${{ github.event.number }}
path: diff.txt
- name: Update refs
if: github.repository == 'commaai/opendbc' && github.ref == 'refs/heads/master'
run: source setup.sh && python opendbc/car/tests/car_diff.py --update-refs
- name: Checkout ci-artifacts
if: github.repository == 'commaai/opendbc' && github.ref == 'refs/heads/master'
uses: actions/checkout@v4
with:
repository: commaai/ci-artifacts
ssh-key: ${{ secrets.CI_ARTIFACTS_DEPLOY_KEY }}
path: ${{ github.workspace }}/ci-artifacts
- name: Push refs
if: github.repository == 'commaai/opendbc' && github.ref == 'refs/heads/master'
working-directory: ${{ github.workspace }}/ci-artifacts
run: |
ls ${{ github.workspace }}/car_diff/*.zst 2>/dev/null || exit 0
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git fetch origin car_diff || true
git checkout car_diff 2>/dev/null || git checkout --orphan car_diff
cp ${{ github.workspace }}/car_diff/*.zst .
git add *.zst
git commit -m "car_diff refs for ${{ github.sha }}" || echo "No changes to commit"
git push origin car_diff
# TODO: this needs to move to opendbc
test_models:
name: test models
runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
job: [0, 1, 2, 3]
env:
CI: 1
steps:
- uses: actions/checkout@v4
with:
repository: 'commaai/openpilot'
ref: 'master'
submodules: true
- run: ./tools/op.sh setup
- run: rm -rf opendbc_repo/
- uses: actions/checkout@v4
with:
path: opendbc_repo
- name: Cache test routes
id: routes-cache
uses: actions/cache@v4
with:
path: /tmp/comma_download_cache
key: car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'opendbc/car/tests/routes.py') }}-${{ matrix.job }}
- name: Build openpilot
run: scons -j$(nproc) common/ cereal/ selfdrive/pandad/ msgq_repo/ opendbc_repo
- name: Test car models
timeout-minutes: ${{ contains(runner.name, 'nsc') && (steps.routes-cache.outputs.cache-hit == 'true') && 2 || 6 }}
run: MAX_EXAMPLES=1 pytest --continue-on-collection-errors --durations=0 --durations-min=5 -n logical selfdrive/car/tests/test_models.py
env:
NUM_JOBS: 4
JOB_ID: ${{ matrix.job }}