From 8fadb9423191b9e04180dd0d54d7bef3a526f5c5 Mon Sep 17 00:00:00 2001 From: "Timmer, Daan" Date: Tue, 7 Jan 2025 15:57:56 +0000 Subject: [PATCH 1/5] feat: update to latest main of amp-cucumber-cpp-runner ci: add windows build from amp-devcontainer-cpp --- .github/workflows/ci.yml | 22 ++++++++++++++++++ .gitignore | 1 + CMakeLists.txt | 3 ++- CMakePresets.json | 31 +++++++++++++++++++++++--- integration_test/runner/CMakeLists.txt | 2 +- integration_test/runner/Hooks.cpp | 2 +- integration_test/runner/Main.cpp | 5 +++-- integration_test/runner/StepsGpio.cpp | 2 +- integration_test/runner/StepsUart.cpp | 2 +- integration_test/runner/Waiting.cpp | 10 ++++----- integration_test/runner/Waiting.hpp | 16 ++++++------- 11 files changed, 73 insertions(+), 23 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7168f26e..9bfbb193 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,6 +66,28 @@ jobs: with: name: test-logs path: build/host/Testing/Temporary/ + build-windows-from-devcontainer: + name: Windows Host Build from Devcontainer + runs-on: [ubuntu-latest] + container: ghcr.io/philips-software/amp-devcontainer-cpp:5.2.0@sha256:c47fcc83b59fb08f3a3a6e591b18bad49b3862acc35770fca6cec9ad0adb9cb2 # v5.2.0 + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 + id: cache-winsdk + with: + path: /winsdk + key: cache-winsdk + - if: ${{ steps.cache-winsdk.outputs.cache-hit != 'true' }} + run: xwin --accept-license --manifest-version 17 splat --preserve-ms-arch-notation --include-debug-libs && mv .xwin-cache/splat/ /winsdk + - uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 + with: + key: ${{ github.job }} + variant: sccache + - uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8 + with: + configurePreset: "Windows" + buildPreset: "Windows-Release" + configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']" embedded_build: name: Embedded Build runs-on: ubuntu-latest diff --git a/.gitignore b/.gitignore index 8df0c86a..cb8fa7ad 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ .cache .vs/ .vscode/.cortex-debug* +.xwin-cache build/ out/ megalinter-reports/ diff --git a/CMakeLists.txt b/CMakeLists.txt index 4b41368a..e315f9f1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,13 +28,14 @@ if (HALST_STANDALONE) GIT_REPOSITORY https://github.com/philips-software/amp-embedded-infra-lib.git GIT_TAG db70a3a415c9324a6e30043bb39bf38c6ae4e394 # unreleased ) + add_compile_options(-Wno-deprecated-declarations) FetchContent_MakeAvailable(emil) if (EMIL_HOST_BUILD) FetchContent_Declare( cucumber-cpp-runner GIT_REPOSITORY https://github.com/philips-software/amp-cucumber-cpp-runner.git - GIT_TAG 70c424e53f532f520d96a303b6586272d3efc5f5 # unreleased + GIT_TAG 08d653fe47d31d7e070195f7536d4f32e03180e6 # unreleased ) FetchContent_MakeAvailable(cucumber-cpp-runner) diff --git a/CMakePresets.json b/CMakePresets.json index 18c0e5df..e169a122 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -177,12 +177,22 @@ { "name": "stm32h573", "inherits": "stm32", - "toolchainFile": "${sourceDir}/build/${presetName}/_deps/emil-src/cmake//toolchain-arm-gcc-m33-fpv5-sp-d16.cmake", + "toolchainFile": "${sourceDir}/build/${presetName}/_deps/emil-src/cmake/toolchain-arm-gcc-m33-fpv5-sp-d16.cmake", "cacheVariables": { "TARGET_CORTEX": "m33", "TARGET_MCU_FAMILY": "stm32h5xx", "TARGET_MCU": "stm32h573" } + }, + { + "name": "Windows", + "inherits": "defaults", + "toolchainFile": "${sourceDir}/build/${presetName}/_deps/emil-src/cmake/toolchain-clang-x86_64-pc-windows-msvc.cmake", + "environment": { + "CCACHE_DEPEND": "true", + "CCACHE_COMPILERTYPE": "clang-cl" + }, + "generator": "Ninja Multi-Config" } ], "buildPresets": [ @@ -195,7 +205,10 @@ "name": "host-Debug-WithPackage", "configuration": "Debug", "configurePreset": "host", - "targets": ["all", "package"] + "targets": [ + "all", + "package" + ] }, { "name": "host-RelWithDebInfo", @@ -211,7 +224,9 @@ "name": "release-package", "configuration": "MinSizeRel", "configurePreset": "host-single-MinSizeRel", - "targets": ["package"] + "targets": [ + "package" + ] }, { "name": "stm32wb55-RelWithDebInfo", @@ -292,6 +307,16 @@ "name": "stm32h573-MinSizeRel", "configuration": "MinSizeRel", "configurePreset": "stm32h573" + }, + { + "name": "Windows-Release", + "configuration": "Release", + "configurePreset": "Windows" + }, + { + "name": "Windows-RelWithDebInfo", + "configuration": "RelWithDebInfo", + "configurePreset": "Windows" } ], "testPresets": [ diff --git a/integration_test/runner/CMakeLists.txt b/integration_test/runner/CMakeLists.txt index 102bf8d4..307e275b 100644 --- a/integration_test/runner/CMakeLists.txt +++ b/integration_test/runner/CMakeLists.txt @@ -14,7 +14,7 @@ target_sources(integration_test.runner PRIVATE target_link_libraries(integration_test.runner PRIVATE args - cucumber-cpp + cucumber_cpp.library integration_test.logic hal.generic gtest diff --git a/integration_test/runner/Hooks.cpp b/integration_test/runner/Hooks.cpp index 04896fe0..9d521e84 100644 --- a/integration_test/runner/Hooks.cpp +++ b/integration_test/runner/Hooks.cpp @@ -1,4 +1,4 @@ -#include "cucumber-cpp/Hooks.hpp" +#include "cucumber_cpp/library/Hooks.hpp" #include "generated/echo/Testing.pb.hpp" #include "hal/generic/TimerServiceGeneric.hpp" #include "infra/timer/Waiting.hpp" diff --git a/integration_test/runner/Main.cpp b/integration_test/runner/Main.cpp index e32532b7..0d4795ed 100644 --- a/integration_test/runner/Main.cpp +++ b/integration_test/runner/Main.cpp @@ -1,8 +1,9 @@ -#include "cucumber-cpp/Application.hpp" + +#include "cucumber_cpp/library/Application.hpp" int main(int argc, char** argv) { - cucumber_cpp::Application application{}; + cucumber_cpp::library::Application application{}; application.CliParser().add_option("--target", *application.ProgramContext().EmplaceAt("target"), "COM port or hostname (ws:///path or tcp://) of the amp-hal-st integration test board")->required(); diff --git a/integration_test/runner/StepsGpio.cpp b/integration_test/runner/StepsGpio.cpp index 7a683f3e..f4865e8f 100644 --- a/integration_test/runner/StepsGpio.cpp +++ b/integration_test/runner/StepsGpio.cpp @@ -1,4 +1,4 @@ -#include "cucumber-cpp/Steps.hpp" +#include "cucumber_cpp/library/Steps.hpp" #include "generated/echo/Testing.pb.hpp" #include "infra/timer/Waiting.hpp" #include "integration_test/logic/Tested.hpp" diff --git a/integration_test/runner/StepsUart.cpp b/integration_test/runner/StepsUart.cpp index b02b9a4a..29cfd5b3 100644 --- a/integration_test/runner/StepsUart.cpp +++ b/integration_test/runner/StepsUart.cpp @@ -1,4 +1,4 @@ -#include "cucumber-cpp/Steps.hpp" +#include "cucumber_cpp/library/Steps.hpp" #include "generated/echo/Testing.pb.hpp" #include "infra/timer/Waiting.hpp" #include "integration_test/logic/Tested.hpp" diff --git a/integration_test/runner/Waiting.cpp b/integration_test/runner/Waiting.cpp index a2dee555..84afb22e 100644 --- a/integration_test/runner/Waiting.cpp +++ b/integration_test/runner/Waiting.cpp @@ -4,7 +4,7 @@ namespace infra { - bool WaitUntilDone(cucumber_cpp::Context& context, const std::function&)>& action, infra::Duration timeout) + bool WaitUntilDone(cucumber_cpp::library::Context& context, const std::function&)>& action, infra::Duration timeout) { bool done{ false }; bool timedOut{ false }; @@ -29,7 +29,7 @@ namespace infra return !timedOut; } - bool WaitFor(cucumber_cpp::Context& context, const std::function& pred, infra::Duration timeout) + bool WaitFor(cucumber_cpp::library::Context& context, const std::function& pred, infra::Duration timeout) { bool timedOut{ false }; @@ -46,7 +46,7 @@ namespace infra return !timedOut; } - void WaitFor(cucumber_cpp::Context& context, infra::Duration timeout) + void WaitFor(cucumber_cpp::library::Context& context, infra::Duration timeout) { bool done{ false }; @@ -61,14 +61,14 @@ namespace infra }); } - Async::Async(cucumber_cpp::Context& context) + Async::Async(cucumber_cpp::library::Context& context) : Async{ context, [this]() { return notified; } } {} - Async::Async(cucumber_cpp::Context& context, std::function func) + Async::Async(cucumber_cpp::library::Context& context, std::function func) : context{ context } , func{ std::move(func) } {} diff --git a/integration_test/runner/Waiting.hpp b/integration_test/runner/Waiting.hpp index 4aa8ef12..4995d933 100644 --- a/integration_test/runner/Waiting.hpp +++ b/integration_test/runner/Waiting.hpp @@ -1,19 +1,19 @@ #ifndef INTEGRATION_TEST_WAITING_HPP #define INTEGRATION_TEST_WAITING_HPP -#include "cucumber-cpp/Context.hpp" +#include "cucumber_cpp/library/Context.hpp" #include "infra/timer/Timer.hpp" namespace infra { constexpr inline infra::Duration defaultTimeout{ std::chrono::seconds{ 1 } }; - bool WaitUntilDone(cucumber_cpp::Context& context, const std::function&)>& action, infra::Duration timeout = defaultTimeout); - bool WaitFor(cucumber_cpp::Context& context, const std::function& pred, infra::Duration timeout = defaultTimeout); - void WaitFor(cucumber_cpp::Context& context, infra::Duration timeout); + bool WaitUntilDone(cucumber_cpp::library::Context& context, const std::function&)>& action, infra::Duration timeout = defaultTimeout); + bool WaitFor(cucumber_cpp::library::Context& context, const std::function& pred, infra::Duration timeout = defaultTimeout); + void WaitFor(cucumber_cpp::library::Context& context, infra::Duration timeout); template - bool WaitForValue(cucumber_cpp::Context& context, const Obj& obj, const T& value, Proj proj = {}, Arg&&... args, infra::Duration timeout = defaultTimeout) + bool WaitForValue(cucumber_cpp::library::Context& context, const Obj& obj, const T& value, Proj proj = {}, Arg&&... args, infra::Duration timeout = defaultTimeout) { return WaitFor( context, [&proj, &obj, &args..., &value]() @@ -25,8 +25,8 @@ namespace infra struct Async { - explicit Async(cucumber_cpp::Context& context); - Async(cucumber_cpp::Context& context, std::function func); + explicit Async(cucumber_cpp::library::Context& context); + Async(cucumber_cpp::library::Context& context, std::function func); operator infra::Function(); @@ -35,7 +35,7 @@ namespace infra [[nodiscard]] bool Wait(infra::Duration timeout = defaultTimeout) const; private: - cucumber_cpp::Context& context; + cucumber_cpp::library::Context& context; std::function func; bool notified{ false }; }; From 3c377b92efc8d4bb106e197d0f39cd0cd302515e Mon Sep 17 00:00:00 2001 From: "Timmer, Daan" Date: Wed, 8 Jan 2025 08:03:01 +0000 Subject: [PATCH 2/5] ci: use ccache instead of sccache --- .github/workflows/ci.yml | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9bfbb193..0a657514 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,14 +21,13 @@ jobs: - uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 with: key: ${{ github.job }}-ubuntu-latest - variant: sccache - uses: seanmiddleditch/gha-setup-ninja@96bed6edff20d1dd61ecff9b75cc519d516e6401 # v5 - uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8 with: configurePreset: "host" buildPreset: "host-Debug-WithPackage" testPreset: "host" - configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']" + configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']" - uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: hal_st @@ -53,20 +52,19 @@ jobs: - uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 with: key: ${{ github.job }}-${{ matrix.os }} - variant: sccache - uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8 with: configurePreset: "host-single-Debug" buildPreset: "host-single-Debug" testPreset: "host-single-Debug" - configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=sccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=sccache']" + configurePresetAdditionalArgs: "['-DCMAKE_C_COMPILER_LAUNCHER=ccache', '-DCMAKE_CXX_COMPILER_LAUNCHER=ccache']" - name: Upload test logs if: ${{ failure() }} uses: actions/upload-artifact@6f51ac03b9356f520e9adb1b1b7802705f340c2b # v4.5.0 with: name: test-logs path: build/host/Testing/Temporary/ - build-windows-from-devcontainer: + host_build_clang_msvc: name: Windows Host Build from Devcontainer runs-on: [ubuntu-latest] container: ghcr.io/philips-software/amp-devcontainer-cpp:5.2.0@sha256:c47fcc83b59fb08f3a3a6e591b18bad49b3862acc35770fca6cec9ad0adb9cb2 # v5.2.0 @@ -82,7 +80,6 @@ jobs: - uses: hendrikmuhs/ccache-action@ed74d11c0b343532753ecead8a951bb09bb34bc9 # v1.2.14 with: key: ${{ github.job }} - variant: sccache - uses: lukka/run-cmake@af1be47fd7c933593f687731bc6fdbee024d3ff4 # v10.8 with: configurePreset: "Windows" From 7e35ac1c3efbdf54d4a9d060a15cee91733dae1e Mon Sep 17 00:00:00 2001 From: Daan Timmer <8293597+daantimmer@users.noreply.github.com> Date: Wed, 8 Jan 2025 09:04:13 +0100 Subject: [PATCH 3/5] Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- CMakePresets.json | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index e169a122..b9c95fa0 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -205,10 +205,7 @@ "name": "host-Debug-WithPackage", "configuration": "Debug", "configurePreset": "host", - "targets": [ - "all", - "package" - ] + "targets": ["all", "package"] }, { "name": "host-RelWithDebInfo", @@ -224,9 +221,7 @@ "name": "release-package", "configuration": "MinSizeRel", "configurePreset": "host-single-MinSizeRel", - "targets": [ - "package" - ] + "targets": ["package"] }, { "name": "stm32wb55-RelWithDebInfo", From 58dbd0e1c3c09c430fdc8646669cf94aad345c1e Mon Sep 17 00:00:00 2001 From: "Timmer, Daan" Date: Wed, 8 Jan 2025 09:53:42 +0000 Subject: [PATCH 4/5] ci: limit trigger scope for social interaction to only opened types --- .github/workflows/social-interaction.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/social-interaction.yml b/.github/workflows/social-interaction.yml index 41e53a36..54bc75c1 100644 --- a/.github/workflows/social-interaction.yml +++ b/.github/workflows/social-interaction.yml @@ -1,7 +1,11 @@ --- name: Social Interaction -on: [pull_request, issues] +on: + pull_request: + types: [opened] + issues: + types: [opened] permissions: contents: read From f23c74839a4f92c2743069759855dfde2df38974 Mon Sep 17 00:00:00 2001 From: "Timmer, Daan" Date: Wed, 8 Jan 2025 10:13:12 +0000 Subject: [PATCH 5/5] chore: update embedded infra lib --- CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e315f9f1..38e7ef44 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,9 +26,8 @@ if (HALST_STANDALONE) FetchContent_Declare( emil GIT_REPOSITORY https://github.com/philips-software/amp-embedded-infra-lib.git - GIT_TAG db70a3a415c9324a6e30043bb39bf38c6ae4e394 # unreleased + GIT_TAG 76b60344061b0904c40e993b74717a85a7a6e376 # unreleased ) - add_compile_options(-Wno-deprecated-declarations) FetchContent_MakeAvailable(emil) if (EMIL_HOST_BUILD)