From b67bba590d9c68fda3640213204387e39a9ab0d5 Mon Sep 17 00:00:00 2001 From: jackie-pc <136611113+jackie-pc@users.noreply.github.com> Date: Fri, 28 Jul 2023 17:39:40 -0700 Subject: [PATCH] CI: separate pre-commit github action job (#1457) --- .github/workflows/build.yml | 4 ---- .github/workflows/pre-commit.yml | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f346abbe1..74f1a7115 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,8 +26,4 @@ jobs: shell: bash create-venv-at-path: .venv - run: poetry run pytest tests --cov --no-cov-on-fail --cov-report= - - run: poetry run pyright reflex tests - - run: poetry run ruff check . --format github - - run: find reflex tests -name "*.py" -not -path reflex/reflex.py | xargs poetry run darglint - - run: poetry run black --check reflex tests - run: poetry run coverage html diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..50bb9bc24 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,28 @@ +name: pre-commit + +on: + pull_request: + branches: [main] + push: + # Note even though this job is called "pre-commit" and runs "pre-commit", this job will run + # also POST-commit on main also! In case there are mishandled merge conflicts / bad auto-resolves + # when merging into main branch. + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup_build_env + with: + # running vs. one version of Python is OK + # i.e. ruff, black, etc. + python-version: 3.11 + run-poetry-install: true + shell: bash + create-venv-at-path: .venv + # TODO pre-commit related stuff can be cached too (not a bottleneck yet) + - run: | + poetry run pip install pre-commit + poetry run pre-commit run --all-files