Repository navigation
214 lines (187 loc) · 7.04 KB
/
Copy pathci.yml
File metadata and controls
214 lines (187 loc) · 7.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# SPDX-License-Identifier: MIT
name: CI
on:
pull_request:
push:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
IRIS_BUILD_JOBS: 4
jobs:
changes:
runs-on: ubuntu-latest
outputs:
iris_component: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
iris:
- '.github/workflows/*.yml'
- 'CMakeLists.txt'
- 'include/iris/**/*'
- 'test/CMakeLists.txt'
- 'test/**/*'
build:
name: "[${{ matrix.cpp_version.name }}] ${{ matrix.iris_component }} | ${{ matrix.compiler.toolset }}-${{ matrix.compiler.version }} (${{ matrix.build_type.name }}) @ ${{ matrix.os.name }}-${{ matrix.os.version }}"
needs: changes
if: ${{ needs.changes.outputs.iris_component != '[]' && needs.changes.outputs.iris_component != '' }}
runs-on: ${{ matrix.os.name }}-${{ matrix.os.version }}
strategy:
fail-fast: false
matrix:
os:
- name: ubuntu
version: 24.04
- name: windows
version: 2022
build_type:
- name: Debug
lowercase: debug
- name: Release
lowercase: release
cpp_version:
- name: C++23
number: 23
- name: C++26
number: 26
compiler:
- name: GCC
toolset: gcc
version: 14
executable: g++-14
cxxflags: -fdiagnostics-color=always
- name: Clang
toolset: clang
version: 21
executable: clang++-21
cxxflags: -stdlib=libc++ -fcolor-diagnostics
- name: MSVC
toolset: msvc
version: 2022
builder_additional_args: -- "-consoleLoggerParameters:ForceConsoleColor"
executable: cl
iris_component: ${{ fromJSON(needs.changes.outputs.iris_component) }}
exclude:
# Blacklist all invalid combinations of environments
- os:
name: windows
compiler:
name: GCC
- os:
name: windows
compiler:
name: Clang
- os:
name: ubuntu
compiler:
name: MSVC
steps:
- uses: actions/checkout@v5
- name: Initialize Ubuntu
if: matrix.os.name == 'ubuntu'
run: |
sudo echo "set man-db/auto-update false" | sudo debconf-communicate
sudo dpkg-reconfigure man-db
- name: Setup GCC
if: matrix.compiler.toolset == 'gcc'
run: |
sudo apt-get update
sudo apt-get install -y g++-${{ matrix.compiler.version }}
- name: Setup Clang
if: matrix.compiler.toolset == 'clang'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x ./llvm.sh
sudo ./llvm.sh ${{ matrix.compiler.version }}
sudo apt-get install -y libc++-${{ matrix.compiler.version }}-dev libc++abi-${{ matrix.compiler.version }}-dev libunwind-${{ matrix.compiler.version }}-dev
- uses: TheMrMilchmann/setup-msvc-dev@v3
if: matrix.os.name == 'windows'
with:
arch: x64
- name: Fetch Environment Info
id: env-info
shell: bash
run: |
set -e
case "${{ matrix.compiler.toolset }}" in
"gcc")
COMPILER_FULL_VERSION=$(${{ matrix.compiler.executable }} -dumpfullversion -dumpversion)
;;
"clang")
COMPILER_FULL_VERSION=$(${{ matrix.compiler.executable }} -dumpversion)
;;
"msvc")
COMPILER_FULL_VERSION=$(powershell -NoProfile -Command "(Get-Command ${{ matrix.compiler.executable }}).FileVersionInfo.FileVersion")
;;
esac
echo "COMPILER_FULL_VERSION=$COMPILER_FULL_VERSION"
echo "compiler-full-version=$COMPILER_FULL_VERSION" >> "$GITHUB_OUTPUT"
- name: Cache CMake Dependencies (restore)
id: cache-deps
uses: actions/cache/restore@v4
with:
key: deps-${{ matrix.os.name }}-${{ matrix.os.version }}-${{ matrix.compiler.toolset }}-${{ steps.env-info.outputs.compiler-full-version }}-${{ matrix.cpp_version.name }}-${{ matrix.build_type.name }}
path: |
${{ github.workspace }}/build/_deps
${{ github.workspace }}/build/.iris_deps_build_stamp
# Adapt CMP0168; enable caching in CI
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_FULLY_DISCONNECTED
- name: Setup Cached CMake Dependencies
id: deps-info
shell: bash
run: |
if [ "${{ steps.cache-deps.outputs.cache-hit }}" = "true" ]; then
echo "IRIS_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT"
else
echo "IRIS_CMAKE_ARGS=" >> "$GITHUB_OUTPUT"
fi
- name: Configure
shell: bash
run: |
set -xe
cmake ${{ steps.deps-info.outputs.IRIS_CMAKE_ARGS }} -B build \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler.executable }} \
-DCMAKE_CXX_FLAGS="${{ matrix.compiler.cxxflags }}" \
-DCMAKE_CXX_STANDARD=${{ matrix.cpp_version.number }} \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type.name }} \
-DIRIS_CI=ON \
-S .
- name: Check Deps build time stamp (pre-build)
id: pre-build-check
shell: bash
run: |
if [ -e build/.iris_deps_build_stamp ]; then
echo "deps-timestamp=$(stat -c %Y build/.iris_deps_build_stamp)" >> $GITHUB_OUTPUT
else
echo "deps-timestamp=0" >> $GITHUB_OUTPUT
fi
- name: Try building Deps
run: |
cmake --build build --config ${{ matrix.build_type.name }} -j${{ env.IRIS_BUILD_JOBS }} --target iris_deps_build_check ${{ matrix.compiler.builder_additional_args }}
- name: Check Deps build time stamp (post-build)
id: post-build-check
shell: bash
run: |
echo "deps-timestamp=$(stat -c %Y build/.iris_deps_build_stamp)" >> $GITHUB_OUTPUT
- name: Build Tests
run: |
cmake --build build --config ${{ matrix.build_type.name }} -j${{ env.IRIS_BUILD_JOBS }} ${{ matrix.compiler.builder_additional_args }}
- name: Cache CMake Dependencies (save)
if: steps.cache-deps.outputs.cache-hit != 'true' || steps.pre-build-check.outputs.deps-timestamp != steps.post-build-check.outputs.deps-timestamp
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-deps.outputs.cache-primary-key }}
path: |
${{ github.workspace }}/build/_deps
${{ github.workspace }}/build/.iris_deps_build_stamp
- name: Test
env:
CLICOLOR_FORCE: 1
working-directory: ${{ github.workspace }}/build
run: ctest --output-on-failure -C ${{ matrix.build_type.name }}