CI: enable PYTHONWARNINGS=error (#29364)

* CI: enable PYTHONWARNINGS=error

* fixes

* more ignore

* more modeld ignore
old-commit-hash: b11b14aff8
beeps
Adeeb Shihadeh 2 years ago committed by GitHub
parent 029782b481
commit e76af64065
  1. 20
      .github/workflows/selfdrive_tests.yaml
  2. 2
      Jenkinsfile
  3. 10
      tools/lib/framereader.py

@ -11,6 +11,8 @@ concurrency:
cancel-in-progress: true cancel-in-progress: true
env: env:
PYTHONWARNINGS: error
BASE_IMAGE: openpilot-base BASE_IMAGE: openpilot-base
CL_BASE_IMAGE: openpilot-base-cl CL_BASE_IMAGE: openpilot-base-cl
DOCKER_REGISTRY: ghcr.io/commaai DOCKER_REGISTRY: ghcr.io/commaai
@ -20,11 +22,11 @@ env:
BUILD: | BUILD: |
DOCKER_BUILDKIT=1 docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $BASE_IMAGE:latest -f Dockerfile.openpilot_base . DOCKER_BUILDKIT=1 docker build --pull --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $DOCKER_REGISTRY/$BASE_IMAGE:latest -t $BASE_IMAGE:latest -f Dockerfile.openpilot_base .
RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v ~/scons_cache:/tmp/scons_cache -v ~/comma_download_cache:/tmp/comma_download_cache -v ~/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c RUN: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e FILEREADER_CACHE=1 -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v ~/scons_cache:/tmp/scons_cache -v ~/comma_download_cache:/tmp/comma_download_cache -v ~/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/sh -c
BUILD_CL: | BUILD_CL: |
DOCKER_BUILDKIT=1 docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $CL_BASE_IMAGE:latest -f Dockerfile.openpilot_base_cl . DOCKER_BUILDKIT=1 docker build --build-arg BUILDKIT_INLINE_CACHE=1 --cache-from $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $DOCKER_REGISTRY/$CL_BASE_IMAGE:latest -t $CL_BASE_IMAGE:latest -f Dockerfile.openpilot_base_cl .
RUN_CL: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v ~/scons_cache:/tmp/scons_cache -v ~/comma_download_cache:/tmp/comma_download_cache -v ~/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c RUN_CL: docker run --shm-size 1G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e PYTHONWARNINGS=error -e PYTHONPATH=/tmp/openpilot -e NUM_JOBS -e JOB_ID -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID -v ~/scons_cache:/tmp/scons_cache -v ~/comma_download_cache:/tmp/comma_download_cache -v ~/openpilot_cache:/tmp/openpilot_cache $CL_BASE_IMAGE /bin/sh -c
UNIT_TEST: coverage run --append -m unittest discover UNIT_TEST: coverage run --append -m unittest discover
@ -66,7 +68,7 @@ jobs:
cp pyproject.toml $STRIPPED_DIR cp pyproject.toml $STRIPPED_DIR
cp poetry.lock $STRIPPED_DIR cp poetry.lock $STRIPPED_DIR
cd $STRIPPED_DIR cd $STRIPPED_DIR
${{ env.RUN }} "pre-commit run --all" ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all"
build_all: build_all:
name: build all name: build all
@ -142,6 +144,9 @@ jobs:
- name: Install dependencies - name: Install dependencies
if: steps.dependency-cache.outputs.cache-hit != 'true' if: steps.dependency-cache.outputs.cache-hit != 'true'
run: ./tools/mac_setup.sh run: ./tools/mac_setup.sh
env:
# package install has DeprecationWarnings
PYTHONWARNINGS: default
- name: Build openpilot - name: Build openpilot
run: | run: |
source tools/openpilot_env.sh source tools/openpilot_env.sh
@ -214,7 +219,7 @@ jobs:
run: eval "$BUILD" run: eval "$BUILD"
- name: pre-commit - name: pre-commit
timeout-minutes: 4 timeout-minutes: 4
run: ${{ env.RUN }} "pre-commit run --all" run: ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all"
valgrind: valgrind:
name: valgrind name: valgrind
@ -337,15 +342,18 @@ jobs:
- name: Build openpilot - name: Build openpilot
run: | run: |
${{ env.RUN }} "scons -j$(nproc)" ${{ env.RUN }} "scons -j$(nproc)"
# PYTHONWARNINGS triggers a SyntaxError in onnxruntime
- name: Run model replay with ONNX - name: Run model replay with ONNX
timeout-minutes: 2 timeout-minutes: 2
run: | run: |
${{ env.RUN_CL }} "ONNXCPU=1 CI=1 NO_NAV=1 coverage run selfdrive/test/process_replay/model_replay.py && \ ${{ env.RUN_CL }} "unset PYTHONWARNINGS && \
ONNXCPU=1 CI=1 NO_NAV=1 coverage run selfdrive/test/process_replay/model_replay.py && \
coverage xml" coverage xml"
- name: Run unit tests - name: Run unit tests
timeout-minutes: 4 timeout-minutes: 4
run: | run: |
${{ env.RUN_CL }} "$UNIT_TEST selfdrive/modeld && \ ${{ env.RUN_CL }} "unset PYTHONWARNINGS && \
$UNIT_TEST selfdrive/modeld && \
coverage xml" coverage xml"
- name: "Upload coverage to Codecov" - name: "Upload coverage to Codecov"
uses: codecov/codecov-action@v3 uses: codecov/codecov-action@v3

2
Jenkinsfile vendored

@ -6,6 +6,7 @@ ssh -tt -o StrictHostKeyChecking=no -i ${key_file} 'comma@${ip}' /usr/bin/bash <
set -e set -e
export CI=1 export CI=1
export PYTHONWARNINGS=error
export LOGPRINT=debug export LOGPRINT=debug
export TEST_DIR=${env.TEST_DIR} export TEST_DIR=${env.TEST_DIR}
export SOURCE_DIR=${env.SOURCE_DIR} export SOURCE_DIR=${env.SOURCE_DIR}
@ -65,6 +66,7 @@ pipeline {
agent none agent none
environment { environment {
CI = "1" CI = "1"
PYTHONWARNINGS = "error"
TEST_DIR = "/data/openpilot" TEST_DIR = "/data/openpilot"
SOURCE_DIR = "/data/openpilot_source/" SOURCE_DIR = "/data/openpilot_source/"
AZURE_TOKEN = credentials('azure_token') AZURE_TOKEN = credentials('azure_token')

@ -80,7 +80,7 @@ def vidindex(fn, typ):
vidindex_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "vidindex") vidindex_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)), "vidindex")
vidindex = os.path.join(vidindex_dir, "vidindex") vidindex = os.path.join(vidindex_dir, "vidindex")
subprocess.check_call(["make"], cwd=vidindex_dir, stdout=open("/dev/null", "w")) subprocess.check_call(["make"], cwd=vidindex_dir, stdout=subprocess.DEVNULL)
with tempfile.NamedTemporaryFile() as prefix_f, \ with tempfile.NamedTemporaryFile() as prefix_f, \
tempfile.NamedTemporaryFile() as index_f: tempfile.NamedTemporaryFile() as index_f:
@ -237,8 +237,7 @@ def decompress_video_data(rawdat, vid_fmt, w, h, pix_fmt):
threads = os.getenv("FFMPEG_THREADS", "0") threads = os.getenv("FFMPEG_THREADS", "0")
cuda = os.getenv("FFMPEG_CUDA", "0") == "1" cuda = os.getenv("FFMPEG_CUDA", "0") == "1"
proc = subprocess.Popen( args = ["ffmpeg",
["ffmpeg",
"-threads", threads, "-threads", threads,
"-hwaccel", "none" if not cuda else "cuda", "-hwaccel", "none" if not cuda else "cuda",
"-c:v", "hevc", "-c:v", "hevc",
@ -249,9 +248,8 @@ def decompress_video_data(rawdat, vid_fmt, w, h, pix_fmt):
"-threads", threads, "-threads", threads,
"-f", "rawvideo", "-f", "rawvideo",
"-pix_fmt", pix_fmt, "-pix_fmt", pix_fmt,
"pipe:1"], "pipe:1"]
stdin=tmpf, stdout=subprocess.PIPE, stderr=open("/dev/null")) with subprocess.Popen(args, stdin=tmpf, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL) as proc:
# dat = proc.communicate()[0] # dat = proc.communicate()[0]
dat = proc.stdout.read() dat = proc.stdout.read()
if proc.wait() != 0: if proc.wait() != 0:

Loading…
Cancel
Save