-
Notifications
You must be signed in to change notification settings - Fork 0
Pre-main #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Pre-main #5
Changes from all commits
9f2e20a
a35963f
c04bfb6
4897b1a
f8d3a1c
3b358fa
dd5b1b1
e0324cb
412699a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| name: Clang Format Check | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. лучше делать запуск только при создании PR или push в main, у вас ограниченное число runner-ов на гитхабе. не нужно делать лишние запуски |
||
|
|
||
| jobs: | ||
| clang-format: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y clang-format | ||
|
|
||
| - name: Configure CMake | ||
| run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
|
|
||
| - name: Run Clang Format | ||
| run: | | ||
| find include source -name '*.cpp' -o -name '*.hpp' | xargs clang-format -i | ||
| git diff --exit-code || (echo "Clang format check failed! Run clang-format and commit changes."; exit 1) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| name: Static Analysis Checks | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. аналогично про push в main и pr |
||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: . | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. это не нужно? |
||
|
|
||
| jobs: | ||
| install-deps: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y clang-tidy | ||
|
|
||
| - name: Configure CMake | ||
| run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
|
|
||
|
|
||
| clang-tidy: | ||
| needs: install-deps | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v3 | ||
|
|
||
| - name: Restore Cached Build | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. убрать кеши |
||
| uses: actions/cache@v3 | ||
| with: | ||
| path: build | ||
| key: ${{ runner.os }}-build-${{ github.sha }} | ||
|
|
||
| - name: Run Clang Tidy | ||
| run: | | ||
| clang-tidy source/*.cpp include/*.hpp | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| name: CppCheck Analysis | ||
|
|
||
| on: | ||
| push: | ||
| branches: | ||
| - main | ||
| pull_request: | ||
| branches: | ||
| - '**' | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. аналогично |
||
|
|
||
| jobs: | ||
| cppcheck: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Install dependencies | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y cppcheck | ||
|
|
||
| - name: Configure CMake | ||
| run: cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON | ||
|
|
||
| - name: Run CppCheck | ||
| run: | | ||
| cppcheck --enable=all --inconclusive --quiet --error-exitcode=1 source/ include/ | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,18 @@ | ||
| # IDEs and editors | ||
| .idea/ | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. gitignore лучше держать в отсортированном виде. можно оставить комментарии на разделы к чему какие файлы относятся |
||
| .vscode/ | ||
|
|
||
| # Build directories | ||
| build/ | ||
|
|
||
| # Prerequisites | ||
| *.d | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. что это за расширение? оно надо? |
||
|
|
||
| # Compiled Object files | ||
| *.slo | ||
| *.lo | ||
| *.o | ||
| *.obj | ||
| *.slo | ||
| *.lo | ||
|
|
||
| # Precompiled Headers | ||
| *.gch | ||
|
|
@@ -23,10 +28,10 @@ build/ | |
| *.smod | ||
|
|
||
| # Compiled Static libraries | ||
| *.lai | ||
| *.la | ||
| *.a | ||
| *.lib | ||
| *.lai | ||
| *.la | ||
|
|
||
| # Executables | ||
| *.exe | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. давай пока нет исходного кода оставим только нужное, дальше в комментариях |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,31 +1,22 @@ | ||||||
| cmake_minimum_required(VERSION 3.10) | ||||||
| project(TelegramBot) | ||||||
| cmake_minimum_required(VERSION 3.14 FATAL_ERROR) | ||||||
|
|
||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. добавь комментарии заголовков для разделов CMake |
||||||
| project(MyProject LANGUAGES CXX) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
|
|
||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Сделай здесь защиту от дурака, чтобы нельзя было собрать бинарники в директории с сурсами, это есть здесь https://github.com/TheLartians/ModernCppStarter/blob/5115efe66a630f1b25fe51742a7a484e08d0a365/CMakeLists.txt#L14 |
||||||
| set(CMAKE_CXX_STANDARD 20) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. не нужно, ты уже устанвливаешь настройку в 19 строчке для target-а. |
||||||
| set(CMAKE_CXX_STANDARD_REQUIRED ON) | ||||||
| set(CMAKE_CXX_EXTENSIONS OFF) | ||||||
| set(CMAKE_EXPORT_COMPILE_COMMANDS ON) | ||||||
|
|
||||||
| find_package(Boost REQUIRED COMPONENTS system) | ||||||
| find_package(TgBot REQUIRED) | ||||||
| include(cmake/CPM.cmake) | ||||||
|
|
||||||
| target_include_directories(include) | ||||||
|
|
||||||
| file(GLOB SOURCES source/*.cpp) | ||||||
| # ---- Add source files ---- | ||||||
| # Note: globbing sources is considered bad practice as CMake's generators may not detect new files | ||||||
| # automatically. Keep that in mind when changing files, or explicitly mention them here. | ||||||
| file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") | ||||||
| file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp") | ||||||
|
|
||||||
| add_executable(my_bot ${SOURCES}) | ||||||
| add_library(${PROJECT_NAME} ${headers} ${sources}) | ||||||
|
|
||||||
| target_link_libraries(my_bot Boost::system TgBot::TgBot) | ||||||
| set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20 OUTPUT_NAME "MyApp") | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OTPUT_NAME зачем? |
||||||
|
|
||||||
| target_include_directories(${PROJECT_NAME} PUBLIC include) | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||
|
|
||||||
| if(CMAKE_BUILD_TYPE STREQUAL "Debug") | ||||||
| target_compile_options(my_bot PRIVATE | ||||||
| -g | ||||||
| -fsanitize=address,undefined | ||||||
| -fno-omit-frame-pointer | ||||||
| ) | ||||||
| target_link_options(my_bot PRIVATE | ||||||
| -fsanitize=address,undefined | ||||||
| -fno-omit-frame-pointer | ||||||
| ) | ||||||
| endif() | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2025 Melnikov Kirill | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,10 +23,6 @@ git clone git@github.com:EntryPoint-C-project/EntryPoint.git | |
| cd EntryPoint | ||
| # You need to make a telegram-bot token | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. лучше одной командой. и клонировать репозиторий и перейти в него это spoon-feeding, лучше не надо. Давай так: |
||
| mkdir build && cd build | ||
| cmake -G Ninja -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .. # Enable clang-tidy support | ||
| cmake -G Ninja .. | ||
| ninja | ||
| ``` | ||
| ### 🔹 2. Running clang-tidy | ||
| ```sh | ||
| run-clang-tidy -p build/ | ||
| ``` | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors | ||
|
|
||
| set(CPM_DOWNLOAD_VERSION 0.40.7) | ||
| set(CPM_HASH_SUM "c0fc82149e00c43a21febe7b2ca57b2ffea2b8e88ab867022c21d6b81937eb50") | ||
|
|
||
| if(CPM_SOURCE_CACHE) | ||
| set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
| elseif(DEFINED ENV{CPM_SOURCE_CACHE}) | ||
| set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
| else() | ||
| set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") | ||
| endif() | ||
|
|
||
| # Expand relative path. This is important if the provided path contains a tilde (~) | ||
| get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) | ||
|
|
||
| file(DOWNLOAD | ||
| https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake | ||
| ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} | ||
| ) | ||
|
|
||
| include(${CPM_DOWNLOAD_LOCATION}) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. давай здесь тоже последнюю строчку добавим чтоб гитхаб не ругался |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавляй пустые строчки в конце файлов - так должно быть по POSIX, гитхаб будет всегда на это ругаться