Skip to content

Commit

Permalink
remove pre-commit (explorations) (commaai#33172)
Browse files Browse the repository at this point in the history
* remove pre-commit (explorations)

* lint.sh

* remove rest

* add to release files

* no source

* 1min is all you need
  • Loading branch information
adeebshihadeh authored Aug 2, 2024
1 parent 4b11c9e commit 13511e3
Show file tree
Hide file tree
Showing 12 changed files with 101 additions and 291 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/repo-maintenance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,17 +46,13 @@ jobs:
python3 -m ensurepip --upgrade
pip3 install uv
uv lock --upgrade
- name: pre-commit autoupdate
run: |
git config --global --add safe.directory '*'
pre-commit autoupdate
- name: Create Pull Request
uses: peter-evans/create-pull-request@9153d834b60caba6d51c9b9510b087acf9f33f83
with:
author: Vehicle Researcher <[email protected]>
token: ${{ secrets.ACTIONS_CREATE_PR_PAT }}
commit-message: Update Python packages and pre-commit hooks
title: '[bot] Update Python packages and pre-commit hooks'
commit-message: Update Python packages
title: '[bot] Update Python packages'
branch: auto-package-updates
base: master
delete-branch: true
Expand Down
17 changes: 7 additions & 10 deletions .github/workflows/selfdrive_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ env:
DOCKER_LOGIN: docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
BUILD: selfdrive/test/docker_build.sh base

RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -e PRE_COMMIT_HOME=/tmp/pre-commit -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 $GITHUB_WORKSPACE/.ci_cache/pre-commit:/tmp/pre-commit -v $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c
RUN: docker run --shm-size 2G -v $PWD:/tmp/openpilot -w /tmp/openpilot -e CI=1 -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 $GITHUB_WORKSPACE/.ci_cache/scons_cache:/tmp/scons_cache -v $GITHUB_WORKSPACE/.ci_cache/comma_download_cache:/tmp/comma_download_cache -v $GITHUB_WORKSPACE/.ci_cache/openpilot_cache:/tmp/openpilot_cache $BASE_IMAGE /bin/bash -c

PYTEST: pytest --continue-on-collection-errors --cov --cov-report=xml --cov-append --durations=0 --durations-min=5 --hypothesis-seed 0 -n logical

Expand All @@ -45,7 +45,6 @@ jobs:
- name: Build devel
timeout-minutes: 1
run: TARGET_DIR=$STRIPPED_DIR release/build_devel.sh
- uses: ./.github/workflows/setup-pre-commit
- uses: ./.github/workflows/setup-with-retry
- name: Check submodules
if: github.ref == 'refs/heads/master' && github.repository == 'commaai/openpilot'
Expand All @@ -62,14 +61,13 @@ jobs:
cd $STRIPPED_DIR
${{ env.RUN }} "release/check-dirty.sh && \
MAX_EXAMPLES=5 $PYTEST -m 'not slow' selfdrive/car"
- name: pre-commit
timeout-minutes: 3
- name: static analysis
timeout-minutes: 1
run: |
cd $GITHUB_WORKSPACE
cp .pre-commit-config.yaml $STRIPPED_DIR
cp pyproject.toml $STRIPPED_DIR
cd $STRIPPED_DIR
${{ env.RUN }} "unset PYTHONWARNINGS && SKIP=check-added-large-files,check-hooks-apply,check-useless-excludes pre-commit run --all && chmod -R 777 /tmp/pre-commit"
${{ env.RUN }} "scripts/lint.sh"
build:
strategy:
Expand Down Expand Up @@ -146,13 +144,12 @@ jobs:
- uses: actions/checkout@v4
with:
submodules: true
- uses: ./.github/workflows/setup-pre-commit
- uses: ./.github/workflows/setup-with-retry
- name: Build openpilot
run: ${{ env.RUN }} "scons -j$(nproc)"
- name: pre-commit
timeout-minutes: 4
run: ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all && chmod -R 777 /tmp/pre-commit"
- name: static analysis
timeout-minutes: 1
run: ${{ env.RUN }} "scripts/lint.sh"

unit_tests:
name: unit tests
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/setup-pre-commit/action.yaml

This file was deleted.

105 changes: 0 additions & 105 deletions .pre-commit-config.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion docs/WORKFLOW.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pytest
cd system/loggerd && pytest .

# run the linter
pre-commit run --all
op lint
```

## Testing
Expand Down
11 changes: 9 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ testing = [
"hypothesis ==6.47.*",
"import-linter",
"mypy",
"pre-commit",
"pytest",
"pytest-cov",
"pytest-cpp",
Expand All @@ -87,7 +86,8 @@ testing = [
"pytest-asyncio",
"pytest-mock",
"pytest-repeat",
"ruff"
"ruff",
"codespell",
]

dev = [
Expand Down Expand Up @@ -164,6 +164,13 @@ testpaths = [
"cereal/messaging/tests",
]

[tool.codespell]
count = true
quiet-level = 3
# if you've got a short variable name that's getting flagged, add it here
ignore-words-list = "bu,ro,te,ue,alo,hda,ois,nam,nams,ned,som,parm,setts,inout,warmup,bumb,nd,sie,preints,whit,indexIn"
builtin = "clear,rare,informal,usage,code,names,en-GB_to_en-US"

[tool.mypy]
python_version = "3.11"
plugins = [
Expand Down
1 change: 0 additions & 1 deletion release/release_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
"selfdrive/car/tests/test_models.*",

"^tools/",
"^scripts/",
"^tinygrad_repo/",

"matlab.*.md",
Expand Down
10 changes: 10 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/bash
set -e

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )"
cd $DIR/../

# TODO: bring back rest of pre-commit checks:
# https://github.com/commaai/openpilot/blob/4b11c9e914707df9def598616995be2a5d355a6a/.pre-commit-config.yaml#L2

ruff check .
7 changes: 0 additions & 7 deletions scripts/pyupgrade.sh

This file was deleted.

6 changes: 0 additions & 6 deletions tools/install_python_dependencies.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,3 @@ if [[ "$(uname)" == 'Darwin' ]]; then
echo "export ZMQ=1" >> $ROOT/.env
echo "export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES" >> $ROOT/.env
fi

if [ "$(uname)" != "Darwin" ] && [ -e "$ROOT/.git" ]; then
echo "pre-commit hooks install..."
pre-commit install
git submodule foreach pre-commit install
fi
4 changes: 2 additions & 2 deletions tools/op.sh
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function op_juggle() {

function op_lint() {
op_before_cmd
op_run_command pre-commit run --all $@
op_run_command scripts/lint.sh $@
}

function op_test() {
Expand Down Expand Up @@ -272,7 +272,7 @@ function op_default() {
echo -e " ${BOLD}juggle${NC} Run Plotjuggler"
echo -e " ${BOLD}replay${NC} Run replay"
echo -e " ${BOLD}cabana${NC} Run cabana"
echo -e " ${BOLD}lint${NC} Run all the pre-commit checks"
echo -e " ${BOLD}lint${NC} Run the linter"
echo -e " ${BOLD}test${NC} Run all unit tests from pytest"
echo -e " ${BOLD}help${NC} Show this message"
echo -e " ${BOLD}install${NC} Install the 'op' tool system wide"
Expand Down
Loading

0 comments on commit 13511e3

Please sign in to comment.