From 91746525c3b6f0850d52ab90f72ec4cf7063d31a Mon Sep 17 00:00:00 2001 From: Sean Alling Date: Fri, 19 Jan 2024 17:04:10 -0800 Subject: [PATCH 1/3] Add simple CMake presets Removed workflows Removed working directory from CI scripts Working directory for CMake steps are taken care of using CMakePreset file Adjusted CMakePreset to match CI steps Revert CTest preset Switched to Ninja build from multi config Reverted Windows CI file --- .github/workflows/ci-linux.yml | 12 +++-- .github/workflows/ci-macos.yml | 11 ++--- .github/workflows/ci-windows.yml | 11 ++--- .github/workflows/qa.yml | 20 ++++----- CMakePresets.json | 76 ++++++++++++++++++++++++++++++++ 5 files changed, 97 insertions(+), 33 deletions(-) create mode 100644 CMakePresets.json diff --git a/.github/workflows/ci-linux.yml b/.github/workflows/ci-linux.yml index f2a91ef8..dea75f76 100644 --- a/.github/workflows/ci-linux.yml +++ b/.github/workflows/ci-linux.yml @@ -38,19 +38,17 @@ jobs: - name: Configure run: | export CXX=$(echo ${{ matrix.compiler }} | sed -E 's/^(g|clang)(cc)?/\1++/') - cmake -G Ninja -S . -B build + cmake --preset default --fresh - name: Build - working-directory: build - run: ninja srecord-executables + run: cmake --build --preset srecord-executables - name: Smoke test - working-directory: build - run: ninja srecord-executables-version + run: cmake --build --preset srecord-executables-version - name: Build test prerequisites - working-directory: build - run: ninja prepare-test + + run: cmake --build --preset prepare-test - name: Test working-directory: build diff --git a/.github/workflows/ci-macos.yml b/.github/workflows/ci-macos.yml index 9038aafa..e45a9319 100644 --- a/.github/workflows/ci-macos.yml +++ b/.github/workflows/ci-macos.yml @@ -19,19 +19,16 @@ jobs: - uses: actions/checkout@v3 - name: Configure - run: cmake -G Ninja -S . -B build + run: cmake --preset default --fresh - name: Build - working-directory: build - run: ninja srecord-executables + run: cmake --build --preset srecord-executables - name: Smoke test - working-directory: build - run: ninja srecord-executables-version + run: cmake --build --preset srecord-executables-version - name: Build test prerequisites - working-directory: build - run: ninja prepare-test + run: cmake --build --preset prepare-test - name: Test working-directory: build diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index 14b2cc96..b0bcd966 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -43,19 +43,16 @@ jobs: - uses: actions/checkout@v3 - name: Configure - run: cmake -G Ninja -S . -B build + run: cmake --preset default --fresh - name: Build - working-directory: build - run: ninja srecord-executables + run: cmake --build --preset srecord-executables - name: Smoke test - working-directory: build - run: ninja srecord-executables-version + run: cmake --build --preset srecord-executables-version - name: Build test prerequisites - working-directory: build - run: ninja prepare-test + run: cmake --build --preset prepare-test - name: Test working-directory: build diff --git a/.github/workflows/qa.yml b/.github/workflows/qa.yml index 280fd77c..f3adc866 100644 --- a/.github/workflows/qa.yml +++ b/.github/workflows/qa.yml @@ -36,25 +36,23 @@ jobs: -Wextra SRecord_CMake_Flags: >- -D CMAKE_EXPORT_COMPILE_COMMANDS=ON - run: cmake -G Ninja -S . -B build ${SRecord_CMake_Flags} + run: cmake --preset default --fresh ${SRecord_CMake_Flags} # cSpell:enable - name: Build - working-directory: build run: ninja -k 0 srecord-executables - name: Smoke test - working-directory: build - run: ninja srecord-executables-version + run: cmake --build --preset srecord-executables-version - name: Build test prerequisites - working-directory: build - run: ninja prepare-test + run: cmake --build --preset prepare-test - name: Test working-directory: build run: ctest --output-on-failure --output-junit ctest.junit.xml + - name: clang-tidy if: always() run: run-clang-tidy-14 -p build -header-filter=.* @@ -92,25 +90,23 @@ jobs: -Wno-implicit-fallthrough SRecord_CMake_Flags: >- -D CMAKE_EXPORT_COMPILE_COMMANDS=ON - run: cmake -G Ninja -S . -B build ${SRecord_CMake_Flags} + run: cmake --preset default --fresh ${SRecord_CMake_Flags} # cSpell:enable - name: Build - working-directory: build run: ninja -k 0 srecord-executables - name: Smoke test - working-directory: build - run: ninja srecord-executables-version + run: cmake --build srecord-executables-version - name: Build test prerequisites - working-directory: build - run: ninja prepare-test + run: cmake --build prepare-test - name: Test working-directory: build run: ctest --output-on-failure --output-junit ctest.junit.xml + docs: name: Documentation runs-on: ubuntu-22.04 diff --git a/CMakePresets.json b/CMakePresets.json new file mode 100644 index 00000000..2f8c0814 --- /dev/null +++ b/CMakePresets.json @@ -0,0 +1,76 @@ +{ + "version": 6, + "cmakeMinimumRequired": { + "major": 3, + "minor": 25, + "patch": 0 + }, + "configurePresets": [ + { + "name": "cmake-pedantic", + "hidden": true, + "warnings": { + "dev": false, + "uninitialized": false, + "systemVars": false + }, + "errors": { + "deprecated": true + } + }, + { + "name": "ci-build", + "binaryDir": "${sourceDir}/build", + "hidden": true + }, + { + "name": "ninja", + "generator": "Ninja", + "hidden": true + }, + { + "name": "default", + "displayName": "Basic configuration", + "inherits": ["ci-build", "cmake-pedantic", "ninja"] + } + ], + "buildPresets": [ + { + "name": "default-config-preset", + "hidden": true, + "configurePreset": "default" + }, + { + "name": "clean", + "displayName": "Debug build", + "targets" : "clean", + "inherits": ["default-config-preset"] + }, + { + "name": "srecord-executables", + "displayName": "Debug build", + "targets" : "srecord-executables", + "inherits": ["default-config-preset"] + }, + { + "name": "srecord-executables-version", + "displayName": "Debug build", + "inherits": ["default-config-preset"], + "targets" : "srecord-executables-version" + }, + { + "name": "prepare-test", + "displayName": "Debug build", + "inherits": ["default-config-preset"], + "targets" : "prepare-test" + } + ], + "testPresets": [ + { + "name": "test", + "configurePreset": "default", + "output": {"outputOnFailure": true, "outputJUnitFile": "ctest.junit.xml"} + + } + ] +} From 10db94f98fb77ddf3cb7e1310128e5ebac7b2d9c Mon Sep 17 00:00:00 2001 From: Sean Alling Date: Fri, 19 Jan 2024 18:17:13 -0800 Subject: [PATCH 2/3] Resolving CI build errors --- srecord/arglex.cc | 4 ++-- srecord/arglex/abbreviate.cc | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srecord/arglex.cc b/srecord/arglex.cc index 9a2ad1f9..ca9ff92a 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -144,10 +144,10 @@ srecord::arglex::compare(const char *formal, const char *actual) { for (;;) { - uint8_t ac = *actual++; + std::uint8_t ac = *actual++; if (isupper(ac)) ac = tolower(ac); - uint8_t fc = *formal++; + std::uint8_t fc = *formal++; switch (fc) { case 0: diff --git a/srecord/arglex/abbreviate.cc b/srecord/arglex/abbreviate.cc index 11441e90..d6b7d2e7 100644 --- a/srecord/arglex/abbreviate.cc +++ b/srecord/arglex/abbreviate.cc @@ -25,7 +25,7 @@ srecord::arglex::abbreviate(const char *s) std::string result; for (;;) { - uint8_t c = *s++; + std::uint8_t c = *s++; switch (c) { case '\0': From f4ad36758beb6ddfca5df63bcca0a8f147ad68e9 Mon Sep 17 00:00:00 2001 From: Sean Alling Date: Fri, 19 Jan 2024 18:21:18 -0800 Subject: [PATCH 3/3] Addressing clang errors in CI --- srecord/arglex.cc | 3 ++- srecord/arglex/abbreviate.cc | 2 +- srecord/input/file/hexdump.cc | 2 +- srecord/input/file/ppx.cc | 3 ++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/srecord/arglex.cc b/srecord/arglex.cc index ca9ff92a..07444b22 100644 --- a/srecord/arglex.cc +++ b/srecord/arglex.cc @@ -24,6 +24,7 @@ #include #include #include +#include #include #include @@ -80,7 +81,7 @@ srecord::arglex::read_arguments_file(const char *filename) int sc = getc(fp); if (sc == EOF) break; - uint8_t c = sc; + std::uint8_t c = sc; // // Ignore white space between words. diff --git a/srecord/arglex/abbreviate.cc b/srecord/arglex/abbreviate.cc index d6b7d2e7..1a68b712 100644 --- a/srecord/arglex/abbreviate.cc +++ b/srecord/arglex/abbreviate.cc @@ -17,7 +17,7 @@ // #include - +#include std::string srecord::arglex::abbreviate(const char *s) diff --git a/srecord/input/file/hexdump.cc b/srecord/input/file/hexdump.cc index ea34513a..f99475bb 100644 --- a/srecord/input/file/hexdump.cc +++ b/srecord/input/file/hexdump.cc @@ -41,7 +41,7 @@ srecord::input_file_hexdump::get_next_token() int sc = get_char(); if (sc < 0) return token_eof; - uint8_t c = sc; + std::uint8_t c = sc; switch (c) { case '\n': diff --git a/srecord/input/file/ppx.cc b/srecord/input/file/ppx.cc index 23a4589d..6fd30523 100644 --- a/srecord/input/file/ppx.cc +++ b/srecord/input/file/ppx.cc @@ -17,6 +17,7 @@ // #include +#include #include #include @@ -47,7 +48,7 @@ srecord::input_file_ppx::get_next_token() token = token_eof; return; } - uint8_t c = sc; + std::uint8_t c = sc; switch (c) { case '*':