Skip to content

Commit b9b512a

Browse files
authored
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
1 parent e23bd4c commit b9b512a

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

.github/workflows/test.yaml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ jobs:
1717
# we need at least ruby 2.7 for the tests
1818
# instead of dealing with installing a modern version of ruby on 2019, we'll just use windows-2022 here
1919
os: [ubuntu-latest, windows-2022, macos-latest]
20+
# we want to ensure compatibility with a recent CMake version as well as the lowest officially supported
21+
# legacy version that we define as the default version of the second-latest Ubuntu LTS release currently available
22+
cmake_version: ['3.16.3', '3.25.1']
23+
exclude:
24+
# there seems to be an issue with CMake 3.16 not finding a C++ compiler on windows-2022
25+
- os: windows-2022
26+
cmake_version: '3.16.3'
2027

2128
steps:
2229
- name: clone
@@ -25,14 +32,17 @@ jobs:
2532
- name: Setup cmake
2633
uses: jwlawson/actions-setup-cmake@v1.13
2734
with:
28-
cmake-version: '3.25.x'
35+
cmake-version: ${{ matrix.cmake_version }}
2936

3037
- name: unit tests
3138
run: |
3239
cmake -Stest -Bbuild/test
3340
cmake --build build/test --target test-verbose
41+
env:
42+
CMAKE_VERSION: ${{ matrix.cmake_version }}
3443

3544
- name: integration tests
3645
run: ruby test/integration/runner.rb
3746
env:
3847
CPM_INTEGRATION_TEST_DIR: ./build/integration
48+
CMAKE_VERSION: ${{ matrix.cmake_version }}

test/integration/test_system_warnings.rb

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
class SystemWarnings < IntegrationTest
44

5+
def setup
6+
# system is only supported for CMake >= 3.25
7+
@system_supported = (!ENV['CMAKE_VERSION']) || (Gem::Version.new(ENV['CMAKE_VERSION']) >= Gem::Version.new('3.25'))
8+
end
9+
510
def test_dependency_added_using_system
611
for use_system in [true, false] do
712
prj = make_project name: use_system ? "system" : "no_system", from_template: 'using-adder'
@@ -21,7 +26,7 @@ def test_dependency_added_using_system
2126
PACK
2227

2328
assert_success prj.configure
24-
if use_system
29+
if use_system and @system_supported
2530
assert_success prj.build
2631
else
2732
assert_failure prj.build
@@ -42,7 +47,11 @@ def test_dependency_added_implicitly_using_system
4247
PACK
4348

4449
assert_success prj.configure
45-
assert_success prj.build
50+
if @system_supported
51+
assert_success prj.build
52+
else
53+
assert_failure prj.build
54+
end
4655
end
4756

4857
end

0 commit comments

Comments
 (0)