Skip to content

Commit

Permalink
Merge branch 'upstream/panda/master' into camera-scc-long
Browse files Browse the repository at this point in the history
  • Loading branch information
sunnyhaibin committed Mar 27, 2023
2 parents 638d94d + d70fa4e commit d7e3f16
Show file tree
Hide file tree
Showing 190 changed files with 5,482 additions and 3,155 deletions.
34 changes: 18 additions & 16 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ concurrency:
cancel-in-progress: true

env:
RUN: docker run -v $GITHUB_WORKSPACE:/tmp/openpilot/panda -w /tmp/openpilot/panda --rm panda /bin/bash -c
PERSIST: docker run -v $GITHUB_WORKSPACE:/tmp/openpilot/panda -w /tmp/openpilot/panda --name panda panda /bin/bash -c
RUN: docker run -v ${{ github.workspace }}:/tmp/openpilot/panda -w /tmp/openpilot/panda --rm panda /bin/bash -c
PERSIST: docker run -v ${{ github.workspace }}:/tmp/openpilot/panda -w /tmp/openpilot/panda --name panda panda /bin/bash -c
BUILD: |
export DOCKER_BUILDKIT=1
docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ghcr.io/commaai/panda:latest -t panda -f Dockerfile.panda .
docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from ghcr.io/commaai/panda:latest -t panda -f Dockerfile .
jobs:
docker_push:
Expand Down Expand Up @@ -39,11 +39,11 @@ jobs:
- name: Build Docker image
run: eval "$BUILD"
- name: Test python package installer
run: ${{ env.RUN }} "cd /tmp/openpilot/panda && python setup.py install"
- name: Build panda STM image and bootstub
run: ${{ env.RUN }} "cd /tmp/openpilot/panda && scons"
- name: Build pedal STM image and bootstub
run: ${{ env.RUN }} "cd /tmp/openpilot/panda && PEDAL=1 scons"
run: ${{ env.RUN }} "python setup.py install"
- name: Build panda + pedal images and bootstub
run: ${{ env.RUN }} "scons -j4"
- name: Build panda with SPI support
run: ${{ env.RUN }} "ENABLE_SPI=1 scons -j4"

unit_tests:
name: unit tests
Expand All @@ -53,9 +53,10 @@ jobs:
- uses: actions/checkout@v2
- name: Build Docker image
run: eval "$BUILD"
- name: Test pack/unpack for USB protocol
run: ${{ env.RUN }} "cd /tmp/openpilot/panda/tests/usbprotocol &&
python -m unittest discover ."
- name: Build panda
run: $RUN "scons -j4"
- name: Test communication protocols
run: $RUN "cd tests/usbprotocol && ./test.sh"

safety:
name: safety
Expand All @@ -66,13 +67,14 @@ jobs:
- name: Build Docker image
run: eval "$BUILD"
- name: Run safety tests
timeout-minutes: 3
timeout-minutes: 4
run: |
${{ env.RUN }} "cd /tmp/openpilot && \
${{ env.RUN }} "cd .. && \
scons -c && \
scons -j$(nproc) opendbc/ cereal/ && \
cd panda/tests/safety && \
./test.sh"
cd panda && \
scons -j$(nproc) && \
tests/safety/test.sh"
safety_replay:
name: safety replay
Expand All @@ -84,7 +86,7 @@ jobs:
run: eval "$BUILD"
- name: Run safety replay
run: ${{ env.RUN }} "cd tests/safety_replay &&
scons -u --test .. &&
scons -u .. &&
./test_safety_replay.py"

misra:
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@ examples/output.csv
nosetests.xml
.mypy_cache/
.sconsign.dblite

