From eccde6f0ed4279230247a9708714c4288838ef67 Mon Sep 17 00:00:00 2001 From: Stefan Hoffmann Date: Sat, 15 Apr 2023 17:32:44 +0200 Subject: [PATCH] pass target framework that should be used for tests --- .github/workflows/build_linux.yml | 4 ++++ rcldotnet/CMakeLists.txt | 10 ++++++++++ 2 files changed, 14 insertions(+) diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index adbc2d07..a7c7b785 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -12,13 +12,17 @@ jobs: os: ['ubuntu-20.04', 'ubuntu-22.04'] include: - os: ubuntu-20.04 + test_target_framework: netcoreapp2.0 ros_distribution: foxy ros_version: 2 - os: ubuntu-22.04 + test_target_framework: net6 ros_distribution: humble ros_version: 2 runs-on: ${{ matrix.os }} + env: + RCLDOTNET_TEST_TARGET_FRAMEWORK: ${{ matrix.test_target_framework }} steps: - name: Checkout source diff --git a/rcldotnet/CMakeLists.txt b/rcldotnet/CMakeLists.txt index 30b01cc6..7dc42d50 100644 --- a/rcldotnet/CMakeLists.txt +++ b/rcldotnet/CMakeLists.txt @@ -97,7 +97,17 @@ if(BUILD_TESTING) ${builtin_interfaces_ASSEMBLIES_DLL} ) + # Used by CI to test the different target frameworks in a matrix. + if(DEFINED ENV{RCLDOTNET_TEST_TARGET_FRAMEWORK}) + set(RCLDOTNET_TEST_TARGET_FRAMEWORK $ENV{RCLDOTNET_TEST_TARGET_FRAMEWORK}) + else() + set(RCLDOTNET_TEST_TARGET_FRAMEWORK "") + endif() + add_dotnet_test(test_messages + TARGET_FRAMEWORK + ${RCLDOTNET_TEST_TARGET_FRAMEWORK} + SOURCES ${CS_SOURCES} test/test_messages.cs INCLUDE_DLLS