mirror of
https://github.com/infiniteCable2/opendbc.git
synced 2026-02-18 21:13:51 +08:00
* install mull on macOS * runs * run in ci * more readable * fail early * who doesn't have curl * fix that? * uv sourcing * unset that * mit * cleanup
108 lines
4.2 KiB
YAML
108 lines
4.2 KiB
YAML
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: ./.github/workflows/cache
|
|
id: cache
|
|
- uses: commaai/timeout@v1
|
|
with:
|
|
timeout: ${{ github.repository == 'commaai/opendbc' && (steps.cache.outputs.cache-hit == 'true' && '60' || '90') || '999' }}
|
|
- run: ./test.sh
|
|
|
|
safety_tests:
|
|
name: safety
|
|
runs-on: ${{ github.repository == 'commaai/opendbc' && 'namespace-profile-amd64-8x16' || 'ubuntu-latest' }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
flags: ['--ubsan']
|
|
steps:
|
|
- uses: commaai/timeout@v1
|
|
with:
|
|
timeout: ${{ github.repository == 'commaai/opendbc' && '60' || '999' }}
|
|
- uses: actions/checkout@v4
|
|
- uses: ./.github/workflows/cache
|
|
- name: Run safety tests
|
|
run: ./opendbc/safety/tests/test.sh ${{ matrix.flags }}
|
|
|
|
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' }}
|
|
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 # need master to get diff
|
|
- uses: ./.github/workflows/cache
|
|
- name: Run mutation tests
|
|
run: |
|
|
source setup.sh
|
|
scons -j8
|
|
cd opendbc/safety/tests && ./mutation.sh
|
|
|
|
# TODO: this test 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:
|
|
BASE_IMAGE: openpilot-base
|
|
BUILD: selfdrive/test/docker_build.sh base
|
|
RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PYTHONWARNINGS=default -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c
|
|
PYTEST: pytest --continue-on-collection-errors --durations=0 --durations-min=5 -n logical
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
repository: 'commaai/openpilot'
|
|
ref: 'master'
|
|
submodules: true
|
|
- run: rm -rf opendbc_repo/
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
path: opendbc_repo
|
|
- uses: ./.github/workflows/setup-with-retry
|
|
id: setup-step
|
|
- name: Cache test routes
|
|
id: routes-cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: .ci_cache/comma_download_cache
|
|
key: car_models-${{ hashFiles('selfdrive/car/tests/test_models.py', 'opendbc/car/tests/routes.py') }}-${{ matrix.job }}
|
|
- name: Build openpilot
|
|
run: ${{ env.RUN }} "VIRTUAL_ENV= opendbc_repo/setup.sh && 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') && ((steps.setup-step.outputs.duration < 18) && 1 || 2) || 6 }}
|
|
run: |
|
|
${{ env.RUN }} "MAX_EXAMPLES=1 $PYTEST selfdrive/car/tests/test_models.py && \
|
|
chmod -R 777 /tmp/comma_download_cache"
|
|
env:
|
|
NUM_JOBS: 4
|
|
JOB_ID: ${{ matrix.job }}
|