From 7a07b5a4af9c44af7768107cb55b32622aa3656c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kacper=20R=C4=85czy?= Date: Wed, 14 May 2025 14:26:25 -0700 Subject: [PATCH] Setup TARGET_GIT_REF --- .github/workflows/selfdrive_tests.yaml | 2 ++ selfdrive/test/process_replay/test_log_compat.py | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/selfdrive_tests.yaml b/.github/workflows/selfdrive_tests.yaml index 3edb6c2981..846a851221 100644 --- a/.github/workflows/selfdrive_tests.yaml +++ b/.github/workflows/selfdrive_tests.yaml @@ -152,6 +152,8 @@ jobs: ./selfdrive/ui/tests/create_test_translations.sh && \ QT_QPA_PLATFORM=offscreen ./selfdrive/ui/tests/test_translations && \ chmod -R 777 /tmp/comma_download_cache" + env: + TARGET_GIT_REF: ${{ github.event_name == 'pull_request' && github.base_ref || github.event.before }} - name: "Upload coverage to Codecov" uses: codecov/codecov-action@v4 with: diff --git a/selfdrive/test/process_replay/test_log_compat.py b/selfdrive/test/process_replay/test_log_compat.py index c28accdf5c..704950042c 100644 --- a/selfdrive/test/process_replay/test_log_compat.py +++ b/selfdrive/test/process_replay/test_log_compat.py @@ -11,7 +11,7 @@ from openpilot.tools.lib.logreader import LogReader from openpilot.common.run import run_cmd MAX_EXAMPLES = int(os.environ.get("MAX_EXAMPLES", "2")) -TARGET_REF = os.environ.get("TARGET_REF", "") +TARGET_GIT_REF = os.environ.get("TARGET_GIT_REF", "origin/master") @pytest.fixture(scope="module") @@ -19,7 +19,7 @@ def parent_schema_file(tmp_path_factory): tmp_dir = tmp_path_factory.mktemp("cereal") # TODO this will fail if the any capnp files are added/removed vs what was on the parent commit - commit = run_cmd(["git", "rev-parse", TARGET_REF]) if TARGET_REF else run_cmd(["git", "merge-base", "origin/master", "HEAD"]) + commit = run_cmd(["git", "rev-parse", TARGET_GIT_REF]) opendbc_commit = run_cmd(["git", "ls-tree", "--object-only", commit, "opendbc_repo"]) # for car.capnp for capnp_fp in glob(os.path.join(CEREAL_PATH, "**", "*.capnp"), recursive=True): fname = os.path.relpath(capnp_fp, CEREAL_PATH)