-
Notifications
You must be signed in to change notification settings - Fork 1
190 lines (173 loc) · 6.61 KB
/
Copy pathci.yml
File metadata and controls
190 lines (173 loc) · 6.61 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
name: CI
# Work happens on dev and lands on main, so main is the only branch worth spending runners on.
# workflow_dispatch is there to repeat a run without pushing.
on:
push:
branches: [ main ]
workflow_dispatch:
jobs:
# Two axes, crossed only where the code paths cross.
#
# Shape runs on every platform. It decides dllexport against visibility, and whether a plugin
# and its host share one type table, and that differs per platform.
#
# Turning exceptions off does not need every platform. The flag is chosen by MSVC against
# not-MSVC, and the rest of what varies is the standard library underneath, so three platforms
# cover both compiler families and all three standard libraries. That is the no-exceptions job
# below.
build:
name: ${{ matrix.platform }} ${{ matrix.config }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform: [ linux-gcc, linux-clang, macos, windows-msvc, windows-clang-cl ]
config: [ shared, static, release ]
include:
- platform: linux-gcc
os: ubuntu-latest
cc: gcc
cxx: g++
- platform: linux-clang
os: ubuntu-latest
cc: clang
cxx: clang++
- platform: macos
os: macos-latest
cc: clang
cxx: clang++
- platform: windows-msvc
os: windows-latest
cc: cl
cxx: cl
- platform: windows-clang-cl
os: windows-latest
cc: clang-cl
cxx: clang-cl
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Settings for this configuration
id: cfg
shell: bash
run: |
case "${{ matrix.config }}" in
shared) flags="-DSTDC_BUILD_SHARED=ON"; type=Debug ;;
static) flags="-DSTDC_BUILD_STATIC=ON"; type=Debug ;;
release) flags="-DSTDC_BUILD_SHARED=ON"; type=Release ;;
esac
echo "flags=$flags" >> "$GITHUB_OUTPUT"
echo "type=$type" >> "$GITHUB_OUTPUT"
- name: Configure
shell: bash
env:
CC: ${{ matrix.cc }}
CXX: ${{ matrix.cxx }}
run: |
cmake -G Ninja -S . -B build \
-DCMAKE_BUILD_TYPE=${{ steps.cfg.outputs.type }} \
-DSTDC_BUILD_TESTS=ON \
${{ steps.cfg.outputs.flags }}
- name: Build
run: cmake --build build
# ctest rather than the binary by name, so that where it landed is CMake's business. The
# flag is not optional. ctest exits 0 when it finds no tests at all, which is what a test
# CMakeLists that could not find Boost once produced here.
- name: Test
run: ctest --test-dir build --output-on-failure --no-tests=error
# Exceptions switched off. Four platforms rather than five, the fifth being linux-clang, whose
# frontend and standard library are both covered by one of the others.
#
# windows-clang-cl earns its place and used to be left out on the reasoning that three standard
# libraries covered it. That was the wrong axis. What varies is whether the frontend enforces
# the flag: cl accepts a throw under /EHs-c- and only stops unwinding, clang-cl rejects it the
# way -fno-exceptions does. So registry.h, whose throwing overloads are inline and therefore
# compiled by every translation unit that includes it, built there and nowhere else.
#
# The flag is private to the library target, so the tests are built the ordinary way and run
# against a library that was not. A consumer gets the same split. This is also the only thing
# here that runs the library's exception-free branches: STDC_HAS_EXCEPTIONS is worked out per
# translation unit from __cpp_exceptions, so the code under those #ifdefs is compiled by this
# job and by nothing else.
no-exceptions:
name: ${{ matrix.platform }} no-exceptions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
platform: [ linux-gcc, macos, windows-msvc, windows-clang-cl ]
include:
- platform: linux-gcc
os: ubuntu-latest
cxx: g++
- platform: macos
os: macos-latest
cxx: clang++
- platform: windows-msvc
os: windows-latest
cxx: cl
- platform: windows-clang-cl
os: windows-latest
cxx: clang-cl
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup
- name: Configure
shell: bash
env:
CXX: ${{ matrix.cxx }}
run: |
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug -DSTDC_BUILD_TESTS=ON \
-DSTDC_ENABLE_EXCEPTIONS=OFF
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure --no-tests=error
# Doxygen is a check as much as an output. WARN_AS_ERROR in the Doxyfile is what makes this
# step fail rather than quietly produce a wrong page. Its first run found three defects,
# including a \param naming an argument the function never had.
#
# One platform is enough. It reads the headers, and the Doxyfile predefines the platform
# switches itself.
docs:
name: docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Ninja and Doxygen
run: |
sudo apt-get update
sudo apt-get install -y ninja-build doxygen
- name: Build
run: |
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug -DSTDC_BUILD_DOCS=ON
cmake --build build --target stdcorelib_docs
# MinGW builds the library but does not run the tests: Boost.Test for MinGW is its own
# undertaking, and what is worth knowing here is that the Windows sources compile and link
# against something other than the Microsoft toolchain.
mingw:
name: windows-mingw ${{ matrix.config }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
config: [ shared, static ]
steps:
- uses: actions/checkout@v4
- uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: false
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
- name: Build
shell: msys2 {0}
run: |
case "${{ matrix.config }}" in
shared) flags="-DSTDC_BUILD_SHARED=ON" ;;
static) flags="-DSTDC_BUILD_STATIC=ON" ;;
esac
cmake -G Ninja -S . -B build -DCMAKE_BUILD_TYPE=Debug -DSTDC_BUILD_TESTS=OFF $flags
cmake --build build