From ac11afd8fed66eb70141c28ea571b7603ad83a90 Mon Sep 17 00:00:00 2001 From: Anders Wind Date: Fri, 8 Mar 2024 10:06:42 +0100 Subject: [PATCH] feature/add presets for more clang compilers (#36) --- .codespellrc | 3 +- .github/workflows/ci.yml | 75 +++++++++++++++++++++------ .github/workflows/codeql-analysis.yml | 4 +- .github/workflows/update_readme.yml | 4 +- .vscode/settings.json | 11 ++-- CMakePresets.json | 58 +++++++++++++++++++-- CMakeUserPresets.template.json | 2 +- benchmarks/src/unit_benchmarks.cpp | 5 +- cmake/lint-targets.cmake | 2 +- cmake/lint.cmake | 2 +- vcpkg.json | 4 +- version.py | 2 +- 12 files changed, 134 insertions(+), 38 deletions(-) diff --git a/.codespellrc b/.codespellrc index f595560..15b6071 100644 --- a/.codespellrc +++ b/.codespellrc @@ -2,5 +2,6 @@ builtin = clear,rare,en-GB_to_en-US,names,informal,code check-filenames = check-hidden = -skip = */.git,*/build,*/prefix,*/.vscode,*/.sonar +skip = */.git,*/build,*/prefix,*/.vscode,*/.sonar,*/llvm quiet-level = 2 +ignore-words-list = deque,dur,lightyears \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb58631..db40add 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,13 +16,13 @@ on: workflow_dispatch: env: - VCPKG_COMMIT: "6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2" + VCPKG_COMMIT: "c8696863d371ab7f46e213d8f5ca923c4aef2a00" jobs: version_bump: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: fetch-depth: 0 @@ -34,33 +34,41 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: { python-version: "3.8" } - name: Install codespell run: pip3 install codespell + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + + - name: Fix clang-format + run: | + cp ./llvm/bin/clang-format ./llvm/bin/clang-format-17 + - name: Lint - run: cmake -D FORMAT_COMMAND=clang-format-14 -P cmake/lint.cmake + run: cmake -D FORMAT_COMMAND=clang-format-17 -P cmake/lint.cmake - name: Spell check if: always() run: cmake -P cmake/spell.cmake sonarcloud: - if: false # See https://github.com/twig-energy/stronk/issues/37 needs: [lint] runs-on: ubuntu-22.04 env: BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install sonar-scanner and build-wrapper - uses: SonarSource/sonarcloud-github-c-cpp@v1 + uses: SonarSource/sonarcloud-github-c-cpp@v2 - name: Install vcpkg uses: friendlyanon/setup-vcpkg@v1 @@ -93,12 +101,17 @@ jobs: if: github.repository_owner == 'twig-energy' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install LCov run: sudo apt-get update -q && sudo apt-get install lcov -q -y + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + - name: Install vcpkg uses: friendlyanon/setup-vcpkg@v1 with: @@ -108,7 +121,7 @@ jobs: } - name: Configure - env: { CXX: clang++-14 } + env: { CXX: clang++-17 } run: cmake --preset=ci-coverage - name: Build @@ -122,7 +135,7 @@ jobs: run: cmake --build build/coverage -t coverage - name: Submit to codecov.io - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v4 with: file: build/coverage/coverage.info @@ -132,7 +145,16 @@ jobs: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 + + - name: Install LLVM and Clang + uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + + - name: Fix clang++ + run: | + cp ./llvm/bin/clang++ ./llvm/bin/clang++-17 - name: Install vcpkg uses: friendlyanon/setup-vcpkg@v1 @@ -143,7 +165,7 @@ jobs: } - name: Configure - env: { CXX: clang++-14 } + env: { CXX: clang++-17 } run: cmake --preset=ci-sanitize - name: Build @@ -166,12 +188,16 @@ jobs: strategy: matrix: os: [macos-12, ubuntu-22.04, windows-2022] - compiler: [gcc-11, clang-13, clang-14, msvc] + compiler: [gcc-11, clang-13, clang-14, clang-15, clang-17, msvc] exclude: - os: windows-2022 compiler: clang-13 - os: windows-2022 compiler: clang-14 + - os: windows-2022 + compiler: clang-15 + - os: windows-2022 + compiler: clang-17 - os: windows-2022 compiler: gcc-11 - os: ubuntu-22.04 @@ -182,15 +208,32 @@ jobs: compiler: clang-13 - os: macos-12 compiler: clang-14 + - os: macos-12 + compiler: clang-15 + - os: macos-12 + compiler: clang-17 runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install static analyzers if: matrix.os == 'ubuntu-22.04' - run: sudo apt-get install clang-tidy-14 cppcheck -y -q + run: sudo apt-get install cppcheck -y -q + + - name: Install LLVM and Clang + if: matrix.os == 'ubuntu-22.04' + uses: KyleMayes/install-llvm-action@v1 + with: + version: "17.0" + + - name: Fix clang installations + if: matrix.os == 'ubuntu-22.04' + run: | + cp ./llvm/bin/clang++ ./llvm/bin/clang++-17 + cp ./llvm/bin/clang-format ./llvm/bin/clang-format-17 + cp ./llvm/bin/clang-tidy ./llvm/bin/clang-tidy-17 - name: Install vcpkg uses: friendlyanon/setup-vcpkg@v1 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 1d757a5..15021a3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -20,7 +20,7 @@ on: schedule: - cron: "44 8 * * 1" env: - VCPKG_COMMIT: "6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2" + VCPKG_COMMIT: "c8696863d371ab7f46e213d8f5ca923c4aef2a00" jobs: analyze: @@ -40,7 +40,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/update_readme.yml b/.github/workflows/update_readme.yml index 2076a07..c9da13b 100644 --- a/.github/workflows/update_readme.yml +++ b/.github/workflows/update_readme.yml @@ -9,13 +9,13 @@ jobs: auto-update-readme: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 with: ref: ${{ github.head_ref }} - name: Update Readme run: python tools/embed_code.py -i --file ./README.md - - uses: stefanzweifel/git-auto-commit-action@v4 + - uses: stefanzweifel/git-auto-commit-action@v5 with: commit_message: Updated README.md diff --git a/.vscode/settings.json b/.vscode/settings.json index 7c47d41..d14deaa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,5 +1,6 @@ { - "clang-format.executable": "clang-format-14", + "clangd.path": "clangd-17", + "clang-format.executable": "clang-format-17", "cpplint.filters": [ "-build/c++11", "-build/include_order", @@ -108,5 +109,9 @@ "structs", "VCPKG" ], - "sonarlint.pathToCompileCommands": "${workspaceFolder}/build/dev/compile_commands.json" -} + "sonarlint.pathToCompileCommands": "${workspaceFolder}/build/dev/compile_commands.json", + "sonarlint.connectedMode.project": { + "connectionId": "twig-energy", + "projectKey": "twig-energy_stronk" + } +} \ No newline at end of file diff --git a/CMakePresets.json b/CMakePresets.json index 2eb54bd..c663f10 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -39,7 +39,7 @@ "name": "clang-tidy", "hidden": true, "cacheVariables": { - "CMAKE_CXX_CLANG_TIDY": "clang-tidy-13;--header-filter=${sourceDir}/*" + "CMAKE_CXX_CLANG_TIDY": "clang-tidy-17;--header-filter=${sourceDir}/*" } }, { @@ -47,7 +47,8 @@ "hidden": true, "environment": { "CXX": "clang++-13", - "CC": "clang-13" + "CC": "clang-13", + "LLVM_SYMBOLIZER_PATH": "llvm-symbolizer-13" } }, { @@ -55,7 +56,26 @@ "hidden": true, "environment": { "CXX": "clang++-14", - "CC": "clang-14" + "CC": "clang-14", + "LLVM_SYMBOLIZER_PATH": "llvm-symbolizer-14" + } + }, + { + "name": "clang-15", + "hidden": true, + "environment": { + "CXX": "clang++-15", + "CC": "clang-15", + "LLVM_SYMBOLIZER_PATH": "llvm-symbolizer-15" + } + }, + { + "name": "clang-17", + "hidden": true, + "environment": { + "CXX": "clang++-17", + "CC": "clang-17", + "LLVM_SYMBOLIZER_PATH": "llvm-symbolizer-17" } }, { @@ -74,6 +94,14 @@ "CC": "gcc-12" } }, + { + "name": "gcc-13", + "hidden": true, + "environment": { + "CXX": "g++-13", + "CC": "gcc-13" + } + }, { "name": "msvc", "hidden": true @@ -159,7 +187,8 @@ "inherits": [ "ci-unix", "dev-mode", - "vcpkg" + "vcpkg", + "clang-17" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Sanitize", @@ -216,6 +245,13 @@ "gcc-12" ] }, + { + "name": "ci-ubuntu-gcc-13", + "inherits": [ + "ci-ubuntu", + "gcc-13" + ] + }, { "name": "ci-ubuntu-clang-13", "inherits": [ @@ -230,6 +266,20 @@ "clang-14" ] }, + { + "name": "ci-ubuntu-clang-15", + "inherits": [ + "ci-ubuntu", + "clang-15" + ] + }, + { + "name": "ci-ubuntu-clang-17", + "inherits": [ + "ci-ubuntu", + "clang-17" + ] + }, { "name": "ci-codeql", "inherits": [ diff --git a/CMakeUserPresets.template.json b/CMakeUserPresets.template.json index f3d8457..4544290 100644 --- a/CMakeUserPresets.template.json +++ b/CMakeUserPresets.template.json @@ -25,7 +25,7 @@ "inherits": [ "dev-common", "ci-unix", - "clang-14" + "clang-17" ], "cacheVariables": { "CMAKE_BUILD_TYPE": "Debug", diff --git a/benchmarks/src/unit_benchmarks.cpp b/benchmarks/src/unit_benchmarks.cpp index 2532778..7b612e8 100644 --- a/benchmarks/src/unit_benchmarks.cpp +++ b/benchmarks/src/unit_benchmarks.cpp @@ -1,7 +1,4 @@ -#include -#include -#include - +#include #include #include diff --git a/cmake/lint-targets.cmake b/cmake/lint-targets.cmake index 3c7b7f0..371cc64 100644 --- a/cmake/lint-targets.cmake +++ b/cmake/lint-targets.cmake @@ -10,7 +10,7 @@ set(FORMAT_PATTERNS ) set(FORMAT_COMMAND - clang-format-14 + clang-format-17 CACHE STRING "Formatter to use" ) diff --git a/cmake/lint.cmake b/cmake/lint.cmake index 28f6759..26441fb 100644 --- a/cmake/lint.cmake +++ b/cmake/lint.cmake @@ -6,7 +6,7 @@ macro (default name) endif () endmacro () -default(FORMAT_COMMAND clang-format-14) +default(FORMAT_COMMAND clang-format-17) default( PATTERNS source/*.cpp diff --git a/vcpkg.json b/vcpkg.json index dd183b6..56754ba 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -25,7 +25,7 @@ "dependencies": [ { "name": "abseil", - "version>=": "20220623.1" + "version>=": "20230802.1" } ] }, @@ -54,5 +54,5 @@ ] } }, - "builtin-baseline": "6f7ffeb18f99796233b958aaaf14ec7bd4fb64b2" + "builtin-baseline": "c8696863d371ab7f46e213d8f5ca923c4aef2a00" } diff --git a/version.py b/version.py index a8d4557..d7b30e1 100644 --- a/version.py +++ b/version.py @@ -1 +1 @@ -__version__ = "0.3.5" +__version__ = "0.3.6"