Skip to content

Commit 7a32c4e

Browse files
authored
Merge pull request #24 from rursprung/add-ubuntu24-gcc14-to-CI
CI: build with GCC 14 on Ubuntu 24.04
2 parents 55e2378 + c1af220 commit 7a32c4e

File tree

4 files changed

+148
-56
lines changed

4 files changed

+148
-56
lines changed

.github/workflows/CI.yaml

+46-55
Original file line numberDiff line numberDiff line change
@@ -10,76 +10,67 @@ jobs:
1010
runs-on: ${{ matrix.os }}
1111

1212
strategy:
13-
# Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable.
1413
fail-fast: false
1514

16-
# Set up a matrix to run the following 3 configurations:
17-
# 1. <Windows, Debug, latest MSVC compiler toolchain on the default runner image, default generator>
18-
# 2. <Linux, Debug, latest GCC compiler toolchain on the default runner image, default generator>
19-
# 3. <Linux, Debug, latest Clang compiler toolchain on the default runner image, default generator>
20-
#
21-
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
2215
matrix:
23-
os: [windows-latest] # skip ubuntu until 24.04 is available in GHA (required for newer GCC & CLang)
16+
os: [windows-latest, ubuntu-24.04]
2417
build_type: [Debug]
25-
c_compiler: [cl] # skip gcc & clang until ubuntu 24.04 is available in GHA
26-
# include:
27-
# - os: windows-latest
28-
# c_compiler: cl
29-
# cpp_compiler: cl
30-
# - os: ubuntu-latest
31-
# c_compiler: gcc
32-
# cpp_compiler: g++
33-
# exclude:
34-
# - os: windows-latest
35-
# c_compiler: gcc
36-
# - os: ubuntu-latest
37-
# c_compiler: cl
18+
c_compiler: [cl, gcc-14]
19+
include:
20+
- os: windows-latest
21+
c_compiler: cl
22+
cpp_compiler: cl
23+
- os: ubuntu-24.04
24+
c_compiler: gcc-14
25+
cpp_compiler: g++-14
26+
exclude:
27+
- os: windows-latest
28+
c_compiler: gcc-14
29+
- os: ubuntu-24.04
30+
c_compiler: cl
3831

3932
steps:
4033
- uses: actions/checkout@v4
4134

42-
- name: Set reusable strings
43-
# Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
44-
id: strings
45-
shell: bash
46-
run: |
47-
echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT"
48-
49-
# the current image contains an older version of gcc which doesn't support all needed C++23 features yet
50-
- name: Install latest gcc
51-
if: ${{ matrix.os == 'ubuntu-latest' }}
52-
uses: egor-tensin/setup-gcc@v1
53-
with:
54-
version: 13
35+
- name: Install CMake + Ninja
36+
uses: lukka/get-cmake@latest
5537

5638
# install dependencies of dependencies (based on CI failures)
5739
- name: install dependencies
58-
if: ${{ matrix.os == 'ubuntu-latest' }}
40+
if: ${{ matrix.os == 'ubuntu-24.04' }}
5941
run: |
6042
sudo apt-get update
61-
sudo apt-get install -y libxi-dev libxtst-dev libxrandr-dev
43+
sudo apt-get install -y libxi-dev libxtst-dev libxrandr-dev libx11-dev libxft-dev libxext-dev libltdl-dev
6244
6345
- name: Setup vcpkg (incl. caching)
6446
uses: lukka/run-vcpkg@v11
6547

66-
- name: Configure CMake
67-
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
68-
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
69-
run: >
70-
cmake -B ${{ steps.strings.outputs.build-output-dir }}
71-
-DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
72-
-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
73-
-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
74-
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
75-
-S ${{ github.workspace }}
76-
77-
- name: Build
78-
# Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
79-
run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
48+
- name: Run CMake
49+
uses: lukka/run-cmake@v10
50+
with:
51+
configurePreset: ninja-multi-vcpkg
52+
buildPreset: ninja-multi-vcpkg
53+
testPreset: ninja-multi-vcpkg
54+
configurePresetAdditionalArgs: "[
55+
'-DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}',
56+
'-DCMAKE_C_COMPILER=${{ matrix.c_compiler }}',
57+
'-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}'
58+
]"
59+
- name: upload logs
60+
if: ${{ failure() }}
61+
uses: actions/upload-artifact@v4
62+
with:
63+
name: vcpkg-buildtree-logs-${{ matrix.os }}
64+
path: |
65+
vcpkg/buildtrees/**/*.log
8066
81-
- name: Test
82-
working-directory: ${{ steps.strings.outputs.build-output-dir }}
83-
# Execute tests defined by the CMake configuration. Note that --build-config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
84-
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
85-
run: ctest --build-config ${{ matrix.build_type }} --output-on-failure
67+
# simplify GH settings: have one single build to be required
68+
build-results:
69+
name: Final Results
70+
if: ${{ always() }}
71+
runs-on: ubuntu-latest
72+
needs: [build]
73+
steps:
74+
- name: check for failed builds
75+
if: ${{ needs.build.result != 'success' }}
76+
run: exit 1

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.idea/
22
cmake-build*/
33
.ipynb_checkpoints/
4+
builds/

