-
Notifications
You must be signed in to change notification settings - Fork 5
105 lines (88 loc) · 3.11 KB
/
Copy pathamalgamate.yml
File metadata and controls
105 lines (88 loc) · 3.11 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
# Copyright 2025 Matt Borland
# Distributed under the Boost Software License, Version 1.0.
# https://www.boost.org/LICENSE_1_0.txt
#
# Regenerates the amalgamated single header in extra/single_include/ whenever
# the real headers change on develop, and commits the result back.
# The paths filter below does not include extra/single_include/, and the bot
# commit carries [skip ci], so the push-back cannot retrigger this workflow
# or the main CI.
name: amalgamate
on:
workflow_dispatch:
push:
branches:
- develop
paths:
- 'include/**'
- 'extra/amalgamate.py'
- '.github/workflows/amalgamate.yml'
concurrency:
group: ${{format('{0}:amalgamate', github.repository)}}
cancel-in-progress: false
permissions:
contents: write
jobs:
regenerate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Regenerate the single header
run: python3 extra/amalgamate.py
- name: Smoke test the single header
run: |
cat > "${RUNNER_TEMP}/smoke.cpp" << 'EOF'
// Smoke test for the amalgamated single header. Verifies the header is
// self-contained and core operations work end to end.
#include <boost/int128.hpp>
#include <iostream>
#include <limits>
#include <sstream>
int main()
{
using namespace boost::int128;
using namespace boost::int128::literals;
const auto a {BOOST_INT128_UINT128_C(340282366920938463463374607431768211455)};
const auto b {18446744073709551615_u128};
const auto c {-1234567890123456789_i128};
if (a / b != 18446744073709551617_u128)
{
return 1;
}
if (popcount(a) != 128)
{
return 2;
}
if (saturating_add(a, b) != (std::numeric_limits<uint128>::max)())
{
return 3;
}
if (c + c != -2469135780246913578_i128)
{
return 4;
}
std::ostringstream os {};
os << a;
if (os.str() != "340282366920938463463374607431768211455")
{
return 5;
}
std::cout << "Single header smoke test passed" << std::endl;
return 0;
}
EOF
for std in c++14 c++20; do
g++ -std=${std} -Wall -Wextra -I extra/single_include "${RUNNER_TEMP}/smoke.cpp" -o "${RUNNER_TEMP}/smoke"
"${RUNNER_TEMP}/smoke"
done
- name: Commit and push if changed
run: |
git add extra/single_include
if git diff --cached --quiet; then
echo 'Single header is already up to date'
else
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git commit -m "Regenerate amalgamated single header from ${GITHUB_SHA} [skip ci]"
git push origin "HEAD:${GITHUB_REF_NAME}"
fi