Skip to content

Commit

Permalink
no docker (commaai#1081)
Browse files Browse the repository at this point in the history
* cleanup dependencies

* all

* install

* less

* try this

* slimmm

* skip docker

* silence that one

* disable for now

* e

* fix build

* bring that back

* not ready yet
  • Loading branch information
adeebshihadeh authored Aug 17, 2024
1 parent 0a9727a commit 3537404
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 89 deletions.
22 changes: 11 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@ on:
- master
pull_request:

env:
RUN: docker run -e PYTHONWARNINGS="error,default::DeprecationWarning" --shm-size 1G --rm opendbc /bin/bash -c
BUILD: docker buildx build --pull --load --cache-to type=inline --cache-from type=registry,ref=ghcr.io/commaai/opendbc:latest -t opendbc -f Dockerfile .
PYTHONWARNINGS: error
# TODO: enable this
#env:
# PYTHONWARNINGS: error,default::DeprecationWarning

jobs:
unit-tests:
Expand All @@ -22,22 +21,23 @@ jobs:
# run: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: eval "$BUILD"
- name: Unit tests
run: ${{ env.RUN }} "pytest -n logical --durations=0"
- uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: '3.11'
- run: pip install -e .[testing,docs]
- run: scons -j$(nproc)
- run: pytest -n logical --durations=0

static-analysis:
name: static analysis
runs-on: ubuntu-latest
timeout-minutes: 1
env:
# package install has DeprecationWarnings
PYTHONWARNINGS: default
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
cache: 'pip'
python-version: '3.11'
- run: sudo apt install --no-install-recommends -y cppcheck
- run: pip install -e .
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/build/
.mypy_cache/
*.pyc
*.os
Expand All @@ -8,6 +9,7 @@
.DS_Store
.sconsign.dblite
.hypothesis
*.egg-info/

opendbc/can/*.so
opendbc/can/*.a
Expand Down
47 changes: 0 additions & 47 deletions Dockerfile

This file was deleted.

8 changes: 4 additions & 4 deletions SConstruct
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import subprocess
import sysconfig
import numpy as np

zmq = 'zmq'
arch = subprocess.check_output(["uname", "-m"], encoding='utf8').rstrip()

python_path = sysconfig.get_paths()['include']
Expand All @@ -28,8 +27,8 @@ ldflags_asan = ["-fsanitize=address"] if GetOption('asan') else []

env = Environment(
ENV=os.environ,
CC='clang',
CXX='clang++',
CC='gcc',
CXX='g++',
CCFLAGS=[
"-g",
"-fPIC",
Expand All @@ -38,6 +37,7 @@ env = Environment(
"-Werror",
"-Wshadow",
"-Wno-vla-cxx-extension",
"-Wno-unknown-warning-option", # for compatibility across compiler versions
] + ccflags_asan,
LDFLAGS=ldflags_asan,
LINKFLAGS=ldflags_asan,
Expand All @@ -52,7 +52,7 @@ env = Environment(
)

common = ''
Export('env', 'zmq', 'arch', 'common')
Export('env', 'arch', 'common')

envCython = env.Clone()
envCython["CPPPATH"] += [np.get_include()]
Expand Down
16 changes: 5 additions & 11 deletions opendbc/can/SConscript
Original file line number Diff line number Diff line change
@@ -1,30 +1,24 @@
Import('env', 'envCython', 'common', 'arch')

import os

envDBC = env.Clone()
dbc_file_path = '-DDBC_FILE_PATH=\'"%s"\'' % (envDBC.Dir("../dbc").abspath)
envDBC['CXXFLAGS'] += [dbc_file_path]
src = ["dbc.cc", "parser.cc", "packer.cc", "common.cc"]
libs = [common, "zmq"]

# shared library for openpilot
LINKFLAGS = envDBC["LINKFLAGS"]
if arch == "Darwin":
LINKFLAGS += ["-Wl,-install_name,@loader_path/libdbc.dylib"]
libdbc = envDBC.SharedLibrary('libdbc', src, LIBS=libs, LINKFLAGS=LINKFLAGS)
libdbc = envDBC.SharedLibrary('libdbc', src, LIBS=[common, ], LINKFLAGS=LINKFLAGS)

# static library for tools like cabana
envDBC.Library('libdbc_static', src, LIBS=libs)
envDBC.Library('libdbc_static', src, LIBS=[common, ])

# Build packer and parser
lenv = envCython.Clone()
lenv["LINKFLAGS"] += [libdbc[0].get_labspath()]
parser = lenv.Program('parser_pyx.so', 'parser_pyx.pyx')
packer = lenv.Program('packer_pyx.so', 'packer_pyx.pyx')

lenv.Depends(parser, libdbc)
lenv.Depends(packer, libdbc)
lenv["RPATH"] = [libdbc[0].dir.abspath, ]
parser = lenv.Program('parser_pyx.so', 'parser_pyx.pyx', LIBS=[common, libdbc])
packer = lenv.Program('packer_pyx.so', 'packer_pyx.pyx', LIBS=[common, libdbc])

opendbc_python = Alias("opendbc_python", [parser, packer])

Expand Down
25 changes: 25 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,31 @@ requires-python = ">=3.9"

urls = { "homepage" = "https://github.com/commaai/opendbc" }

dependencies = [
"scons",
"pyyaml",
"numpy",
"Cython",
"crcmod",
"pandacan@git+https://github.com/commaai/panda.git@master",
]

[project.optional-dependencies]
testing = [
"ruff",
"pytest",
"pytest-mock",
"pytest-xdist",
"pytest-subtests",
"hypothesis==6.47.*",
"parameterized>=0.8,<0.9",
"pre-commit",
]
docs = [
"Jinja2",
"natsort",
]

[tool.pytest.ini_options]
addopts = "--ignore=panda/ -Werror --strict-config --strict-markers --durations=10 -n auto"
python_files = "test_*.py"
Expand Down
16 changes: 0 additions & 16 deletions requirements.txt

This file was deleted.

0 comments on commit 3537404

Please sign in to comment.