CMakePresets.json

+100
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
{
2+
"version": 6,
3+
"cmakeMinimumRequired": {
4+
"major": 3,
5+
"minor": 29,
6+
"patch": 0
7+
},
8+
"configurePresets": [
9+
{
10+
"name": "ninja-multi-vcpkg",
11+
"displayName": "Ninja Multi-Config Configure Settings",
12+
"description": "Configure with vcpkg toolchain",
13+
"binaryDir": "${sourceDir}/builds/${presetName}",
14+
"generator": "Ninja Multi-Config",
15+
"cacheVariables": {
16+
"CMAKE_TOOLCHAIN_FILE": {
17+
"type": "FILEPATH",
18+
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
19+
}
20+
}
21+
},
22+
{
23+
"name": "msbuild-vcpkg",
24+
"displayName": "MSBuild (vcpkg toolchain) Configure Settings",
25+
"description": "Configure with VS generators and with vcpkg toolchain",
26+
"binaryDir": "${sourceDir}/builds/${presetName}",
27+
"generator": "Visual Studio 17 2022",
28+
"architecture": {
29+
"strategy": "set",
30+
"value": "x64"
31+
},
32+
"cacheVariables": {
33+
"CMAKE_TOOLCHAIN_FILE": {
34+
"type": "FILEPATH",
35+
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
36+
}
37+
}
38+
}
39+
],
40+
"buildPresets": [
41+
{
42+
"name": "ninja-multi-vcpkg",
43+
"configurePreset": "ninja-multi-vcpkg",
44+
"displayName": "Build ninja-multi-vcpkg",
45+
"description": "Build ninja-multi-vcpkg Configurations"
46+
},
47+
{
48+
"name": "msbuild-vcpkg",
49+
"configurePreset": "msbuild-vcpkg",
50+
"displayName": "Build MSBuild",
51+
"description": "Build with MSBuild (VS)"
52+
}
53+
],
54+
"testPresets": [
55+
{
56+
"name": "ninja-multi-vcpkg",
57+
"configurePreset": "ninja-multi-vcpkg"
58+
},
59+
{
60+
"name": "msbuild-vcpkg",
61+
"configurePreset": "msbuild-vcpkg"
62+
}
63+
],
64+
"workflowPresets": [
65+
{
66+
"name": "ninja-workflow",
67+
"steps": [
68+
{
69+
"type": "configure",
70+
"name": "ninja-multi-vcpkg"
71+
},
72+
{
73+
"type": "build",
74+
"name": "ninja-multi-vcpkg"
75+
},
76+
{
77+
"type": "test",
78+
"name": "ninja-multi-vcpkg"
79+
}
80+
]
81+
},
82+
{
83+
"name": "msbuild-workflow",
84+
"steps": [
85+
{
86+
"type": "configure",
87+
"name": "msbuild-vcpkg"
88+
},
89+
{
90+
"type": "build",
91+
"name": "msbuild-vcpkg"
92+
},
93+
{
94+
"type": "test",
95+
"name": "msbuild-vcpkg"
96+
}
97+
]
98+
}
99+
]
100+
}

vcpkg.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name" : "banana-project",
33
"version-string" : "1.0.0",
4-
"builtin-baseline" : "501cb01e517ee5689577bb01ba8bd1b4c1041a53",
4+
"builtin-baseline" : "eba7c6a894fce24146af4fdf161fef8e90dd6be3",
55
"dependencies" : [ {
66
"name" : "gtest",
77
"version>=" : "1.14.0"

0 commit comments

Comments
 (0)