From cd61e17f3cdfbd726d34430d067e4f8a0eafc55c Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Wed, 31 Jul 2024 21:14:59 -0700 Subject: [PATCH] new docker image structure (#1070) * new structure * fix that --- .github/workflows/tests.yml | 12 +++--------- Dockerfile | 12 +++++++----- 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7db8acdb30..711059405b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -3,7 +3,7 @@ name: tests on: [push, pull_request] env: - RUN: docker run -v $GITHUB_WORKSPACE:/project/opendbc -w /project/opendbc -e PYTHONWARNINGS="error,default::DeprecationWarning" --shm-size 1G --rm opendbc /bin/bash -c + 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 @@ -19,10 +19,8 @@ jobs: - uses: actions/checkout@v4 - name: Build Docker image run: eval "$BUILD" - - name: Build opendbc - run: ${{ env.RUN }} "cd ../ && scons -j$(nproc) --minimal" - name: Unit tests - run: ${{ env.RUN }} "pytest -n logical" + run: ${{ env.RUN }} "pytest -n logical --durations=0" static-analysis: name: static analysis @@ -31,13 +29,9 @@ jobs: - uses: actions/checkout@v4 - name: Build Docker image run: eval "$BUILD" - - name: Build opendbc - run: ${{ env.RUN }} "cd ../ && scons -j$(nproc) --minimal" - name: pre-commit # TODO: a package pre-commit installs has a warning, remove the unset once that's fixed - run: ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all" - - name: Generator test - run: ${{ env.RUN }} "generator/test_generator.py" + run: ${{ env.RUN }} "git init && git add -A && unset PYTHONWARNINGS && pre-commit run --all" docker-push: name: docker push diff --git a/Dockerfile b/Dockerfile index f11ed990b1..1bc9a74207 100644 --- a/Dockerfile +++ b/Dockerfile @@ -39,11 +39,13 @@ COPY requirements.txt /tmp/ RUN pip3 install --break-system-packages --no-cache-dir -r /tmp/requirements.txt RUN pip3 install --break-system-packages --no-cache-dir pre-commit==2.15.0 pylint==2.17.4 +WORKDIR /project/opendbc ENV PYTHONPATH=/project -RUN git config --global --add safe.directory '*' - -WORKDIR /project - -COPY SConstruct . +COPY . . +COPY SConstruct /project COPY ./site_scons /project/site_scons +COPY .gitignore /project/.gitignore + +RUN ls && rm -rf .git && cd ../ && \ + scons -c && scons -j$(nproc) \