Add CMake version as workflow matrix parameter (#451)

* add CMake version as workflow matrix parameter

* change system test behaviour based on specified CMake version

* use explicit version strings

* set CMake version for both test steps

* exclude windows-2022, cmake 3.16 combination
This commit is contained in:
Lars Melchior
2023-02-22 17:33:50 +01:00
committed by GitHub
parent e23bd4c0c3
commit b9b512a869
2 changed files with 22 additions and 3 deletions

View File

@@ -17,6 +17,13 @@ jobs:
# we need at least ruby 2.7 for the tests # we need at least ruby 2.7 for the tests
# instead of dealing with installing a modern version of ruby on 2019, we'll just use windows-2022 here # instead of dealing with installing a modern version of ruby on 2019, we'll just use windows-2022 here
os: [ubuntu-latest, windows-2022, macos-latest] os: [ubuntu-latest, windows-2022, macos-latest]
# we want to ensure compatibility with a recent CMake version as well as the lowest officially supported
# legacy version that we define as the default version of the second-latest Ubuntu LTS release currently available
cmake_version: ['3.16.3', '3.25.1']
exclude:
# there seems to be an issue with CMake 3.16 not finding a C++ compiler on windows-2022
- os: windows-2022
cmake_version: '3.16.3'
steps: steps:
- name: clone - name: clone
@@ -25,14 +32,17 @@ jobs:
- name: Setup cmake - name: Setup cmake
uses: jwlawson/actions-setup-cmake@v1.13 uses: jwlawson/actions-setup-cmake@v1.13
with: with:
cmake-version: '3.25.x' cmake-version: ${{ matrix.cmake_version }}
- name: unit tests - name: unit tests
run: | run: |
cmake -Stest -Bbuild/test cmake -Stest -Bbuild/test
cmake --build build/test --target test-verbose cmake --build build/test --target test-verbose
env:
CMAKE_VERSION: ${{ matrix.cmake_version }}
- name: integration tests - name: integration tests
run: ruby test/integration/runner.rb run: ruby test/integration/runner.rb
env: env:
CPM_INTEGRATION_TEST_DIR: ./build/integration CPM_INTEGRATION_TEST_DIR: ./build/integration
CMAKE_VERSION: ${{ matrix.cmake_version }}

View File

@@ -2,6 +2,11 @@ require_relative './lib'
class SystemWarnings < IntegrationTest class SystemWarnings < IntegrationTest
def setup
# system is only supported for CMake >= 3.25
@system_supported = (!ENV['CMAKE_VERSION']) || (Gem::Version.new(ENV['CMAKE_VERSION']) >= Gem::Version.new('3.25'))
end
def test_dependency_added_using_system def test_dependency_added_using_system
for use_system in [true, false] do for use_system in [true, false] do
prj = make_project name: use_system ? "system" : "no_system", from_template: 'using-adder' prj = make_project name: use_system ? "system" : "no_system", from_template: 'using-adder'
@@ -21,7 +26,7 @@ class SystemWarnings < IntegrationTest
PACK PACK
assert_success prj.configure assert_success prj.configure
if use_system if use_system and @system_supported
assert_success prj.build assert_success prj.build
else else
assert_failure prj.build assert_failure prj.build
@@ -42,7 +47,11 @@ class SystemWarnings < IntegrationTest
PACK PACK
assert_success prj.configure assert_success prj.configure
assert_success prj.build if @system_supported
assert_success prj.build
else
assert_failure prj.build
end
end end
end end