-
Notifications
You must be signed in to change notification settings - Fork 1k
173 lines (168 loc) · 6.1 KB
/
Copy pathmodules-ci.yml
File metadata and controls
173 lines (168 loc) · 6.1 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
name: C++20 Modules CI
on: [push, workflow_dispatch, pull_request]
env:
# Enable verbose output for CMake and tests
VERBOSE: 1
CTEST_OUTPUT_ON_FAILURE: 1
jobs:
ubuntu-clang-modules:
strategy:
matrix:
buildType: [Debug, Release]
runs-on: ubuntu-latest
steps:
- name: Update package list
run: sudo apt update
- name: Install Dependencies
run: |
sudo apt install -y git libssl-dev build-essential libcurl4-openssl-dev libpsl-dev meson libunistring-dev ninja-build wget
# Install Clang 21+
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 21
sudo apt install -y libc++-21-dev libc++abi-21-dev
env:
DEBIAN_FRONTEND: noninteractive
- name: Install CMake 3.28+
run: |
wget -O cmake.sh https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh
sudo sh cmake.sh --prefix=/usr/local --skip-license
cmake --version
- name: Checkout
uses: actions/checkout@v5
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=${{ matrix.buildType }} \
-DCMAKE_CXX_COMPILER=clang++-21 \
-DCMAKE_C_COMPILER=clang-21 \
-DCPR_BUILD_MODULES=ON \
-DCPR_BUILD_TESTS=ON \
-DCPR_BUILD_TESTS_SSL=ON \
-DCPR_FORCE_OPENSSL_BACKEND=ON \
-DCPR_USE_SYSTEM_CURL=OFF \
-G Ninja
- name: Build
run: cmake --build build --verbose
- name: Test
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
- name: Verify Module Build
run: |
echo "Contents of build/modules:"
ls -la build/modules/
if [ -f build/modules/libcpr_module.a ] || [ -f build/modules/libcpr_module.so ] || [ -f build/modules/cpr_module.a ] || find build/modules -name "*cpr_module*" -type f | grep -q .; then
echo "Module library built successfully"
else
echo "Error: Module library not found"
exit 1
fi
fedora-gcc-modules:
runs-on: ubuntu-latest
container: "fedora:latest"
steps:
- name: Update package list
run: dnf update -y
- name: Install Dependencies
run: dnf install -y gcc g++ git make openssl-devel libcurl-devel cmake libpsl-devel libunistring-devel meson ninja-build
- name: Checkout
uses: actions/checkout@v5
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCPR_BUILD_MODULES=ON \
-DCPR_BUILD_TESTS=ON \
-DCPR_BUILD_TESTS_SSL=ON \
-DCPR_FORCE_OPENSSL_BACKEND=ON \
-DCPR_USE_SYSTEM_CURL=OFF \
-G Ninja
- name: Build
run: cmake --build build --verbose
- name: Test
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
- name: Verify Module Build
run: |
echo "Searching for module build artifacts:"
find build -name "*cpr_module*" -type f || true
find build -name "cpr.gcm" -type f || true
# GCC stores the compiled module interface (BMI) as cpr.gcm rather than
# a traditional archive when all sources are in FILE_SET CXX_MODULES.
# Also check build/lib/ in case LIBRARY_OUTPUT_PATH redirected the archive.
if find build \( -name "*cpr_module*" -o -name "cpr.gcm" \) -type f | grep -q .; then
echo "Module build artifacts found successfully"
else
echo "Error: No module build artifacts found"
exit 1
fi
windows-msvc-modules:
runs-on: windows-latest
steps:
- uses: actions/setup-python@v6
- name: Install meson
run: pip install meson
- name: Setup MSVC environment
uses: ilammy/msvc-dev-cmd@v1
- name: Checkout
uses: actions/checkout@v5
- name: Install dependencies via vcpkg
run: |
vcpkg install curl zlib openssl --triplet x64-windows
shell: pwsh
- name: Configure
run: |
cmake -S . -B build `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE="C:/vcpkg/scripts/buildsystems/vcpkg.cmake" `
-DVCPKG_TARGET_TRIPLET=x64-windows `
-DCPR_BUILD_MODULES=ON `
-DCPR_BUILD_TESTS=ON `
-DCPR_BUILD_TESTS_SSL=OFF `
-DCPR_USE_SYSTEM_CURL=ON `
-G "Visual Studio 17 2022"
shell: pwsh
- name: Build
run: cmake --build build --config Release --verbose
- name: Test
run: ctest --test-dir build -C Release --output-on-failure --repeat until-pass:5
- name: Verify Module Build
run: |
Write-Host "Contents of build/modules/Release:"
Get-ChildItem -Path build/modules/Release -Force
if (!(Test-Path "build/modules/Release/cpr_module.lib") -and !(Get-ChildItem -Path build/modules -Recurse -Filter "*cpr_module*")) {
throw "Module library not found"
}
Write-Host "Module library built successfully"
shell: pwsh
macos-clang-modules:
runs-on: macos-latest
steps:
- name: Install Dependencies
run: |
brew install llvm libpsl ninja
- name: Checkout
uses: actions/checkout@v5
- name: Configure
run: |
cmake -S . -B build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=$(brew --prefix llvm)/bin/clang++ \
-DCMAKE_C_COMPILER=$(brew --prefix llvm)/bin/clang \
-DCPR_BUILD_MODULES=ON \
-DCPR_BUILD_TESTS=ON \
-DCPR_BUILD_TESTS_SSL=OFF \
-DCPR_USE_SYSTEM_LIB_PSL=ON \
-G Ninja
- name: Build
run: cmake --build build --verbose
- name: Test
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
- name: Verify Module Build
run: |
echo "Contents of build/modules:"
ls -la build/modules/
if [ -f build/modules/libcpr_module.a ] || [ -f build/modules/libcpr_module.dylib ] || [ -f build/modules/cpr_module.a ] || find build/modules -name "*cpr_module*" -type f | grep -q .; then
echo "Module library built successfully"
else
echo "Error: Module library not found"
exit 1
fi