diff --git a/.github/workflows/clang-linux.yml b/.github/workflows/clang-linux.yml new file mode 100644 index 0000000..10795b4 --- /dev/null +++ b/.github/workflows/clang-linux.yml @@ -0,0 +1,54 @@ +name: clang-linux + +on: + push: + branches: + - main + - feature/* + paths-ignore: + - '**.md' + pull_request: + branches: [main] + paths-ignore: + - '**.md' + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-24.04 + + strategy: + fail-fast: false + matrix: + clang: [16, 17, 18] + build_type: [Debug] + std: [20, 23] + + env: + CC: clang-${{matrix.clang}} + CXX: clang++-${{matrix.clang}} + + steps: + - uses: actions/checkout@v4 + + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libc++-dev libc++abi-dev + + - name: Configure CMake + run: | + cmake -B ${{github.workspace}}/build \ + -DCMAKE_BUILD_TYPE=${{matrix.build_type}} \ + -DCMAKE_CXX_STANDARD=${{matrix.std}} \ + -DCMAKE_C_COMPILER=${{env.CC}} \ + -DCMAKE_CXX_COMPILER=${{env.CXX}} \ + -DCMAKE_CXX_FLAGS="-stdlib=libc++" \ + -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi" + + - name: Build + run: cmake --build build -j $(nproc) + + - name: Test + working-directory: build + run: ctest -j $(nproc) --output-on-failure diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index f85bb60..906e33d 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -11,23 +11,24 @@ on: branches: [main] paths-ignore: - '**.md' + workflow_dispatch: env: - BUILD_TYPE: Release + BUILD_TYPE: Debug jobs: build: - runs-on: macos-12 + runs-on: macos-13 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Configure CMake run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build - run: cmake --build build --config ${{env.BUILD_TYPE}} -j 2 + run: cmake --build build --config ${{env.BUILD_TYPE}} -j 3 - name: Test working-directory: build - run: ctest -C ${{env.BUILD_TYPE}} -j 2 --output-on-failure + run: ctest -C ${{env.BUILD_TYPE}} -j 3 --output-on-failure diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index ae7400b..414a595 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -11,27 +11,32 @@ on: branches: [main] paths-ignore: - '**.md' - -env: - BUILD_TYPE: Release + workflow_dispatch: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 + + strategy: + fail-fast: false + matrix: + gcc: [12, 13, 14] + build_type: [Debug] + std: [20, 23] env: - CC: gcc-11 - CXX: g++-11 + CC: gcc-${{matrix.gcc}} + CXX: g++-${{matrix.gcc}} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}} -DCMAKE_CXX_STANDARD=${{matrix.std}} - name: Build - run: cmake --build build -j 2 + run: cmake --build build -j $(nproc) - name: Test working-directory: build - run: ctest -j 2 --output-on-failure + run: ctest -j $(nproc) --output-on-failure diff --git a/.github/workflows/msvc.yml b/.github/workflows/msvc.yml new file mode 100644 index 0000000..1422c15 --- /dev/null +++ b/.github/workflows/msvc.yml @@ -0,0 +1,40 @@ +name: msvc + +on: + push: + branches: + - main + - 'feature/*' + paths-ignore: + - '**.md' + pull_request: + branches: [main] + paths-ignore: + - '**.md' + workflow_dispatch: + +env: + CTEST_OUTPUT_ON_FAILURE: 1 + BUILD_TYPE: Debug + +jobs: + build: + runs-on: windows-latest + timeout-minutes: 10 + + strategy: + matrix: + cpp_version: [20, 23] + + steps: + - uses: actions/checkout@v4 + + - name: Configure CMake + run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCMAKE_CXX_STANDARD=${{matrix.cpp_version}} + + - name: Build + run: cmake --build build --config ${{env.BUILD_TYPE}} --parallel + + - name: Test + working-directory: build + run: ctest --build-config ${{env.BUILD_TYPE}} diff --git a/.github/workflows/msvc_2022.yml b/.github/workflows/msvc_2022.yml deleted file mode 100644 index 0458a9b..0000000 --- a/.github/workflows/msvc_2022.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: msvc_2022 - -on: - push: - branches: - - main - - feature/* - paths-ignore: - - '**.md' - pull_request: - branches: [main] - paths-ignore: - - '**.md' - -env: - BUILD_TYPE: Release - -jobs: - build: - runs-on: windows-2022 - - steps: - - uses: actions/checkout@v3 - - - name: Configure CMake - run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - - - name: Build - run: cmake --build build --config ${{env.BUILD_TYPE}} -j 2 - - - name: Test - working-directory: build - run: ctest -C ${{env.BUILD_TYPE}} -j 2 --output-on-failure diff --git a/cmake/dev-mode.cmake b/cmake/dev-mode.cmake index ee70782..a325667 100644 --- a/cmake/dev-mode.cmake +++ b/cmake/dev-mode.cmake @@ -8,8 +8,8 @@ include(FetchContent) FetchContent_Declare( ut - GIT_REPOSITORY https://github.com/boost-ext/ut.git - GIT_TAG master + GIT_REPOSITORY https://github.com/openalgz/ut + GIT_TAG v0.0.3 GIT_SHALLOW TRUE ) @@ -24,6 +24,6 @@ source_group(TREE "${PROJECT_SOURCE_DIR}/src" PREFIX sources FILES ${sources}) add_executable(argz_test ${sources} ${headers}) -target_link_libraries(argz_test PRIVATE argz::argz ut) +target_link_libraries(argz_test PRIVATE argz::argz ut::ut) add_test(NAME argz_test COMMAND argz_test) diff --git a/src/Main.cpp b/src/Main.cpp index ccc09fa..2f68c2b 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -76,11 +76,10 @@ inline std::vector string_to_vector(const std::string& str) return ret; } -#define BOOST_UT_DISABLE_MODULE -#include "boost/ut.hpp" +#define UT_RUNTIME_ONLY +#include "ut/ut.hpp" -using namespace boost::ut; -using namespace boost::ut::literals; +using namespace ut; int main(int argc, char* argv[]) { @@ -178,12 +177,12 @@ int main(int argc, char* argv[]) }; test("test5") = [&] { - expect(nothrow([&] {parse_string(R"(program.exe -h)"); })); + expect(not throws([&] {parse_string(R"(program.exe -h)"); })); }; test("test6") = [&] { boolean = false; // Reset not to be right on default - expect(nothrow([&] {parse_string(R"(program.exe -i some/path --study s --boolean -- )"); })); + expect(not throws([&] {parse_string(R"(program.exe -i some/path --study s --boolean -- )"); })); expect(input == "some/path"); expect(study == "s"); expect(boolean == true); @@ -196,7 +195,7 @@ int main(int argc, char* argv[]) }; test("test8") = [&] { - expect(nothrow([&] {parse_string(R"(program.exe - )"); })); + expect(not throws([&] {parse_string(R"(program.exe - )"); })); }; test("test-dashes") = [&] { @@ -213,7 +212,7 @@ int main(int argc, char* argv[]) parse_string(R"(program.exe)"); about.print_help_when_no_options = false; - expect(nothrow([&] {argz::parse(about, opts, buffers.size(), buffers.data()); })); + expect(not throws([&] {argz::parse(about, opts, buffers.size(), buffers.data()); })); }; test("opt_test0") = [&] { @@ -277,7 +276,7 @@ int main(int argc, char* argv[]) }; test("opt_test5") = [&] { - expect(nothrow([&] {parse_string(R"(program.exe -h)"); })); + expect(not throws([&] {parse_string(R"(program.exe -h)"); })); }; test("opt_test6") = [&] { @@ -286,7 +285,7 @@ int main(int argc, char* argv[]) study_opt = {}; number_opt = {}; - expect(nothrow([&] {parse_string(R"(program.exe --input_opt some/path --study_opt s --boolean -- )"); })); + expect(not throws([&] {parse_string(R"(program.exe --input_opt some/path --study_opt s --boolean -- )"); })); expect(input_opt.value() == "some/path"); expect(study_opt.value() == "s"); @@ -305,7 +304,7 @@ int main(int argc, char* argv[]) study_opt = {}; number_opt = {}; - expect(nothrow([&] {parse_string(R"(program.exe - )"); })); + expect(not throws([&] {parse_string(R"(program.exe - )"); })); expect(!input_opt.has_value()); expect(!study_opt.has_value());