# CTU info files generated by Cppcheck
*.*.ctu-info
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,12 @@ repos:
rev: v0.910-1
hooks:
- id: mypy
exclude: '^(tests/automated)/'
additional_dependencies: ['git+https://github.com/numpy/numpy-stubs', 'types-requests', 'types-atomicwrites',
'types-pycurl']
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
exclude: '^(tests/automated)/'
args:
- --select=F,E112,E113,E304,E501,E502,E701,E702,E703,E71,E72,E731,W191,W6
- --exclude=tests/gmbitbang/*
Expand All @@ -30,7 +28,9 @@ repos:
entry: pylint
language: system
types: [python]
exclude: '^(tests/automated)/'
args:
- --disable=C,R,W0613,W0511,W0212,W0201,W0311,W0106,W0603,W0621,W0703,E1136
- -rn
- -sn
- -j0
- --disable=C,R,W0613,W0511,W0212,W0201,W0311,W0106,W0603,W0621,W0703,W1203,W1514,E1136
- --generated-members="usb1.*"
100 changes: 62 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,73 +1,97 @@
FROM ubuntu:20.04
ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /tmp/openpilot:$PYTHONPATH

ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y --no-install-recommends \
autoconf \
automake \
bash \
bison \
bzip2 \
ca-certificates \
capnproto \
clang \
curl \
dfu-util \
flex \
g++ \
gawk \
gcc \
gcc-arm-none-eabi libnewlib-arm-none-eabi \
git \
gperf \
help2man \
iputils-ping \
libarchive-dev \
libavformat-dev libavcodec-dev libavdevice-dev libavutil-dev libswscale-dev libavresample-dev libavfilter-dev \
libbz2-dev \
libexpat-dev \
libcapnp-dev \
libcurl4-openssl-dev \
libffi-dev \
libssl-dev \
libstdc++-arm-none-eabi-newlib \
libtool \
libtool-bin \
libssl-dev \
libsqlite3-dev \
libusb-1.0-0 \
locales \
libzmq3-dev \
locales \
opencl-headers \
ocl-icd-opencl-dev \
make \
ncurses-dev \
network-manager \
patch \
pkg-config \
python \
python-dev \
python3-serial \
sed \
texinfo \
unrar-free \
unzip \
wget \
build-essential \
python-dev \
screen \
vim \
wget \
wireless-tools \
zlib1g-dev
zlib1g-dev \
&& rm -rf /var/lib/apt/lists/* && \
cd /usr/lib/gcc/arm-none-eabi/9.2.1 && \
rm -rf arm/ && \
rm -rf thumb/nofp thumb/v6* thumb/v8* thumb/v7+fp thumb/v7-r+fp.sp

RUN sed -i -e 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen && locale-gen
ENV LANG en_US.UTF-8
ENV LANGUAGE en_US:en
ENV LC_ALL en_US.UTF-8

RUN curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash

ENV PATH="/root/.pyenv/bin:/root/.pyenv/shims:${PATH}"
RUN pyenv install 3.8.10
RUN pyenv global 3.8.10
RUN pyenv rehash

RUN pip install --upgrade pip==18.0
ENV PANDA_PATH=/tmp/openpilot/panda
ENV OPENPILOT_REF="ee0dd36a3c775dbd82493c84f4e7272c1eb3fcbd"
ENV OPENDBC_REF="e8e97fcf00be9a696be009aa37ca13c55b9f632c"

COPY requirements.txt /tmp/
RUN pip install -r /tmp/requirements.txt
RUN pyenv install 3.8.10 && \
pyenv global 3.8.10 && \
pyenv rehash && \
pip install --no-cache-dir -r /tmp/requirements.txt

ENV CPPCHECK_DIR=/tmp/cppcheck
COPY tests/misra/install.sh /tmp/
RUN /tmp/install.sh

ENV PYTHONPATH /tmp:$PYTHONPATH
RUN git config --global --add safe.directory /tmp/openpilot/panda
RUN cd /tmp && \
git clone https://github.com/commaai/openpilot.git tmppilot || true && \
cd /tmp/tmppilot && \
git fetch origin $OPENPILOT_REF && \
git checkout $OPENPILOT_REF && \
git submodule update --init cereal opendbc rednose_repo && \
git -C opendbc fetch && \
git -C opendbc checkout $OPENDBC_REF && \
git -C opendbc reset --hard HEAD && \
git -C opendbc clean -xfd && \
mkdir /tmp/openpilot && \
cp -pR SConstruct site_scons/ tools/ selfdrive/ system/ common/ cereal/ opendbc/ rednose/ third_party/ /tmp/openpilot && \
rm -rf /tmp/openpilot/panda && \
rm -rf /tmp/tmppilot

RUN cd /tmp && git clone https://github.com/commaai/panda_jungle.git && \
RUN cd /tmp/openpilot && \
git clone https://github.com/commaai/panda_jungle.git && \
cd panda_jungle && \
git fetch && \
git checkout 7b7197c605915ac34f3d62f314edd84e2e78a759
git checkout 7b7197c605915ac34f3d62f314edd84e2e78a759 && \
rm -rf .git/

RUN cd /tmp/openpilot && \
pip install --no-cache-dir -r opendbc/requirements.txt && \
pip install --no-cache-dir --upgrade aenum lru-dict pycurl tenacity atomicwrites serial smbus2


ADD ./panda.tar.gz /tmp/panda
# for Jenkins
COPY README.md panda.tar.* /tmp/
RUN mkdir /tmp/openpilot/panda && \
tar -xvf /tmp/panda.tar.gz -C /tmp/openpilot/panda/ || true
84 changes: 0 additions & 84 deletions Dockerfile.panda

This file was deleted.

Loading

0 comments on commit d7e3f16

Please sign in to comment.