Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no docker #1081

Merged
merged 13 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Swaglog still requires the zmq library for compilation.


# 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.