Skip to content

Commit 008e80a

Browse files
committed
Introduce matrix stategy to CI
1 parent 9addea7 commit 008e80a

File tree

6 files changed

+22
-30
lines changed

6 files changed

+22
-30
lines changed

.clang-tidy

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Checks: >-
2121
-misc-non-private-member-variables-in-classes,
2222
-readability-function-cognitive-complexity,
2323
-readability-magic-numbers,
24+
-readability-redundant-declaration,
2425
-misc-include-cleaner,
2526
WarningsAsErrors: ''
2627
HeaderFileExtensions:

.github/workflows/test-mac.yml

+15-22
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ jobs:
1313
tests:
1414
runs-on: macos-latest
1515

16-
# strategy:
17-
# matrix:
18-
# build_type: [Release, Debug]
16+
strategy:
17+
matrix:
18+
build_type: [Release, Debug]
1919

2020
steps:
2121
- name: Checkout
@@ -40,39 +40,32 @@ jobs:
4040
- name: Add LLVM Path
4141
run: echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH
4242

43-
- name: Build Debug
43+
- name: Build ${{ matrix.build_type }}
4444
run: |
45-
cmake -B build_debug -S . -DARGO_TESTS_ENABLE=true -GNinja -DCMAKE_BUILD_TYPE=Debug -DARGO_CLANG_TIDY_ENABLE=ON
46-
cmake --build build_debug
45+
cmake -B build -S . -DARGO_TESTS_ENABLE=true -GNinja -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
46+
cmake --build build
4747
env:
4848
CC: /usr/local/opt/llvm/bin/clang
4949
CXX: /usr/local/opt/llvm/bin/clang++
5050
LDFLAGS: -L/usr/local/opt/llvm/lib -L/usr/local/opt/llvm/lib/c++ -Wl,-rpath,/usr/local/opt/llvm/lib/c++
5151
CPPFLAGS: -I/usr/local/opt/llvm/include
5252

53-
- name: Build Release
53+
- name: Test ${{ matrix.build_type }}
54+
if: matrix.build_type == 'Release'
5455
run: |
55-
cmake -B build_release -S . -DARGO_TESTS_ENABLE=true -GNinja -DCMAKE_BUILD_TYPE=Release
56-
cmake --build build_release
57-
env:
58-
CC: /usr/local/opt/llvm/bin/clang
59-
CXX: /usr/local/opt/llvm/bin/clang++
60-
LDFLAGS: -L/usr/local/opt/llvm/lib -L/usr/local/opt/llvm/lib/c++ -Wl,-rpath,/usr/local/opt/llvm/lib/c++
61-
CPPFLAGS: -I/usr/local/opt/llvm/include
62-
63-
- name: Test Release
64-
run: |
65-
cmake --build build_release --target test
56+
cmake --build build --target test
6657
6758
- name: Test Debug with codecov
59+
if: matrix.build_type == 'Debug'
6860
run: |
69-
LLVM_PROFILE_FILE=./build_debug/test-argo.profraw ./build_debug/test-argo
70-
/usr/local/opt/llvm/bin/llvm-profdata merge -sparse ./build_debug/test-argo.profraw -o ./build_debug/coverage.profdata
71-
/usr/local/opt/llvm/bin/llvm-cov show ./build_debug/test-argo -instr-profile=./build_debug/coverage.profdata -ignore-filename-regex="tests*" -ignore-filename-regex="Argo/ArgoExceptions.cc" > ./build_debug/coverage.txt
61+
LLVM_PROFILE_FILE=./build/test-argo.profraw ./build/test-argo
62+
/usr/local/opt/llvm/bin/llvm-profdata merge -sparse ./build/test-argo.profraw -o ./build/coverage.profdata
63+
/usr/local/opt/llvm/bin/llvm-cov show ./build/test-argo -instr-profile=./build/coverage.profdata -ignore-filename-regex="tests*" -ignore-filename-regex="Argo/ArgoExceptions.cc" > ./build/coverage.txt
7264
7365
- name: Upload coverage reports to Codecov
7466
uses: codecov/codecov-action@v3
67+
if: matrix.build_type == 'Debug'
7568
with:
76-
files: ./build_debug/coverage.txt
69+
files: ./build/coverage.txt
7770
env:
7871
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

Argo/ArgoMetaAssigner.cc

+3-4
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ ARGO_ALWAYS_INLINE constexpr auto Assigner(
259259
template <class Arguments, class PArgs, class HArg>
260260
ARGO_ALWAYS_INLINE constexpr auto ShortArgAssigner(
261261
std::string_view key, const std::span<std::string_view>& values) {
262-
bool has_help = false;
263262
for (size_t i = 0; i < key.size(); i++) {
264263
auto [found_key, is_flag] = GetkeyFromShortKey< //
265264
std::conditional_t<std::is_same_v<HArg, void>, //
@@ -276,17 +275,17 @@ ARGO_ALWAYS_INLINE constexpr auto ShortArgAssigner(
276275
assignArg<Arguments, PArgs>(found_key, {});
277276
} else if ((key.size() - 1 == i) and !values.empty()) {
278277
assignArg<Arguments, PArgs>(found_key, values);
279-
return has_help;
278+
return false;
280279
} else if ((key.size() - 1 == i) and values.empty()) {
281280
auto value = std::vector<std::string_view>{key.substr(i + 1)};
282281
assignArg<Arguments, PArgs>(found_key, value);
283-
return has_help;
282+
return false;
284283
} else [[unlikely]] {
285284
throw Argo::InvalidArgument(
286285
format("Invalid Flag argument {} {}", key[i], key.substr(i + 1)));
287286
}
288287
}
289-
return has_help;
288+
return false;
290289
}
291290

292291
template <class Args>

Argo/ArgoParser.cc

+3-2
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ class Parser {
277277
}
278278

279279
template <ArgName Name>
280-
constexpr auto& getParser() {
280+
constexpr auto getParser() -> auto& {
281281
if constexpr (std::is_same_v<SubParsers, std::tuple<>>) {
282282
static_assert(false, "Parser has no sub parser");
283283
}
@@ -345,7 +345,8 @@ class Parser {
345345

346346
public:
347347
ARGO_ALWAYS_INLINE constexpr auto parse(int argc, char* argv[]) -> void;
348-
[[nodiscard]] constexpr std::string formatHelp(bool no_color = false) const;
348+
[[nodiscard]] constexpr auto formatHelp(bool no_color = false) const
349+
-> std::string;
349350

350351
explicit constexpr operator bool() const {
351352
return this->parsed_;

Argo/ArgoParserImpl.cc

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
module;
22

33
#include <cassert>
4-
#include <print>
54

65
#include "Argo/ArgoMacros.hh"
76

CMakeLists.txt

-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_LIST_DIR})
7676
"${CLANG_TIDY_EXE};-p;${CMAKE_BINARY_DIR}")
7777
endif()
7878
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
79-
message("Debug build")
8079
target_compile_options(test-argo PRIVATE -fprofile-instr-generate
8180
-fcoverage-mapping)
8281
target_link_options(test-argo PRIVATE -fprofile-instr-generate

0 commit comments

Comments
 (0)