Skip to content

Commit

Permalink
feat: update to latest main of amp-cucumber-cpp-runner (#478)
Browse files Browse the repository at this point in the history
Additional changes:

ci: add windows build from amp-devcontainer-cpp
ci: use ccache instead of sccache
ci: limit trigger scope for social interaction to only opened types
  • Loading branch information
daantimmer authored Jan 8, 2025
1 parent ac5e276 commit a32ea44
Show file tree
Hide file tree
Showing 12 changed files with 72 additions and 27 deletions.
27 changes: 23 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -53,19 +52,39 @@ 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/
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
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 }}
- 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
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/social-interaction.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
---
name: Social Interaction

on: [pull_request, issues]
on:
pull_request:
types: [opened]
issues:
types: [opened]

permissions:
contents: read
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.cache
.vs/
.vscode/.cortex-debug*
.xwin-cache
build/
out/
megalinter-reports/
Expand Down
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ 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
)
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)
Expand Down
22 changes: 21 additions & 1 deletion CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -292,6 +302,16 @@
"name": "stm32h573-MinSizeRel",
"configuration": "MinSizeRel",
"configurePreset": "stm32h573"
},
{
"name": "Windows-Release",
"configuration": "Release",
"configurePreset": "Windows"
},
{
"name": "Windows-RelWithDebInfo",
"configuration": "RelWithDebInfo",
"configurePreset": "Windows"
}
],
"testPresets": [
Expand Down
2 changes: 1 addition & 1 deletion integration_test/runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion integration_test/runner/Hooks.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
5 changes: 3 additions & 2 deletions integration_test/runner/Main.cpp
Original file line number Diff line number Diff line change
@@ -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<std::string>("target"), "COM port or hostname (ws://<host>/path or tcp://<host>) of the amp-hal-st integration test board")->required();

Expand Down
2 changes: 1 addition & 1 deletion integration_test/runner/StepsGpio.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion integration_test/runner/StepsUart.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
10 changes: 5 additions & 5 deletions integration_test/runner/Waiting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace infra
{
bool WaitUntilDone(cucumber_cpp::Context& context, const std::function<void(const std::function<void()>&)>& action, infra::Duration timeout)
bool WaitUntilDone(cucumber_cpp::library::Context& context, const std::function<void(const std::function<void()>&)>& action, infra::Duration timeout)
{
bool done{ false };
bool timedOut{ false };
Expand All @@ -29,7 +29,7 @@ namespace infra
return !timedOut;
}

bool WaitFor(cucumber_cpp::Context& context, const std::function<bool()>& pred, infra::Duration timeout)
bool WaitFor(cucumber_cpp::library::Context& context, const std::function<bool()>& pred, infra::Duration timeout)
{
bool timedOut{ false };

Expand All @@ -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 };

Expand All @@ -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<bool()> func)
Async::Async(cucumber_cpp::library::Context& context, std::function<bool()> func)
: context{ context }
, func{ std::move(func) }
{}
Expand Down
16 changes: 8 additions & 8 deletions integration_test/runner/Waiting.hpp
Original file line number Diff line number Diff line change
@@ -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<void(const std::function<void()>&)>& action, infra::Duration timeout = defaultTimeout);
bool WaitFor(cucumber_cpp::Context& context, const std::function<bool()>& pred, infra::Duration timeout = defaultTimeout);
void WaitFor(cucumber_cpp::Context& context, infra::Duration timeout);
bool WaitUntilDone(cucumber_cpp::library::Context& context, const std::function<void(const std::function<void()>&)>& action, infra::Duration timeout = defaultTimeout);
bool WaitFor(cucumber_cpp::library::Context& context, const std::function<bool()>& pred, infra::Duration timeout = defaultTimeout);
void WaitFor(cucumber_cpp::library::Context& context, infra::Duration timeout);

template<class Obj, class T, class... Arg, class Proj = std::identity>
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]()
Expand All @@ -25,8 +25,8 @@ namespace infra

struct Async
{
explicit Async(cucumber_cpp::Context& context);
Async(cucumber_cpp::Context& context, std::function<bool()> func);
explicit Async(cucumber_cpp::library::Context& context);
Async(cucumber_cpp::library::Context& context, std::function<bool()> func);

operator infra::Function<void()>();

Expand All @@ -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<bool()> func;
bool notified{ false };
};
Expand Down

0 comments on commit a32ea44

Please sign in to comment.