move to github container registry + CI speedup (#19621)

old-commit-hash: 59d7c5e64a
commatwo_master
Adeeb Shihadeh 4 years ago committed by GitHub
parent c1042b848e
commit c64a8356fe
  1. 143
      .github/workflows/test.yaml
  2. 3
      Dockerfile.openpilot
  3. 1
      Dockerfile.openpilot_base
  4. 1
      selfdrive/loggerd/tests/loggerd_tests_common.py
  5. 4
      selfdrive/loggerd/uploader.py
  6. 11
      selfdrive/test/longitudinal_maneuvers/test_longitudinal.py
  7. 2
      selfdrive/test/process_replay/process_replay.py
  8. 7
      selfdrive/test/process_replay/test_processes.py
  9. 5
      tools/lib/tests/test_caching.py
  10. 2
      tools/lib/url_file.py
  11. 38
      tools/webcam/Dockerfile

@ -6,18 +6,17 @@ on:
pull_request: pull_request:
env: env:
RUN: docker run --shm-size 1G --rm tmppilot /bin/sh -c BASE_IMAGE: openpilot-base
PERSIST_WITH_CACHE: docker run --shm-size 1G -v /tmp/comma_download_cache:/tmp/comma_download_cache --name tmppilot tmppilot /bin/sh -c DOCKER_REGISTRY: ghcr.io/commaai
PERSIST: docker run --shm-size 1G --name tmppilot tmppilot /bin/sh -c
CI_RUN: docker run -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID --rm tmppilotci /bin/bash -c DOCKER_LOGIN: docker login ghcr.io -u adeebshihadeh -p ${{ secrets.CONTAINER_TOKEN }}
UNIT_TEST: coverage run --append -m unittest discover
BUILD: | BUILD: |
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile.openpilot_base) || true docker pull $(grep -iohP '(?<=^from)\s+\S+' Dockerfile.openpilot_base) || true
docker pull docker.io/commaai/openpilot-base:latest || true docker pull $DOCKER_REGISTRY/$BASE_IMAGE:latest || true
docker build --cache-from docker.io/commaai/openpilot-base:latest -t commaai/openpilot-base:latest -f Dockerfile.openpilot_base . docker build --cache-from $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $BASE_IMAGE:latest -f Dockerfile.openpilot_base .
docker pull docker.io/commaai/openpilotci:latest || true RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v /tmp/comma_download_cache:/tmp/comma_download_cache $BASE_IMAGE /bin/sh -c
docker build --cache-from docker.io/commaai/openpilotci:latest -t tmppilot -f Dockerfile.openpilotci . UNIT_TEST: coverage run --append -m unittest discover
jobs: jobs:
build_release: build_release:
@ -25,32 +24,27 @@ jobs:
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 50 timeout-minutes: 50
env: env:
TEST_DIR: tmppilot STRIPPED_DIR: tmppilot
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- name: Strip non-release files - name: Strip non-release files
run: | run: |
mkdir $TEST_DIR mkdir $STRIPPED_DIR
cp -pR --parents $(cat release/files_common) $TEST_DIR cp -pR --parents $(cat release/files_common) $STRIPPED_DIR
cp Dockerfile.openpilot_base Dockerfile.openpilotci $TEST_DIR cp Dockerfile.openpilot_base $STRIPPED_DIR
# need this to build on x86 # need this to build on x86
cp -pR --parents phonelibs/libyuv phonelibs/snpe \ cp -pR --parents phonelibs/libyuv phonelibs/snpe selfdrive/modeld/runners $STRIPPED_DIR
external/bin selfdrive/modeld/runners $TEST_DIR
# need these so docker copy won't fail
cp Pipfile Pipfile.lock .pylintrc .pre-commit-config.yaml $TEST_DIR
cd $TEST_DIR
mkdir laika laika_repo tools
- name: Build Docker image - name: Build Docker image
run: cd $TEST_DIR && eval "$BUILD" run: eval "$BUILD"
- name: Build openpilot and run quick check - name: Build openpilot and run checks
run: | run: |
$RUN "cd /tmp/openpilot && \ cd $STRIPPED_DIR
${{ env.RUN }} "cd /tmp/openpilot && \
scons -j$(nproc) && \ scons -j$(nproc) && \
$UNIT_TEST selfdrive/car" python -m unittest discover selfdrive/car"
build_mac: build_mac:
name: build macos name: build macos
@ -81,22 +75,24 @@ jobs:
name: build webcam name: build webcam
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 90 timeout-minutes: 90
env:
IMAGE_NAME: openpilotwebcamci
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- name: Build Docker image - name: Build Docker image
run: | run: |
docker pull docker.io/commaai/openpilotwebcamci:latest eval "$BUILD"
docker build --cache-from docker.io/commaai/openpilotwebcamci:latest -t tmppilotwebcam -f tools/webcam/Dockerfile . docker pull $DOCKER_REGISTRY/$IMAGE_NAME:latest || true
docker build --cache-from $DOCKER_REGISTRY/$IMAGE_NAME:latest -t $DOCKER_REGISTRY/$IMAGE_NAME:latest -f tools/webcam/Dockerfile .
- name: Build openpilot - name: Build openpilot
run: docker run --shm-size 1G --rm tmppilotwebcam /bin/sh -c "cd /tmp/openpilot && USE_WEBCAM=1 scons -j$(nproc)" run: docker run --shm-size 1G --rm $DOCKER_REGISTRY/$IMAGE_NAME /bin/sh -c "cd /tmp/openpilot && USE_WEBCAM=1 scons -j$(nproc)"
- name: Push to dockerhub - name: Push to container registry
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/openpilot' if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/openpilot'
run: | run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}} $DOCKER_LOGIN
docker tag tmppilotwebcam docker.io/commaai/openpilotwebcamci:latest docker push $DOCKER_REGISTRY/$IMAGE_NAME:latest
docker push docker.io/commaai/openpilotwebcamci:latest
docker_push: docker_push:
name: docker push name: docker push
@ -110,13 +106,10 @@ jobs:
submodules: true submodules: true
- name: Build Docker image - name: Build Docker image
run: eval "$BUILD" run: eval "$BUILD"
- name: Push to dockerhub - name: Push to container registry
run: | run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}} $DOCKER_LOGIN
docker tag commaai/openpilot-base:latest docker.io/commaai/openpilot-base:latest docker push $DOCKER_REGISTRY/$BASE_IMAGE:latest
docker push docker.io/commaai/openpilot-base:latest
docker tag tmppilot docker.io/commaai/openpilotci:latest
docker push docker.io/commaai/openpilotci:latest
docker_push_prebuilt: docker_push_prebuilt:
name: docker push prebuilt name: docker push prebuilt
@ -124,17 +117,21 @@ jobs:
timeout-minutes: 50 timeout-minutes: 50
if: github.event_name == 'status' && github.repository == 'commaai/openpilot' if: github.event_name == 'status' && github.repository == 'commaai/openpilot'
needs: [static_analysis, unit_tests, process_replay, test_longitudinal, test_car_models] needs: [static_analysis, unit_tests, process_replay, test_longitudinal, test_car_models]
env:
IMAGE_NAME: openpilot-prebuilt
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
submodules: true submodules: true
- name: Build Docker image - name: Build Docker image
run: echo "RUN cd /tmp/openpilot && scons -c && scons -j\$(nproc)" >> Dockerfile.openpilotci && eval "$BUILD"
- name: Push to dockerhub
run: | run: |
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}} eval "$BUILD"
docker tag tmppilot docker.io/commaai/openpilot:latest docker pull $DOCKER_REGISTRY/$IMAGE_NAME:latest || true
docker push docker.io/commaai/openpilot:latest docker build --cache-from $DOCKER_REGISTRY/$IMAGE_NAME:latest -t $DOCKER_REGISTRY/$IMAGE_NAME:latest -f Dockerfile.openpilot .
- name: Push to container registry
run: |
$DOCKER_LOGIN
docker push $DOCKER_REGISTRY/$IMAGE_NAME:latest
static_analysis: static_analysis:
name: static analysis name: static analysis
@ -147,7 +144,7 @@ jobs:
- name: Build Docker image - name: Build Docker image
run: eval "$BUILD" run: eval "$BUILD"
- name: pre-commit - name: pre-commit
run: $RUN "cd /tmp/openpilot/ && git init && git add -A && pre-commit run --all" run: ${{ env.RUN }} "cd /tmp/openpilot/ && git init && git add -A && pre-commit run --all"
valgrind: valgrind:
name: valgrind name: valgrind
@ -161,27 +158,18 @@ jobs:
id: dependency-cache id: dependency-cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: /tmp/comma_download_cache
/tmp/comma_download_cache
key: ${{ hashFiles('.github/workflows/test.yaml', 'selfdrive/test/test_valgrind_replay.py') }} key: ${{ hashFiles('.github/workflows/test.yaml', 'selfdrive/test/test_valgrind_replay.py') }}
- name: Build Docker image - name: Build Docker image
run: eval "$BUILD" run: eval "$BUILD"
- name: Run valgrind - name: Run valgrind
run: | run: |
$PERSIST_WITH_CACHE "cd /tmp/openpilot && \ ${{ env.RUN }} "cd /tmp/openpilot && \
scons -j$(nproc) && \ scons -j$(nproc) && \
FILEREADER_CACHE=1 python selfdrive/test/test_valgrind_replay.py" FILEREADER_CACHE=1 python selfdrive/test/test_valgrind_replay.py"
- name: Print logs - name: Print logs
if: always() if: always()
run: | run: cat selfdrive/test/valgrind_logs.txt
docker cp tmppilot:/tmp/openpilot/selfdrive/test/valgrind_logs.txt valgrind_logs.txt
cat valgrind_logs.txt
- uses: actions/upload-artifact@v2
if: always()
continue-on-error: true
with:
name: valgrind_logs.txt
path: valgrind_logs.txt
unit_tests: unit_tests:
name: unit tests name: unit tests
@ -195,7 +183,7 @@ jobs:
run: eval "$BUILD" run: eval "$BUILD"
- name: Run unit tests - name: Run unit tests
run: | run: |
$PERSIST "cd /tmp/openpilot && \ ${{ env.RUN }} "cd /tmp/openpilot && \
scons -j$(nproc) && \ scons -j$(nproc) && \
coverage run selfdrive/test/test_fingerprints.py && \ coverage run selfdrive/test/test_fingerprints.py && \
$UNIT_TEST common && \ $UNIT_TEST common && \
@ -210,9 +198,7 @@ jobs:
$UNIT_TEST selfdrive/thermald && \ $UNIT_TEST selfdrive/thermald && \
$UNIT_TEST tools/lib/tests" $UNIT_TEST tools/lib/tests"
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
run: | run: bash <(curl -s https://codecov.io/bash) -v -F unit_tests
docker commit tmppilot tmppilotci
$CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -v -F unit_tests"
process_replay: process_replay:
name: process replay name: process replay
@ -226,31 +212,26 @@ jobs:
id: dependency-cache id: dependency-cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: /tmp/comma_download_cache
/tmp/comma_download_cache
key: ${{ hashFiles('.github/workflows/test.yaml', 'selfdrive/test/process_replay/test_processes.py') }} key: ${{ hashFiles('.github/workflows/test.yaml', 'selfdrive/test/process_replay/test_processes.py') }}
- name: Build Docker image - name: Build Docker image
run: eval "$BUILD" run: eval "$BUILD"
- name: Run replay - name: Run replay
run: | run: |
$PERSIST_WITH_CACHE "cd /tmp/openpilot && \ ${{ env.RUN }} "cd /tmp/openpilot && \
scons -j$(nproc) && \ scons -j$(nproc) && \
FILEREADER_CACHE=1 CI=1 coverage run selfdrive/test/process_replay/test_processes.py" FILEREADER_CACHE=1 CI=1 coverage run selfdrive/test/process_replay/test_processes.py"
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
run: | run: bash <(curl -s https://codecov.io/bash) -v -F process_replay
docker commit tmppilot tmppilotci
$CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -v -F process_replay"
- name: Print diff - name: Print diff
if: always() if: always()
run: | run: cat selfdrive/test/process_replay/diff.txt
docker cp tmppilot:/tmp/openpilot/selfdrive/test/process_replay/diff.txt diff.txt
cat diff.txt
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
if: always() if: always()
continue-on-error: true continue-on-error: true
with: with:
name: process_replay_diff.txt name: process_replay_diff.txt
path: diff.txt path: selfdrive/test/process_replay/diff.txt
test_longitudinal: test_longitudinal:
name: longitudinal name: longitudinal
@ -264,25 +245,20 @@ jobs:
run: eval "$BUILD" run: eval "$BUILD"
- name: Test longitudinal - name: Test longitudinal
run: | run: |
$PERSIST "mkdir -p /tmp/openpilot/selfdrive/test/out && \ ${{ env.RUN }} "mkdir -p /tmp/openpilot/selfdrive/test/out && \
cd /tmp/openpilot/ && \ cd /tmp/openpilot/ && \
scons -j$(nproc) && \ scons -j$(nproc) && \
cd selfdrive/test/longitudinal_maneuvers && \ cd selfdrive/test/longitudinal_maneuvers && \
OPTEST=1 ./test_longitudinal.py" ./test_longitudinal.py"
- name: Copy artifacts
if: always()
run: |
mkdir out
docker cp tmppilot:/tmp/openpilot/selfdrive/test/longitudinal_maneuvers/out/longitudinal/ out/
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
if: always() if: always()
continue-on-error: true continue-on-error: true
with: with:
name: longitudinal name: longitudinal
path: out path: selfdrive/test/longitudinal_maneuvers/out/longitudinal/
test_car_models: test_car_models:
name: test car models name: car models
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
timeout-minutes: 50 timeout-minutes: 50
steps: steps:
@ -293,19 +269,16 @@ jobs:
id: dependency-cache id: dependency-cache
uses: actions/cache@v2 uses: actions/cache@v2
with: with:
path: | path: /tmp/comma_download_cache
/tmp/comma_download_cache
key: ${{ hashFiles('.github/workflows/test.yaml', 'selfdrive/test/test_car_models.py') }} key: ${{ hashFiles('.github/workflows/test.yaml', 'selfdrive/test/test_car_models.py') }}
- name: Build Docker image - name: Build Docker image
run: eval "$BUILD" run: eval "$BUILD"
- name: Test car models - name: Test car models
run: | run: |
$PERSIST_WITH_CACHE "cd /tmp/openpilot && \ ${{ env.RUN }} "cd /tmp/openpilot && \
scons -j$(nproc) && \ scons -j$(nproc) && \
FILEREADER_CACHE=1 coverage run --parallel-mode -m nose --processes=4 --process-timeout=60 \ FILEREADER_CACHE=1 coverage run --parallel-mode -m nose --processes=4 --process-timeout=60 \
selfdrive/test/test_models.py && \ selfdrive/test/test_models.py && \
coverage combine" coverage combine"
- name: Upload coverage to Codecov - name: Upload coverage to Codecov
run: | run: bash <(curl -s https://codecov.io/bash) -v -F test_car_models
docker commit tmppilot tmppilotci
$CI_RUN "cd /tmp/openpilot && bash <(curl -s https://codecov.io/bash) -v -F test_car_models"

@ -23,3 +23,6 @@ COPY ./opendbc /tmp/openpilot/opendbc
COPY ./cereal /tmp/openpilot/cereal COPY ./cereal /tmp/openpilot/cereal
COPY ./panda /tmp/openpilot/panda COPY ./panda /tmp/openpilot/panda
COPY ./selfdrive /tmp/openpilot/selfdrive COPY ./selfdrive /tmp/openpilot/selfdrive
WORKDIR /tmp/openpilot
RUN scons -j$(nproc)

@ -60,4 +60,5 @@ RUN pyenv install 3.8.2 && \
pip install --no-cache-dir pipenv==2020.8.13 && \ pip install --no-cache-dir pipenv==2020.8.13 && \
cd /tmp && \ cd /tmp && \
pipenv install --system --deploy --dev --clear && \ pipenv install --system --deploy --dev --clear && \
pip uninstall torch tensorflow -y && \
pip uninstall -y pipenv pip uninstall -y pipenv

@ -76,6 +76,7 @@ class UploaderTestCase(unittest.TestCase):
uploader.Params = MockParams uploader.Params = MockParams
uploader.fake_upload = True uploader.fake_upload = True
uploader.force_wifi = True uploader.force_wifi = True
uploader.allow_sleep = False
self.seg_num = random.randint(1, 300) self.seg_num = random.randint(1, 300)
self.seg_format = "2019-04-18--12-52-54--{}" self.seg_format = "2019-04-18--12-52-54--{}"
self.seg_format2 = "2019-05-18--11-22-33--{}" self.seg_format2 = "2019-05-18--11-22-33--{}"

@ -19,6 +19,7 @@ NetworkType = log.ThermalData.NetworkType
UPLOAD_ATTR_NAME = 'user.upload' UPLOAD_ATTR_NAME = 'user.upload'
UPLOAD_ATTR_VALUE = b'1' UPLOAD_ATTR_VALUE = b'1'
allow_sleep = bool(os.getenv("UPLOADER_SLEEP", "1"))
force_wifi = os.getenv("FORCEWIFI") is not None force_wifi = os.getenv("FORCEWIFI") is not None
fake_upload = os.getenv("FAKEUPLOAD") is not None fake_upload = os.getenv("FAKEUPLOAD") is not None
@ -208,6 +209,7 @@ def uploader_fn(exit_event):
d = uploader.next_file_to_upload(with_raw=allow_raw_upload and on_wifi and offroad) d = uploader.next_file_to_upload(with_raw=allow_raw_upload and on_wifi and offroad)
if d is None: # Nothing to upload if d is None: # Nothing to upload
if allow_sleep:
time.sleep(60 if offroad else 5) time.sleep(60 if offroad else 5)
continue continue
@ -218,7 +220,7 @@ def uploader_fn(exit_event):
success = uploader.upload(key, fn) success = uploader.upload(key, fn)
if success: if success:
backoff = 0.1 backoff = 0.1
else: elif allow_sleep:
cloudlog.info("backoff %r", backoff) cloudlog.info("backoff %r", backoff)
time.sleep(backoff + random.uniform(0, backoff)) time.sleep(backoff + random.uniform(0, backoff))
backoff = min(backoff*2, 120) backoff = min(backoff*2, 120)

@ -1,6 +1,5 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
os.environ['OLD_CAN'] = '1'
os.environ['NOCRASH'] = '1' os.environ['NOCRASH'] = '1'
import unittest import unittest
@ -11,16 +10,10 @@ from selfdrive.config import Conversions as CV
from selfdrive.car.honda.values import CruiseButtons as CB from selfdrive.car.honda.values import CruiseButtons as CB
from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver from selfdrive.test.longitudinal_maneuvers.maneuver import Maneuver
import selfdrive.manager as manager import selfdrive.manager as manager
from common.file_helpers import mkdirs_exists_ok
from common.params import Params from common.params import Params
def create_dir(path):
try:
os.makedirs(path)
except OSError:
pass
def check_no_collision(log): def check_no_collision(log):
return min(log['d_rel']) > 0 return min(log['d_rel']) > 0
@ -317,7 +310,7 @@ def setup_output():
view_html += "<td><img class='maneuver_graph' src='%s'/></td>" % (os.path.join("maneuver" + str(i + 1).zfill(2), c), ) view_html += "<td><img class='maneuver_graph' src='%s'/></td>" % (os.path.join("maneuver" + str(i + 1).zfill(2), c), )
view_html += "</tr>" view_html += "</tr>"
create_dir(output_dir) mkdirs_exists_ok(output_dir)
with open(os.path.join(output_dir, "index.html"), "w") as f: with open(os.path.join(output_dir, "index.html"), "w") as f:
f.write(view_html) f.write(view_html)

@ -346,7 +346,7 @@ def python_replay_process(cfg, lr):
os.environ['FINGERPRINT'] = msg.carParams.carFingerprint os.environ['FINGERPRINT'] = msg.carParams.carFingerprint
break break
manager.prepare_managed_process(cfg.proc_name) manager.prepare_managed_process(cfg.proc_name, build=True)
mod = importlib.import_module(manager.managed_processes[cfg.proc_name]) mod = importlib.import_module(manager.managed_processes[cfg.proc_name])
thread = threading.Thread(target=mod.main, args=args) thread = threading.Thread(target=mod.main, args=args)
thread.daemon = True thread.daemon = True

@ -14,7 +14,6 @@ INJECT_MODEL = 0
segments = [ segments = [
("HONDA", "d83f36766f8012a5|2020-02-05--18-42-21--2"), # HONDA.CIVIC_BOSCH_DIESEL (BOSCH) ("HONDA", "d83f36766f8012a5|2020-02-05--18-42-21--2"), # HONDA.CIVIC_BOSCH_DIESEL (BOSCH)
("HONDA", "a74b011b32b51b56|2020-07-26--17-09-36--6"), # HONDA.CIVIC (NIDEC) ("HONDA", "a74b011b32b51b56|2020-07-26--17-09-36--6"), # HONDA.CIVIC (NIDEC)
("TOYOTA", "77611a1fac303767|2020-02-29--13-29-33--3"), # TOYOTA.COROLLA_TSS2
("TOYOTA", "b14c5b4742e6fc85|2020-10-14--11-04-47--4"), # TOYOTA.RAV4 (LQR) ("TOYOTA", "b14c5b4742e6fc85|2020-10-14--11-04-47--4"), # TOYOTA.RAV4 (LQR)
("TOYOTA", "0982d79ebb0de295|2020-10-18--19-11-36--5"), # TOYOTA.PRIUS (INDI) ("TOYOTA", "0982d79ebb0de295|2020-10-18--19-11-36--5"), # TOYOTA.PRIUS (INDI)
("CHRYSLER", "b6849f5cf2c926b1|2020-02-28--07-29-48--13"), # CHRYSLER.PACIFICA ("CHRYSLER", "b6849f5cf2c926b1|2020-02-28--07-29-48--13"), # CHRYSLER.PACIFICA
@ -170,9 +169,11 @@ if __name__ == "__main__":
f.write(diff2) f.write(diff2)
print(diff1) print(diff1)
print("TEST", "FAILED" if failed else "SUCCEEDED") if failed:
print("TEST FAILED")
print("\n\nTo update the reference logs for this test run:") print("\n\nTo update the reference logs for this test run:")
print("./update_refs.py") print("./update_refs.py")
else:
print("TEST SUCCEEDED")
sys.exit(int(failed)) sys.exit(int(failed))

@ -1,8 +1,9 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
import os import os
import unittest
import shutil import shutil
import unittest
os.environ["COMMA_CACHE"] = "/tmp/__test_cache__"
from tools.lib.url_file import URLFile, CACHE_DIR from tools.lib.url_file import URLFile, CACHE_DIR

@ -14,7 +14,7 @@ from tools.lib.file_helpers import mkdirs_exists_ok, atomic_write_in_dir
K = 1000 K = 1000
CHUNK_SIZE = 1000 * K CHUNK_SIZE = 1000 * K
CACHE_DIR = "/tmp/comma_download_cache/" CACHE_DIR = os.environ.get("COMMA_CACHE", "/tmp/comma_download_cache/")
def hash_256(link): def hash_256(link):

@ -4,24 +4,40 @@ ENV PYTHONUNBUFFERED 1
ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH} ENV PYTHONPATH /tmp/openpilot:${PYTHONPATH}
# install opencv # install opencv
RUN export OPENCV_VERSION='4.2.0' && \ ENV OPENCV_VERSION '4.2.0'
sudo apt-get -y update && \ ENV DEBIAN_FRONTEND=noninteractive
sudo apt-get install -y build-essential cmake && \ RUN apt-get update && apt-get install -y --no-install-recommends \
sudo apt-get install -y qt5-default libvtk6-dev && \ libvtk6-dev \
sudo apt-get install -y libdc1394-22-dev libavcodec-dev libavformat-dev libswscale-dev \ libdc1394-22-dev \
libtheora-dev libvorbis-dev libxvidcore-dev libx264-dev yasm \ libavcodec-dev \
libopencore-amrnb-dev libopencore-amrwb-dev libv4l-dev libxine2-dev && \ libavformat-dev \
sudo apt-get install -y libtbb-dev libeigen3-dev && \ libswscale-dev \
libtheora-dev \
libvorbis-dev \
libxvidcore-dev \
libx264-dev \
yasm \
libopencore-amrnb-dev \
libopencore-amrwb-dev \
libv4l-dev \
libxine2-dev \
libtbb-dev \
&& rm -rf /var/lib/apt/lists/* && \
mkdir /tmp/opencv_build && \
cd /tmp/opencv_build && \
wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz && \ wget https://github.com/opencv/opencv/archive/${OPENCV_VERSION}.tar.gz && \
tar -xvf ${OPENCV_VERSION}.tar.gz && rm ${OPENCV_VERSION}.tar.gz && \ tar -xvf ${OPENCV_VERSION}.tar.gz && \
mv opencv-${OPENCV_VERSION} OpenCV && \ mv opencv-${OPENCV_VERSION} OpenCV && \
cd OpenCV && mkdir build && cd build && \ cd OpenCV && mkdir build && cd build && \
cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON \ cmake -DWITH_OPENGL=ON -DFORCE_VTK=ON -DWITH_TBB=ON -DWITH_GDAL=ON \
-DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF .. && \ -DWITH_XINE=ON -DENABLE_PRECOMPILED_HEADERS=OFF .. && \
make -j8 && \ make -j8 && \
sudo make install && \ make install && \
sudo ldconfig ldconfig && \
cd /tmp && rm -rf /tmp/opencv_build
RUN mkdir -p /tmp/openpilot RUN mkdir -p /tmp/openpilot

Loading…
Cancel
Save