diff --git a/.clang-tidy b/.clang-tidy index cdfaf8b..3eb5e00 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -3,28 +3,21 @@ Checks: "*, -abseil-*, -altera-*, -android-*, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-macro-usage, + -cppcoreguidelines-non-private-member-variables-in-classes, -fuchsia-*, -google-*, -llvm*, + -misc-non-private-member-variables-in-classes, -modernize-use-trailing-return-type, - -zircon-*, + -readability-avoid-const-params-in-decls, + -readability-braces-around-statements -readability-else-after-return, + -readability-identifier-length, -readability-static-accessed-through-instance, - -readability-avoid-const-params-in-decls, - -cppcoreguidelines-non-private-member-variables-in-classes, - -misc-non-private-member-variables-in-classes, + -zircon-*, " WarningsAsErrors: '' HeaderFilterRegex: '' FormatStyle: none - -CheckOptions: - - key: readability-identifier-length.IgnoredVariableNames - value: 'x|y|z' - - key: readability-identifier-length.IgnoredParameterNames - value: 'x|y|z' - - - - - diff --git a/.github/workflows/ci.yml b/.github/workflows/ci-main.yml similarity index 99% rename from .github/workflows/ci.yml rename to .github/workflows/ci-main.yml index db6c611..57d82e4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci-main.yml @@ -1,10 +1,8 @@ -name: ci +name: ci-main on: - pull_request: release: types: [published] push: - tags: branches: - main - develop diff --git a/.github/workflows/ci-pr.yml b/.github/workflows/ci-pr.yml new file mode 100644 index 0000000..8c50c9c --- /dev/null +++ b/.github/workflows/ci-pr.yml @@ -0,0 +1,96 @@ +name: ci-pr +on: + pull_request: + branches: + - main + +env: + VERBOSE: 1 + +jobs: + Test: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + + matrix: + os: + - ubuntu-20.04 + - macos-10.15 + - windows-2019 + compiler: + # you can specify the version after `-` like "llvm-15.0.2". + - llvm-15.0.2 + - gcc-11 + generator: + - "Ninja Multi-Config" + build_type: + - Debug + packaging_maintainer_mode: + - OFF + build_shared: + - OFF + + exclude: + # mingw is determined by this author to be too buggy to support + - os: windows-2019 + compiler: gcc-11 + + include: + # Windows msvc builds + - os: windows-2022 + compiler: msvc + generator: "Visual Studio 17 2022" + build_type: Debug + packaging_maintainer_mode: Off + enable_ipo: On + + steps: + - name: Check for llvm version mismatches + if: ${{ contains(matrix.compiler, 'llvm') && !contains(matrix.compiler, env.CLANG_TIDY_VERSION) }} + uses: actions/github-script@v3 + with: + script: | + core.setFailed('There is a mismatch between configured llvm compiler and clang-tidy version chosen') + + - uses: actions/checkout@v3 + + - name: Setup Cache + uses: ./.github/actions/setup_cache + with: + compiler: ${{ matrix.compiler }} + build_type: ${{ matrix.build_type }} + packaging_maintainer_mode: ${{ matrix.packaging_maintainer_mode }} + generator: ${{ matrix.generator }} + + - name: Project Name + uses: cardinalby/export-env-action@v2 + with: + envFile: '.github/constants.env' + + + - name: Setup Cpp + uses: aminya/setup-cpp@v1 + with: + compiler: ${{ matrix.compiler }} + vcvarsall: ${{ contains(matrix.os, 'windows' )}} + + cmake: true + ninja: true + vcpkg: false + ccache: true + clangtidy: false + + - name: Configure CMake + run: | + cmake -S . -B ./build -G "${{matrix.generator}}" -D${{ env.PROJECT_NAME }}_ENABLE_IPO=${{matrix.enable_ipo }} -DCMAKE_BUILD_TYPE:STRING=${{matrix.build_type}} -D${{ env.PROJECT_NAME }}_PACKAGING_MAINTAINER_MODE:BOOL=${{matrix.packaging_maintainer_mode}} -D${{ env.PROJECT_NAME }}_ENABLE_COVERAGE:BOOL=${{ matrix.build_type == 'Debug' }} -DGIT_SHA:STRING=${{ github.sha }} + + - name: Build + # Execute the build. You can specify a specific target with "--target " + run: | + cmake --build ./build --config ${{matrix.build_type}} + + - name: Tests + working-directory: ./build + run: | + ctest -C ${{matrix.build_type}} diff --git a/test/initial_draft.cpp b/test/initial_draft.cpp index c7eb283..70d5a5b 100644 --- a/test/initial_draft.cpp +++ b/test/initial_draft.cpp @@ -53,6 +53,7 @@ class segment { segment(segment&&) noexcept = default; segment& operator=(const segment&) = default; segment& operator=(segment&&) noexcept = default; + ~segment() = default; template auto append(F&& f) && { diff --git a/test/tuple_tests.cpp b/test/tuple_tests.cpp index db7751c..12a937b 100644 --- a/test/tuple_tests.cpp +++ b/test/tuple_tests.cpp @@ -6,10 +6,11 @@ #include #include -#include - TEST_CASE("Test tuple compose", "[tuple_compose]") { + // NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers) std::tuple t{[](int x) { return x + 1.0; }, [](double x) { return x * 2.0; }, [](double x) { return std::to_string(x / 2.0); }}; - REQUIRE(chains::tuple_compose(std::move(t))(1) == "2.000000"); + // NOLINTEND + REQUIRE(chains::tuple_compose(std::move(t))(1) == + "2.000000"); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved) }