Skip to content
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

Make a smoke test CI for PRs #4

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 8 additions & 15 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -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'





4 changes: 1 addition & 3 deletions .github/workflows/ci.yml → .github/workflows/ci-main.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
name: ci
name: ci-main
on:
pull_request:
release:
types: [published]
push:
tags:
branches:
- main
- develop
Expand Down
96 changes: 96 additions & 0 deletions .github/workflows/ci-pr.yml
Original file line number Diff line number Diff line change
@@ -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 <NAME>"
run: |
cmake --build ./build --config ${{matrix.build_type}}

- name: Tests
working-directory: ./build
run: |
ctest -C ${{matrix.build_type}}
1 change: 1 addition & 0 deletions test/initial_draft.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,9 @@
*/
explicit segment(const segment&) = default;
segment(segment&&) noexcept = default;
segment& operator=(const segment&) = default;

Check failure on line 54 in test/initial_draft.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

copy constructor should not be declared explicit [hicpp-explicit-conversions,-warnings-as-errors]
segment& operator=(segment&&) noexcept = default;
~segment() = default;

template <class F>
auto append(F&& f) && {
Expand All @@ -78,12 +79,12 @@
void invoke(const R& receiver, Args&&... args) && {
if (receiver.canceled()) return;

std::move(_apply)(

Check failure on line 82 in test/initial_draft.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

statement should be inside braces [hicpp-braces-around-statements,-warnings-as-errors]
[_f = tuple_compose(std::move(_functions)),
_receiver = receiver](auto&&... args) mutable noexcept {
if (_receiver.canceled()) return;
try {

Check warning on line 86 in test/initial_draft.cpp

View workflow job for this annotation

GitHub Actions / Analyze (cpp, gcc-11, Ninja Multi-Config, Debug, ON)

declaration of ‘auto:60&& ... args’ shadows a parameter [-Wshadow]
std::move(_f)(std::forward<decltype(args)>(args)...);

Check failure on line 87 in test/initial_draft.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

statement should be inside braces [hicpp-braces-around-statements,-warnings-as-errors]
} catch (...) {
_receiver.set_exception(std::current_exception());
}
Expand Down Expand Up @@ -114,7 +115,7 @@
std::tuple_cat(std::move(_tail), std::tuple(std::move(_head))));
}

template <class F>

Check failure on line 118 in test/initial_draft.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

class 'chain' defines a copy constructor, a copy assignment operator, a move constructor and a move assignment operator but does not define a destructor [cppcoreguidelines-special-member-functions,hicpp-special-member-functions,-warnings-as-errors]
static consteval auto static_fold_over(F fold) {
return std::apply([fold](auto&&... links) { return fold(fold, STLAB_FWD(links)...); },
std::tuple_cat(std::declval<Tail>(),
Expand Down
7 changes: 4 additions & 3 deletions test/tuple_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
#include <tuple>
#include <utility>

#include <chains/tuple.hpp>

TEST_CASE("Test tuple compose", "[tuple_compose]") {
// NOLINTBEGIN(cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers)

Check failure on line 10 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

unmatched 'NOLINTBEGIN' comment without a subsequent 'NOLINTEND' comment [clang-tidy-nolint]

Check failure on line 10 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (windows-2019, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

unmatched 'NOLINTBEGIN' comment without a subsequent 'NOLINTEND' comment [clang-tidy-nolint]
std::tuple t{[](int x) { return x + 1.0; }, [](double x) { return x * 2.0; },

Check failure on line 11 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, gcc-11, Ninja Multi-Config, Debug, OFF, OFF)

2.0 is a magic number; consider replacing it with a named constant [readability-magic-numbers,-warnings-as-errors]

Check failure on line 11 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

2.0 is a magic number; consider replacing it with a named constant [readability-magic-numbers,-warnings-as-errors]

Check failure on line 11 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (windows-2019, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

2.0 is a magic number; consider replacing it with a named constant [readability-magic-numbers,-warnings-as-errors]
[](double x) { return std::to_string(x / 2.0); }};

Check failure on line 12 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, gcc-11, Ninja Multi-Config, Debug, OFF, OFF)

2.0 is a magic number; consider replacing it with a named constant [readability-magic-numbers,-warnings-as-errors]

Check failure on line 12 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

2.0 is a magic number; consider replacing it with a named constant [readability-magic-numbers,-warnings-as-errors]

Check failure on line 12 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (windows-2019, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

2.0 is a magic number; consider replacing it with a named constant [readability-magic-numbers,-warnings-as-errors]
REQUIRE(chains::tuple_compose(std::move(t))(1) == "2.000000");
// NOLINTEND

Check failure on line 13 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

unmatched 'NOLINTEND' comment without a previous 'NOLINTBEGIN' comment [clang-tidy-nolint]

Check failure on line 13 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (windows-2019, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

unmatched 'NOLINTEND' comment without a previous 'NOLINTBEGIN' comment [clang-tidy-nolint]
REQUIRE(chains::tuple_compose(std::move(t))(1) ==

Check failure on line 14 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, gcc-11, Ninja Multi-Config, Debug, OFF, OFF)

't' used after it was moved [bugprone-use-after-move,hicpp-invalid-access-moved,-warnings-as-errors]

Check failure on line 14 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (ubuntu-20.04, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

't' used after it was moved [bugprone-use-after-move,hicpp-invalid-access-moved,-warnings-as-errors]

Check failure on line 14 in test/tuple_tests.cpp

View workflow job for this annotation

GitHub Actions / Test (windows-2019, llvm-15.0.2, Ninja Multi-Config, Debug, OFF, OFF)

't' used after it was moved [bugprone-use-after-move,hicpp-invalid-access-moved,-warnings-as-errors]
"2.000000"); // NOLINT(bugprone-use-after-move,hicpp-invalid-access-moved)
}
Loading