From 905b0885bdb1f357e4766f47e29ad42a393598bc Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Mon, 27 Feb 2023 17:09:36 -0800 Subject: [PATCH] Add basic .pre-commit-config.yaml and pre-commit.yml workflow. Preparation for importing https://github.com/pybind/pybind11_protobuf/pull/73 PiperOrigin-RevId: 512773443 --- .github/auto_assign-issues.yml | 10 ------- .github/workflows/pre-commit.yml | 17 ++++++++++++ .pre-commit-config.yaml | 46 ++++++++++++++++++++++++++++++++ scripts/build_and_run_tests.sh | 2 -- 4 files changed, 63 insertions(+), 12 deletions(-) delete mode 100644 .github/auto_assign-issues.yml create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/auto_assign-issues.yml b/.github/auto_assign-issues.yml deleted file mode 100644 index fa82a2b..0000000 --- a/.github/auto_assign-issues.yml +++ /dev/null @@ -1,10 +0,0 @@ -# https://github.com/apps/auto-assign-issues 2020-11-30+2000 - -# If enabled, auto-assigns users when a new issue is created -# Defaults to true, allows you to install the app globally, and disable on a per-repo basis -addAssignees: true - -# The list of users to assign to new issues. -# If empty or not provided, the repository owner is assigned -assignees: - - rwgk diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 0000000..39c1e65 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,17 @@ +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v4 + - uses: pre-commit/action@v3.0.0 + with: + # Slow hooks are marked with manual - slow is okay here, run them too + extra_args: --hook-stage manual --all-files diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..11b9d87 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,46 @@ +# To use: +# +# pre-commit run -a +# +# Or: +# +# pre-commit install # (runs every time you commit in git) +# +# To update this file: +# +# pre-commit autoupdate +# +# See https://github.com/pre-commit/pre-commit + + +ci: + autoupdate_commit_msg: "chore(deps): update pre-commit hooks" + autofix_commit_msg: "style: pre-commit fixes" + autoupdate_schedule: quarterly + +repos: + +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: "v4.4.0" + hooks: + - id: check-added-large-files + - id: check-case-conflict + - id: check-docstring-first + - id: check-merge-conflict + - id: check-symlinks + - id: check-toml + - id: check-yaml + - id: debug-statements + - id: end-of-file-fixer + - id: mixed-line-ending + - id: requirements-txt-fixer + - id: trailing-whitespace + exclude: \.patch?$ + +- repo: https://github.com/cheshirekow/cmake-format-precommit + rev: "v0.6.13" + hooks: + - id: cmake-format + additional_dependencies: [pyyaml] + types: [file] + files: (\.cmake|CMakeLists.txt)(.in)?$ diff --git a/scripts/build_and_run_tests.sh b/scripts/build_and_run_tests.sh index a3bf998..c232092 100755 --- a/scripts/build_and_run_tests.sh +++ b/scripts/build_and_run_tests.sh @@ -75,5 +75,3 @@ BAZEL_CXXOPTS="-std=c++17" bazel test --test_output=errors \ pybind11_protobuf/tests:pass_by_test \ pybind11_protobuf/tests:proto_enum_test \ pybind11_protobuf/tests:wrapped_proto_module_test - -