-
Notifications
You must be signed in to change notification settings - Fork 3
299 lines (266 loc) · 10.6 KB
/
Copy pathci.yml
File metadata and controls
299 lines (266 loc) · 10.6 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
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
# Copyright 2025 Nana Sakisaka
#
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
name: CI
on:
pull_request:
push:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
BOOST_SPIRIT_X4_BUILD_JOBS: 4
jobs:
changes:
runs-on: ubuntu-latest
outputs:
spirit_component: ${{ steps.filter.outputs.changes }}
x4: ${{ steps.filter.outputs.x4 }}
steps:
- uses: actions/checkout@v5
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
x4:
- '.github/workflows/*.yml'
- 'CMakeLists.txt'
- 'test/CMakeLists.txt'
- 'include/boost/spirit/x4/**/*'
- 'include/boost/spirit/x4.hpp'
- 'test/x4/**/*'
- '!**/Jamfile'
build:
name: "[${{ matrix.cpp_version.name }}] ${{ matrix.spirit_component }} | ${{ matrix.compiler.toolset }}-${{ matrix.compiler.version }} (${{ matrix.build_type.name }}) @ ${{ matrix.os.name }}-${{ matrix.os.version }}"
needs: changes
if: ${{ needs.changes.outputs.spirit_component != '[]' && needs.changes.outputs.spirit_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
spirit_component: ${{ fromJSON(needs.changes.outputs.spirit_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
with:
# required for upstream Boost version detection
# sadly not working due to upstream bug: https://github.com/actions/checkout/issues/1471
fetch-tags: true
- name: Fetch git tags
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- 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"
export BOOST_RELEASE_VERSION_NAME=$(git for-each-ref refs/tags --sort=-refname --format='%(refname:lstrip=-1)' --count=1)
echo "BOOST_RELEASE_VERSION_NAME: $BOOST_RELEASE_VERSION_NAME"
echo "BOOST_RELEASE_VERSION_NAME=$BOOST_RELEASE_VERSION_NAME" >> "$GITHUB_OUTPUT"
if [ "${{ matrix.os.name }}" = "windows" ]; then
export BOOST_ROOT=$(cygpath -w $HOME/boost)
else
export BOOST_ROOT=$HOME/boost
fi
echo "BOOST_ROOT: $BOOST_ROOT"
echo "BOOST_ROOT=$BOOST_ROOT" >> "$GITHUB_OUTPUT"
- name: Cache upstream Boost libraries (restore)
id: cache-boost
uses: actions/cache/restore@v4
with:
key: ${{ steps.env-info.outputs.BOOST_RELEASE_VERSION_NAME }}-${{ 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: |
${{ steps.env-info.outputs.BOOST_ROOT }}
!${{ steps.env-info.outputs.BOOST_ROOT }}/.git
- name: Clone upstream Boost libraries
if: steps.cache-boost.outputs.cache-hit != 'true'
shell: bash
run: |
git -c advice.detachedHead=false clone --no-tags \
--single-branch --branch=${{ steps.env-info.outputs.BOOST_RELEASE_VERSION_NAME }} \
--depth=1 --filter=blob:none --quiet https://github.com/boostorg/boost.git \
"${{ steps.env-info.outputs.BOOST_ROOT }}"
cd "${{ steps.env-info.outputs.BOOST_ROOT }}"
git submodule update --init --depth 1 --recursive -- \
tools/build \
tools/boost_install \
libs/assert \
libs/bind \
libs/config \
libs/container_hash \
libs/core \
libs/describe \
libs/detail \
libs/function \
libs/function_types \
libs/functional \
libs/fusion \
libs/integer \
libs/io \
libs/mp11 \
libs/mpl \
libs/predef \
libs/preprocessor \
libs/static_assert \
libs/throw_exception \
libs/tuple \
libs/type_index \
libs/type_traits \
libs/typeof \
libs/utility \
libs/variant
- name: Build upstream Boost libraries (Ubuntu)
if: matrix.os.name == 'ubuntu' && steps.cache-boost.outputs.cache-hit != 'true'
env:
BOOST_ROOT: ${{ steps.env-info.outputs.BOOST_ROOT }}
working-directory: ${{ steps.env-info.outputs.BOOST_ROOT }}
shell: bash
run: |
set -xe
rm -rf libs/spirit_x4
./bootstrap.sh --with-toolset=${{ matrix.compiler.toolset }}
./b2 -d0 headers
- name: Build upstream Boost libraries (Windows)
if: matrix.os.name == 'windows' && steps.cache-boost.outputs.cache-hit != 'true'
env:
BOOST_ROOT: ${{ steps.env-info.outputs.BOOST_ROOT }}
working-directory: ${{ steps.env-info.outputs.BOOST_ROOT }}
shell: cmd
run: |
rd /s /q libs\spirit_x4
.\bootstrap.bat --with-toolset=${{ matrix.compiler.toolset }}
.\b2 -d0 headers
- name: Cache upstream Boost libraries (save)
if: steps.cache-boost.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-boost.outputs.cache-primary-key }}
path: |
${{ steps.env-info.outputs.BOOST_ROOT }}
!${{ steps.env-info.outputs.BOOST_ROOT }}/.git
- 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: ${{ steps.env-info.outputs.BOOST_ROOT }}/libs/spirit_x4/build/_deps
# Adapt CMP0168; enable caching in CI
# https://cmake.org/cmake/help/latest/module/FetchContent.html#variable:FETCHCONTENT_UPDATES_DISCONNECTED
- name: Setup Cached CMake Dependencies
id: deps-info
shell: bash
run: |
if [ "${{ steps.cache-deps.outputs.cache-hit }}" = "true" ]; then
echo "BOOST_SPIRIT_X4_CMAKE_ARGS=-DFETCHCONTENT_FULLY_DISCONNECTED=ON" >> "$GITHUB_OUTPUT"
else
echo "BOOST_SPIRIT_X4_CMAKE_ARGS=" >> "$GITHUB_OUTPUT"
fi
- name: Configure
env:
BOOST_ROOT: ${{ steps.env-info.outputs.BOOST_ROOT }}
working-directory: ${{ steps.env-info.outputs.BOOST_ROOT }}
shell: bash
run: |
set -xe
cp -rp "${{ github.workspace }}" libs/
cd libs/spirit_x4
cmake ${{ steps.deps-info.outputs.BOOST_SPIRIT_X4_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 }} \
-S .
- name: Build Tests
working-directory: ${{ steps.env-info.outputs.BOOST_ROOT }}/libs/spirit_x4
run: |
cmake --build build --config ${{ matrix.build_type.name }} -j${{ env.BOOST_SPIRIT_X4_BUILD_JOBS }} ${{ matrix.compiler.builder_additional_args }}
- name: Cache CMake Dependencies (save)
if: steps.cache-deps.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache-deps.outputs.cache-primary-key }}
path: ${{ steps.env-info.outputs.BOOST_ROOT }}/libs/spirit_x4/build/_deps
- name: Test
env:
CLICOLOR_FORCE: 1
working-directory: ${{ steps.env-info.outputs.BOOST_ROOT }}/libs/spirit_x4/build/test
run: ctest --output-on-failure -C ${{ matrix.build_type.name }}