From b1f32ab0f5073159f48871388190624dbab246f5 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Tue, 26 Nov 2024 21:45:54 -0600 Subject: [PATCH 1/9] Clang format check --- .github/workflows/clang-format-check.yml | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/clang-format-check.yml diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml new file mode 100644 index 00000000..8fe8c790 --- /dev/null +++ b/.github/workflows/clang-format-check.yml @@ -0,0 +1,30 @@ +name: clang-format-check + +on: + workflow_dispatch: + pull_request: + branches: + - 'develop' + +concurrency: + # Cancel in-progress jobs for the same pull request + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + format: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + path: source + submodules: false + + - name: Check Formatting + uses: jayllyz/clang-format-action@v1 + with: + check: true + clang-version: 17 + base-ref: refs/remotes/origin/develop From 71d2345e66277550ddfbcf692f7d89e73d005e96 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Tue, 26 Nov 2024 23:45:05 -0600 Subject: [PATCH 2/9] Fixes for clang-format-check --- .github/workflows/clang-format-check.yml | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 8fe8c790..c75bab14 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -13,18 +13,28 @@ concurrency: jobs: format: - runs-on: ubuntu-latest + runs-on: ubuntu-24.04 steps: - name: Checkout uses: actions/checkout@v4 with: - path: source + fetch-depth: 0 submodules: false + - name: Update References + shell: bash + run: | + git fetch origin develop + + - name: Setup Ubuntu Environment + shell: bash + run: | + sudo apt-get install clang-format-17 + - name: Check Formatting - uses: jayllyz/clang-format-action@v1 - with: - check: true - clang-version: 17 - base-ref: refs/remotes/origin/develop + shell: bash + run: | + MERGE_BASE=$(git merge-base origin/develop ${{ github.ref }}) + echo "Comparing against ${MERGE_BASE}" + git clang-format-17 --diff --style=file -v ${MERGE_BASE} From d539f7723eee7f19511bf88bda0b16e413116ca5 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Wed, 27 Nov 2024 07:42:46 -0600 Subject: [PATCH 3/9] Add clang-tidy-review --- .clang-tidy | 9 ++ .github/workflows/clang-tidy-review.yml | 107 ++++++++++++++++++++++++ 2 files changed, 116 insertions(+) create mode 100644 .clang-tidy create mode 100644 .github/workflows/clang-tidy-review.yml diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 00000000..6b7191fd --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,9 @@ +Checks: + - '-*' + - 'bugprone-*' + - 'clang-analyzer-*' + - 'cppcoreguidelines-*' + - 'misc-*','modernize-*' + - 'performance-*' + - '-misc-include-cleaner' +FormatStyle: 'file' diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml new file mode 100644 index 00000000..e76ab6dc --- /dev/null +++ b/.github/workflows/clang-tidy-review.yml @@ -0,0 +1,107 @@ +name: clang-tidy-review + +on: + pull_request: + branches: + - 'develop' + +concurrency: + # Cancel in-progress jobs for the same pull request + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +jobs: + build: + strategy: + matrix: + include: + - name: linux64_clang + os: ubuntu-24.04 + build_type: Release + qt_version: 6.8.0 + qt_arch_aqt: linux_gcc_64 + qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport + qt_tools: '' + conan_arch: x86_64 + conan_compiler: gcc + conan_compiler_version: 14 + conan_compiler_libcxx: --settings compiler.libcxx=libstdc++ + conan_compiler_runtime: '' + conan_package_manager: --conf tools.system.package_manager:mode=install --conf tools.system.package_manager:sudo=True + compiler_packages: clang-17 + runs-on: ${{ matrix.os }} + steps: + + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: Install Qt + uses: jurplel/install-qt-action@v3 + with: + version: ${{ matrix.qt_version }} + arch: ${{ matrix.qt_arch_aqt }} + modules: ${{ matrix.qt_modules }} + tools: ${{ matrix.qt_tools }} + + - name: Setup Ubuntu Environment + if: ${{ startsWith(matrix.os, 'ubuntu') }} + shell: bash + run: | + sudo apt-get install doxygen \ + libfuse2 \ + ninja-build \ + ${{ matrix.compiler_packages }} + + - name: Setup Python Environment + shell: pwsh + run: | + pip install geopandas ` + GitPython + + - name: Install Conan Packages + shell: pwsh + run: | + pip install "conan<2.0" + conan profile new default --detect + conan install ./ ` + --remote conancenter ` + --build missing ` + --settings arch=${{ matrix.conan_arch }} ` + --settings build_type=${{ matrix.build_type }} ` + --settings compiler="${{ matrix.conan_compiler }}" ` + --settings compiler.version=${{ matrix.conan_compiler_version }} ` + ${{ matrix.conan_compiler_libcxx }} ` + ${{ matrix.conan_compiler_runtime }} ` + ${{ matrix.conan_package_manager }} + + - name: Autogenerate + shell: pwsh + run: | + mkdir build + cd build + cmake ../ ` + -G Ninja ` + -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" ` + -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/supercell-wx" ` + -DCMAKE_EXPORT_COMPILE_COMMANDS=on + ninja scwx-qt_generate_counties_db ` + scwx-qt_generate_versions ` + scwx-qt_update_radar_sites ` + scwx-qt_autogen + + - name: Review + id: review + uses: ZedThree/clang-tidy-review@v0.14.0 + with: + config_file: .clang-tidy + build_dir: build + lgtm_comment_body: '' + + - name: Upload Review + uses: ZedThree/clang-tidy-review/upload@v0.20.1 + + - name: Status Check + if: steps.review.outputs.total_comments > 0 + run: exit 1 From ed9e7ad72f2c4bf4186a430870c3cd7ba0bed648 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Nov 2024 06:52:41 -0600 Subject: [PATCH 4/9] Fixes for clang-tidy-review --- .clang-tidy | 5 ++- .github/workflows/clang-tidy-review.yml | 59 +++++++++++++++++++------ scwx-qt/scwx-qt.cmake | 1 + 3 files changed, 51 insertions(+), 14 deletions(-) diff --git a/.clang-tidy b/.clang-tidy index 6b7191fd..1eed15a2 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,7 +3,10 @@ Checks: - 'bugprone-*' - 'clang-analyzer-*' - 'cppcoreguidelines-*' - - 'misc-*','modernize-*' + - 'misc-*' + - 'modernize-*' - 'performance-*' - '-misc-include-cleaner' + - '-misc-non-private-member-variables-in-classes' + - '-modernize-use-trailing-return-type' FormatStyle: 'file' diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml index e76ab6dc..7cec736c 100644 --- a/.github/workflows/clang-tidy-review.yml +++ b/.github/workflows/clang-tidy-review.yml @@ -15,28 +15,42 @@ jobs: strategy: matrix: include: - - name: linux64_clang + - name: linux64_clang-tidy os: ubuntu-24.04 build_type: Release + env_cc: clang-17 + env_cxx: clang++-17 qt_version: 6.8.0 qt_arch_aqt: linux_gcc_64 qt_modules: qtimageformats qtmultimedia qtpositioning qtserialport qt_tools: '' conan_arch: x86_64 - conan_compiler: gcc - conan_compiler_version: 14 - conan_compiler_libcxx: --settings compiler.libcxx=libstdc++ + conan_compiler: clang + conan_compiler_version: 17 + conan_compiler_libcxx: --settings compiler.libcxx=libstdc++11 conan_compiler_runtime: '' conan_package_manager: --conf tools.system.package_manager:mode=install --conf tools.system.package_manager:sudo=True - compiler_packages: clang-17 + compiler_packages: clang-17 clang-tidy-17 + name: ${{ matrix.name }} runs-on: ${{ matrix.os }} + env: + CC: ${{ matrix.env_cc }} + CXX: ${{ matrix.env_cxx }} steps: - name: Checkout uses: actions/checkout@v4 with: + path: source submodules: recursive + - name: Checkout clang-tidy-review Repository + uses: actions/checkout@v4 + with: + repository: ZedThree/clang-tidy-review + ref: v0.20.1 + path: clang-tidy-review + - name: Install Qt uses: jurplel/install-qt-action@v3 with: @@ -59,13 +73,14 @@ jobs: run: | pip install geopandas ` GitPython + pip install --break-system-packages clang-tidy-review/post/clang_tidy_review - name: Install Conan Packages shell: pwsh run: | pip install "conan<2.0" conan profile new default --detect - conan install ./ ` + conan install ./source/ ` --remote conancenter ` --build missing ` --settings arch=${{ matrix.conan_arch }} ` @@ -81,7 +96,7 @@ jobs: run: | mkdir build cd build - cmake ../ ` + cmake ../source/ ` -G Ninja ` -DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" ` -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/supercell-wx" ` @@ -91,13 +106,31 @@ jobs: scwx-qt_update_radar_sites ` scwx-qt_autogen - - name: Review + - name: Code Review id: review - uses: ZedThree/clang-tidy-review@v0.14.0 - with: - config_file: .clang-tidy - build_dir: build - lgtm_comment_body: '' + shell: bash + run: | + cd source + review --clang_tidy_binary=clang-tidy-17 \ + --token=${{ github.token }} \ + --repo='${{ github.repository }}' \ + --pr='${{ github.event.pull_request.number }}' \ + --build_dir='../build' \ + --base_dir='${{ github.workspace }}/source' \ + --clang_tidy_checks='' \ + --config_file='.clang-tidy' \ + --include='*.[ch],*.[ch]xx,*.[ch]pp,*.[ch]++,*.cc,*.hh' \ + --exclude='' \ + --apt-packages='' \ + --cmake-command='' \ + --max-comments=25 \ + --lgtm-comment-body='' \ + --split_workflow=false \ + --annotations=false \ + --parallel=0 + rsync -avzh --ignore-missing-args clang-tidy-review-output.json ../ + rsync -avzh --ignore-missing-args clang-tidy-review-metadata.json ../ + rsync -avzh --ignore-missing-args clang_fixes.json ../ - name: Upload Review uses: ZedThree/clang-tidy-review/upload@v0.20.1 diff --git a/scwx-qt/scwx-qt.cmake b/scwx-qt/scwx-qt.cmake index 1f4f4449..b68c20c6 100644 --- a/scwx-qt/scwx-qt.cmake +++ b/scwx-qt/scwx-qt.cmake @@ -510,6 +510,7 @@ source_group("I18N Files" FILES ${TS_FILES}) add_library(scwx-qt OBJECT ${PROJECT_SOURCES}) set_property(TARGET scwx-qt PROPERTY AUTOMOC ON) +set_property(TARGET scwx-qt PROPERTY AUTOGEN_ORIGIN_DEPENDS OFF) add_custom_command(OUTPUT ${COUNTIES_SQLITE_DB} COMMAND ${Python_EXECUTABLE} From dab88ebb9891c3e5c8439bad9e1cfc8967b8d75c Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Nov 2024 06:53:01 -0600 Subject: [PATCH 5/9] Fix deprecated header usage in log manager --- scwx-qt/source/scwx/qt/manager/log_manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scwx-qt/source/scwx/qt/manager/log_manager.cpp b/scwx-qt/source/scwx/qt/manager/log_manager.cpp index 457c8d28..7ab18e56 100644 --- a/scwx-qt/source/scwx/qt/manager/log_manager.cpp +++ b/scwx-qt/source/scwx/qt/manager/log_manager.cpp @@ -6,7 +6,7 @@ #include #include -#include +#include #include #include #include From a78d02617fedfa33b71b47c0ab4ef4cf7554ffa8 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Nov 2024 08:31:56 -0600 Subject: [PATCH 6/9] Update GitHub workflow concurrency groups to prevent cancelling workflows --- .github/workflows/ci.yml | 2 +- .github/workflows/clang-format-check.yml | 2 +- .github/workflows/clang-tidy-review.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4e59bc90..c4af3dc5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,7 +11,7 @@ on: concurrency: # Cancel in-progress jobs for the same pull request - group: ${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index c75bab14..f3e883d6 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -8,7 +8,7 @@ on: concurrency: # Cancel in-progress jobs for the same pull request - group: ${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: diff --git a/.github/workflows/clang-tidy-review.yml b/.github/workflows/clang-tidy-review.yml index 7cec736c..0182e383 100644 --- a/.github/workflows/clang-tidy-review.yml +++ b/.github/workflows/clang-tidy-review.yml @@ -7,7 +7,7 @@ on: concurrency: # Cancel in-progress jobs for the same pull request - group: ${{ github.head_ref || github.run_id }} + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} cancel-in-progress: true jobs: From 9e07b03b78f31788e3c6b6cbe70194d28d77c568 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Nov 2024 08:42:20 -0600 Subject: [PATCH 7/9] Add alternate reference for clang-format-check on pull request --- .github/workflows/clang-format-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index f3e883d6..dbc0c2c9 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -35,6 +35,6 @@ jobs: - name: Check Formatting shell: bash run: | - MERGE_BASE=$(git merge-base origin/develop ${{ github.ref }}) + MERGE_BASE=$(git merge-base origin/develop ${{ github.head_ref || github.ref }}) echo "Comparing against ${MERGE_BASE}" git clang-format-17 --diff --style=file -v ${MERGE_BASE} From 8c7c04c79715cde5d2b542a9d6d88b2f01e2a159 Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Nov 2024 08:54:53 -0600 Subject: [PATCH 8/9] Fix pull request alternate reference --- .github/workflows/clang-format-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index dbc0c2c9..7e41cc61 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -35,6 +35,6 @@ jobs: - name: Check Formatting shell: bash run: | - MERGE_BASE=$(git merge-base origin/develop ${{ github.head_ref || github.ref }}) + MERGE_BASE=$(git merge-base origin/develop ${{ github.event.pull_request.head_sha || github.ref }}) echo "Comparing against ${MERGE_BASE}" git clang-format-17 --diff --style=file -v ${MERGE_BASE} From 1fd696d787fde879e78646e2576e5ade5f975fcc Mon Sep 17 00:00:00 2001 From: Dan Paulat Date: Thu, 28 Nov 2024 08:56:19 -0600 Subject: [PATCH 9/9] Fix pull request alternate reference (again) --- .github/workflows/clang-format-check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/clang-format-check.yml b/.github/workflows/clang-format-check.yml index 7e41cc61..acdcd586 100644 --- a/.github/workflows/clang-format-check.yml +++ b/.github/workflows/clang-format-check.yml @@ -35,6 +35,6 @@ jobs: - name: Check Formatting shell: bash run: | - MERGE_BASE=$(git merge-base origin/develop ${{ github.event.pull_request.head_sha || github.ref }}) + MERGE_BASE=$(git merge-base origin/develop ${{ github.event.pull_request.head.sha || github.ref }}) echo "Comparing against ${MERGE_BASE}" git clang-format-17 --diff --style=file -v ${MERGE_BASE}