-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #12 from liwuhen/feat-dev
chore: add pre-commit action
- Loading branch information
Showing
82 changed files
with
3,261 additions
and
3,095 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Run the following command to reformat a file: | ||
# clang-format -i -style=Google <file> | ||
# Or use clang-format-diff to only reformat the changed lines: | ||
# https://clang.llvm.org/docs/ClangFormat.html | ||
BasedOnStyle: Google | ||
DerivePointerAlignment: false | ||
ColumnLimit: 100 | ||
PointerAlignment: Left |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
|
||
name: Format | ||
|
||
on: | ||
pull_request: | ||
branches: ["main"] | ||
# Runs on pushes targeting the default branch | ||
push: | ||
branches: ["main"] | ||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
pre-commit: | ||
name: Format | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.x" | ||
- uses: pre-commit/action@v3.0.1 | ||
with: | ||
# Slow hooks are marked with manual - slow is okay here, run them too | ||
extra_args: --hook-stage manual --all-file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
|
||
name: Lint | ||
|
||
on: | ||
push: | ||
branches: ["main"] | ||
pull_request: | ||
branches: ["main"] | ||
workflow_dispatch: | ||
|
||
permissions: # set top-level default permissions as security best practice | ||
contents: read | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name == 'workflow_dispatch' }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
optional-lint: | ||
name: Optional Lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4.2.2 # v4.2.2 | ||
- name: misspell # Check spellings as well | ||
uses: reviewdog/action-misspell@v1.23.0 # v1.23.0 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
locale: "US" | ||
reporter: github-pr-check | ||
level: info | ||
filter_mode: diff_context | ||
exclude: | | ||
./docs/hpcdoc/source/_static/* | ||
- name: shellcheck # Static check shell scripts | ||
uses: reviewdog/action-shellcheck@v1.27.0 # v1.27.0 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-check | ||
level: info | ||
filter_mode: diff_context | ||
- name: cpplint # Static check C++ code | ||
uses: reviewdog/action-cpplint@v1.8.0 # v1.8.0 | ||
with: | ||
github_token: ${{ secrets.github_token }} | ||
reporter: github-pr-check | ||
level: warning | ||
flags: --linelength=120 | ||
filter: "-runtime/references,\ | ||
-build/include,\ | ||
-build/namespaces,\ | ||
-build/header_guard,\ | ||
-whitespace/line_length,\ | ||
-whitespace/indent_namespace,\ | ||
-runtime/string" # Ignore runtime checks on string usage. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# Pre-commit hook | ||
# See documentation at: https://pre-commit.com/ | ||
# | ||
# Pre-commit hook to run the sanity checks from Jenkins locally. | ||
# | ||
# Requirements: | ||
# - How to configure: | ||
# - $ pip install pre-commit | ||
# - $ pre-commit install --hook-type pre-push | ||
# - How to prevent running it: | ||
# - git options: --no-verify or -n | ||
# - $ git commit -n -m "YOUR COMMIT MESSAGE" | ||
# - How to run it as standalone | ||
# - $ pre-commit run | ||
# | ||
|
||
ci: | ||
autoupdate_commit_msg: "chore(deps): update pre-commit hooks" | ||
autofix_commit_msg: "style: pre-commit fixes" | ||
autoupdate_schedule: monthly | ||
|
||
repos: | ||
|
||
# # Clang format the codebase automatically | ||
# - repo: https://github.com/pre-commit/mirrors-clang-format | ||
# rev: "v14.0.6" | ||
# hooks: | ||
# - id: clang-format | ||
# types_or: [c++, c, cuda] | ||
|
||
# Check static types with mypy | ||
- repo: https://github.com/pre-commit/mirrors-mypy | ||
rev: "v1.11.2" | ||
hooks: | ||
- id: mypy | ||
args: [] | ||
exclude: ^(tests|docs)/ | ||
additional_dependencies: | ||
- markdown-it-py | ||
- nox | ||
- rich | ||
- types-setuptools | ||
|
||
# CMake formatting | ||
- 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)?$ | ||
|
||
# Standard hooks | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: "v4.6.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 | ||
|
||
# Also code format the docs | ||
- repo: https://github.com/adamchainz/blacken-docs | ||
rev: "1.18.0" | ||
hooks: | ||
- id: blacken-docs | ||
additional_dependencies: | ||
- black==23.* | ||
|
||
# Changes tabs to spaces | ||
- repo: https://github.com/Lucas-C/pre-commit-hooks | ||
rev: "v1.5.5" | ||
hooks: | ||
- id: remove-tabs | ||
|
||
# Avoid directional quotes | ||
- repo: https://github.com/sirosen/texthooks | ||
rev: "0.6.7" | ||
hooks: | ||
- id: fix-ligatures | ||
- id: fix-smartquotes | ||
|
||
# Checking for common mistakes | ||
- repo: https://github.com/pre-commit/pygrep-hooks | ||
rev: "v1.10.0" | ||
hooks: | ||
- id: rst-backticks | ||
- id: rst-directive-colons | ||
- id: rst-inline-touching-normal | ||
|
||
# Check for spelling | ||
# Use tools/codespell_ignore_lines_from_errors.py | ||
# to rebuild .codespell-ignore-lines | ||
- repo: https://github.com/codespell-project/codespell | ||
rev: "v2.1.0" | ||
hooks: | ||
- id: codespell | ||
exclude: "docs/hpcdoc/source/_static" | ||
args: ["-Lccompiler,intstruct"] | ||
|
||
# Check schemas on some of our YAML files | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.29.2 | ||
hooks: | ||
- id: check-readthedocs | ||
- id: check-github-workflows | ||
- id: check-dependabot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ | |
} | ||
], | ||
"version": 4 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ | |
// "preLaunchTask": "ReBuild" | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -97,4 +97,4 @@ | |
"slist": "cpp", | ||
"*.in": "cpp" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,4 +13,4 @@ | |
"args": ["-g", "-G", "-o0", "${workspaceFolder}/src/main.cpp", "${file}"] | ||
} | ||
] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,32 @@ | ||
cmake_minimum_required(VERSION 3.10.2) | ||
|
||
option(ENABLE_CROSSCOMPILE "Enable crosscomplile for arm platform" OFF) | ||
option(MODEL_FLAG "Enable crosscomplile model type") | ||
set(MODEL_FLAG | ||
"default" | ||
CACHE STRING "Model configuration flag") | ||
|
||
add_definitions("-Wall -g") | ||
add_compile_options(-std=c++11) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_BUILD_TYPE Debug) | ||
set(CMAKE_PATH ${CMAKE_CURRENT_LIST_DIR}) | ||
|
||
include(${CMAKE_CURRENT_LIST_DIR}/cmake/third_library.cmake) | ||
|
||
if(${ENABLE_CROSSCOMPILE}) | ||
include(${CMAKE_PATH}/platforms/linux/arm-toolchain.cmake) | ||
include(${CMAKE_PATH}/platforms/linux/arm-toolchain.cmake) | ||
endif() | ||
|
||
configure_file( | ||
"${CMAKE_CURRENT_LIST_DIR}/modules/common/utils/std_cmake.h.in" | ||
"${CMAKE_CURRENT_LIST_DIR}/modules/common/utils/std_cmake.h" | ||
) | ||
|
||
configure_file("${CMAKE_CURRENT_LIST_DIR}/modules/common/utils/std_cmake.h.in" | ||
"${CMAKE_CURRENT_LIST_DIR}/modules/common/utils/std_cmake.h") | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_LIST_DIR}/modules | ||
${CMAKE_CURRENT_LIST_DIR}/modules/app_yolo | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/utils | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/logging | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/msg_img | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/msg_enum | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/msg_struct | ||
) | ||
${CMAKE_CURRENT_LIST_DIR}/modules | ||
${CMAKE_CURRENT_LIST_DIR}/modules/app_yolo | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/utils | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/logging | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/msg_img | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/msg_enum | ||
${CMAKE_CURRENT_LIST_DIR}/modules/common/msg_struct) | ||
|
||
add_subdirectory(modules/app_yolo) | ||
add_subdirectory(test/${MODEL_FLAG}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.