Repository navigation
263 lines (234 loc) · 9.18 KB
/
Copy pathci.yml
File metadata and controls
263 lines (234 loc) · 9.18 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
#
# Copyright 2020-2021 Peter Dimov
# Copyright 2021 Andrey Semashev
# Copyright 2021-2024 Alexander Grund
# Copyright 2022-2025 James E. King III
#
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at http://boost.org/LICENSE_1_0.txt)
#
# This workflow uses the Boost.CI reusable workflow which builds a variety of
# configurations of your project, runs tests, and generates code coverage reports.
#
# To use it, copy this file into your repository as `.github/workflows/ci.yml` and
# customize it appropriately.
#
---
name: Boost.CI
permissions:
contents: read
id-token: write
pages: write
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
- develop
- bugfix/**
- feature/**
- fix/**
- github/**
- pr/**
paths-ignore:
- LICENSE
- meta/**
# - README.md
jobs:
call-boost-ci:
name: Run Boost.CI
uses: boostorg/boost-ci/.github/workflows/reusable.yml@master
with:
exclude_cxxstd: '98,03,0x,11,14'
exclude_compiler: gcc-4.9,gcc-5,gcc-6,gcc-7,gcc-8,gcc-9,clang-3.9,clang-4.0,clang-5.0,clang-6.0,clang-7,clang-16
timeout: 180
enable_multiarch: false
# exclude clang-16 because it seems to use the c++14 standard library on ubuntu-24.04:
# include/c++/14/bits/stl_pair.h:410:35: error: no matching function for call to 'get'
# maybe similar to this: https://github.com/actions/runner-images/issues/9679
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
COVERITY_SCAN_NOTIFICATION_EMAIL: ${{ secrets.COVERITY_SCAN_NOTIFICATION_EMAIL }}
COVERITY_SCAN_TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
reflection:
name: C++26 reflection
runs-on: ubuntu-24.04
steps:
- name: Install GCC 16
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-16 cmake ninja-build
- name: Clone Boost.OpenMethod
uses: actions/checkout@v4
- name: Clone Boost
uses: alandefreitas/cpp-actions/boost-clone@v1.8.8
with:
# boost-clone excludes `test` and `tests` from the scan
# (modules-exclude-paths defaults to them), so it never sees the
# includes in our own test/ and would clone neither Boost.Test nor
# Boost.DLL - CMake then fails to generate on a missing
# Boost::unit_test_framework. `modules` is unioned with the scan,
# and their own dependencies are resolved afterwards.
modules: test dll
branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
boost-dir: ../boost-source
scan-modules-dir: .
scan-modules-ignore: openmethod
# The suite is the reflection test: BOOST_OPENMETHOD_TEST_CLASSES expands
# to nothing here, so every class has to be found by the scan that
# BOOST_OPENMETHOD_REGISTER_CLASSES starts. BUILD_SHARED_LIBS brings in
# test/dynamic_loading, where the registrar that scan instantiates - one
# inline variable per class, for the whole program - crosses module
# boundaries.
- name: Build and test
run: |
cmake -S . -B ../build -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_CXX_COMPILER=g++-16 \
-DBUILD_SHARED_LIBS=ON \
-DBOOST_OPENMETHOD_ENABLE_REFLECTION=ON \
-DBOOST_OPENMETHOD_BUILD_TESTS=ON \
-DBOOST_OPENMETHOD_WARNINGS_AS_ERRORS=ON \
-DBOOST_SRC_DIR="$(cd .. && pwd)/boost-source"
cmake --build ../build --target tests -j $(nproc)
ctest --test-dir ../build -j $(nproc) --output-on-failure
file-size:
name: File size
# Only meaningful for a pull request: github.event.pull_request is unset
# on a push, and a push's commits are only ever ones already checked here
# as part of the PR that introduced them.
if: github.event_name == 'pull_request'
runs-on: ubuntu-24.04
steps:
- name: Clone Boost.OpenMethod
uses: actions/checkout@v4
with:
fetch-depth: 0
# Every blob any commit in the PR introduces, not just the files that
# differ in the final base...head diff - a commit that adds an
# oversized file and a later commit in the same PR that shrinks or
# removes it still leaves that blob in history forever once merged.
# Same limit and message as the local dev/git-hooks/pre-commit hook
# (dev/check-blob-size), so a contributor who skipped installing it
# still can't land an oversized file.
- name: Check for oversized blobs
run: |
status=0
git rev-list "${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}" |
while read -r c; do
git diff-tree -r --no-commit-id --diff-filter=ACMR "$c"
done | awk '{print $4, $NF}' | sort -u > /tmp/blobs.txt
while read -r oid path; do
dev/check-blob-size "$oid" "$path" || status=1
done < /tmp/blobs.txt
exit "$status"
flat-headers:
name: Flat headers
runs-on: ubuntu-24.04
steps:
# ce/reflection.cpp needs C++26 reflection; dev/check-flat.sh finds this
# compiler on its own, and reports the example as skipped without it.
- name: Install GCC 16
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-16
- name: Clone Boost.OpenMethod
uses: actions/checkout@v4
- name: Clone Boost
uses: alandefreitas/cpp-actions/boost-clone@v1.8.8
with:
branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
boost-dir: ../boost-source
scan-modules-dir: .
scan-modules-ignore: openmethod
# Each flattened header must compile after boost/openmethod.hpp, and fail
# with our own diagnostic without it; the ce/ examples must build and run
# against the generated tree.
- name: Check the flat headers
env:
BOOST_SRC_DIR: ${{ github.workspace }}/../boost-source
run: dev/check-flat.sh
antora:
name: Antora docs
strategy:
matrix:
include:
- { name: Windows, os: windows-latest }
- { name: Ubuntu, os: ubuntu-latest }
- { name: macOS, os: macos-15 }
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Install packages
uses: alandefreitas/cpp-actions/package-install@v1.8.8
with:
apt-get: git cmake
- name: Clone Boost.OpenMethod
uses: actions/checkout@v4
- name: Clone Boost
uses: alandefreitas/cpp-actions/boost-clone@v1.8.8
id: boost-clone
with:
branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
boost-dir: ../boost-source
scan-modules-dir: .
scan-modules-ignore: openmethod
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Setup Ninja
if: runner.os == 'Windows'
uses: seanmiddleditch/gha-setup-ninja@v5
- name: Build Antora docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config --global --add safe.directory "$(pwd)"
cd ..
BOOST_SRC_DIR="$(pwd)/boost-source"
export BOOST_SRC_DIR
cd openmethod
cd doc
bash ./build_antora.sh
# Antora returns zero even if it fails, so we check if the site directory exists.
if [ ! -d "html" ]
then
echo "Antora build failed"
exit 1
fi
# Published alongside the docs, at the root of the site, so that a
# Compiler Explorer example can include them by URL. See ce/README.md.
- name: Build flat headers
if: matrix.os == 'ubuntu-latest'
# The base URL goes into the banner and the guard-check messages of
# every generated header, so it has to name the site this artifact is
# about to be deployed to - jll63's fork, or boostorg.
run: |
python3 dev/flatten.py --output-dir doc/html \
--base-url "https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}"
- name: Create Antora docs artifact
uses: actions/upload-artifact@v4
with:
name: antora-docs-${{ matrix.name }}
path: doc/html
- name: Upload static files as artifact
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-pages-artifact@v3
with:
path: doc/html
# Upstream deploys from develop only - every other branch would clobber
# the site. The fork has no such restriction: it is where a branch is
# tried out before it is merged.
- name: Deploy to GitHub Pages
if: >-
matrix.os == 'ubuntu-latest'
&& github.event_name != 'pull_request'
&& (github.repository == 'jll63/openmethod'
|| (github.repository == 'boostorg/openmethod'
&& github.ref_name == 'develop'))
uses: actions/deploy-pages@v4