Skip to content

Commit f7b110a

Browse files
Add modules CI for building the modules
1 parent 5e0e1b9 commit f7b110a

1 file changed

Lines changed: 182 additions & 0 deletions

File tree

.github/workflows/modules-ci.yml

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
name: C++20 Modules CI
2+
on: [push, workflow_dispatch, pull_request]
3+
4+
env:
5+
# Enable verbose output for CMake and tests
6+
VERBOSE: 1
7+
CTEST_OUTPUT_ON_FAILURE: 1
8+
9+
jobs:
10+
ubuntu-gcc-modules:
11+
strategy:
12+
matrix:
13+
container: ["ubuntu:latest"]
14+
buildType: [Debug, Release]
15+
runs-on: ubuntu-latest
16+
container: ${{ matrix.container }}
17+
steps:
18+
- name: Update package list
19+
run: apt update
20+
- name: Install Dependencies
21+
run: apt install -y git libssl-dev build-essential gcc-15 g++-15 libcurl4-openssl-dev libpsl-dev meson libunistring-dev ninja-build wget
22+
env:
23+
DEBIAN_FRONTEND: noninteractive
24+
- name: Install CMake 3.28+
25+
run: |
26+
wget -O cmake.sh https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh
27+
sh cmake.sh --prefix=/usr/local --skip-license
28+
cmake --version
29+
- name: Checkout
30+
uses: actions/checkout@v5
31+
- name: Configure
32+
run: |
33+
cmake -S . -B build \
34+
-DCMAKE_BUILD_TYPE=${{ matrix.buildType }} \
35+
-DCMAKE_CXX_COMPILER=g++-15 \
36+
-DCMAKE_C_COMPILER=gcc-15 \
37+
-DCPR_BUILD_MODULES=ON \
38+
-DCPR_BUILD_TESTS=ON \
39+
-DCPR_BUILD_TESTS_SSL=ON \
40+
-DCPR_FORCE_OPENSSL_BACKEND=ON \
41+
-DCPR_USE_SYSTEM_CURL=OFF \
42+
-G Ninja
43+
- name: Build
44+
run: cmake --build build --verbose
45+
- name: Test
46+
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
47+
- name: Verify Module Build
48+
run: |
49+
test -f build/modules/libcpr_module.a || test -f build/modules/libcpr_module.so || test -f build/modules/cpr_module.lib
50+
echo "Module library built successfully"
51+
52+
ubuntu-clang-modules:
53+
strategy:
54+
matrix:
55+
buildType: [Debug, Release]
56+
runs-on: ubuntu-latest
57+
steps:
58+
- name: Update package list
59+
run: sudo apt update
60+
- name: Install Dependencies
61+
run: |
62+
sudo apt install -y git libssl-dev build-essential libcurl4-openssl-dev libpsl-dev meson libunistring-dev ninja-build wget
63+
# Install Clang 21+
64+
wget https://apt.llvm.org/llvm.sh
65+
chmod +x llvm.sh
66+
sudo ./llvm.sh 21
67+
sudo apt install -y libc++-21-dev libc++abi-21-dev
68+
env:
69+
DEBIAN_FRONTEND: noninteractive
70+
- name: Install CMake 3.28+
71+
run: |
72+
wget -O cmake.sh https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh
73+
sudo sh cmake.sh --prefix=/usr/local --skip-license
74+
cmake --version
75+
- name: Checkout
76+
uses: actions/checkout@v5
77+
- name: Configure
78+
run: |
79+
cmake -S . -B build \
80+
-DCMAKE_BUILD_TYPE=${{ matrix.buildType }} \
81+
-DCMAKE_CXX_COMPILER=clang++-21 \
82+
-DCMAKE_C_COMPILER=clang-21 \
83+
-DCPR_BUILD_MODULES=ON \
84+
-DCPR_BUILD_TESTS=ON \
85+
-DCPR_BUILD_TESTS_SSL=ON \
86+
-DCPR_FORCE_OPENSSL_BACKEND=ON \
87+
-DCPR_USE_SYSTEM_CURL=OFF \
88+
-G Ninja
89+
- name: Build
90+
run: cmake --build build --verbose
91+
- name: Test
92+
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
93+
- name: Verify Module Build
94+
run: |
95+
test -f build/modules/libcpr_module.a || test -f build/modules/libcpr_module.so
96+
echo "Module library built successfully"
97+
98+
fedora-gcc-modules:
99+
runs-on: ubuntu-latest
100+
container: "fedora:latest"
101+
steps:
102+
- name: Update package list
103+
run: dnf update -y
104+
- name: Install Dependencies
105+
run: dnf install -y gcc g++ git make openssl-devel libcurl-devel cmake libpsl-devel libunistring-devel meson ninja-build
106+
- name: Checkout
107+
uses: actions/checkout@v5
108+
- name: Configure
109+
run: |
110+
cmake -S . -B build \
111+
-DCMAKE_BUILD_TYPE=Release \
112+
-DCPR_BUILD_MODULES=ON \
113+
-DCPR_BUILD_TESTS=ON \
114+
-DCPR_BUILD_TESTS_SSL=ON \
115+
-DCPR_FORCE_OPENSSL_BACKEND=ON \
116+
-DCPR_USE_SYSTEM_CURL=OFF \
117+
-G Ninja
118+
- name: Build
119+
run: cmake --build build --verbose
120+
- name: Test
121+
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
122+
- name: Verify Module Build
123+
run: |
124+
test -f build/modules/libcpr_module.a || test -f build/modules/libcpr_module.so
125+
echo "Module library built successfully"
126+
127+
windows-msvc-modules:
128+
runs-on: windows-latest
129+
steps:
130+
- uses: actions/setup-python@v6
131+
- name: Install meson
132+
run: pip install meson
133+
- name: Setup MSVC environment
134+
uses: ilammy/msvc-dev-cmd@v1
135+
- name: Checkout
136+
uses: actions/checkout@v5
137+
- name: Configure
138+
run: |
139+
cmake -S . -B build `
140+
-DCMAKE_BUILD_TYPE=Release `
141+
-DCPR_BUILD_MODULES=ON `
142+
-DCPR_BUILD_TESTS=ON `
143+
-DCPR_BUILD_TESTS_SSL=OFF `
144+
-G "Visual Studio 17 2022"
145+
shell: pwsh
146+
- name: Build
147+
run: cmake --build build --config Release --verbose
148+
- name: Test
149+
run: ctest --test-dir build -C Release --output-on-failure --repeat until-pass:5
150+
- name: Verify Module Build
151+
run: |
152+
if (!(Test-Path "build/modules/Release/cpr_module.lib")) {
153+
throw "Module library not found"
154+
}
155+
Write-Host "Module library built successfully"
156+
shell: pwsh
157+
158+
macos-clang-modules:
159+
runs-on: macos-latest
160+
steps:
161+
- name: Install Dependencies
162+
run: |
163+
brew install libpsl ninja
164+
- name: Checkout
165+
uses: actions/checkout@v5
166+
- name: Configure
167+
run: |
168+
cmake -S . -B build \
169+
-DCMAKE_BUILD_TYPE=Release \
170+
-DCPR_BUILD_MODULES=ON \
171+
-DCPR_BUILD_TESTS=ON \
172+
-DCPR_BUILD_TESTS_SSL=OFF \
173+
-DCPR_USE_SYSTEM_LIB_PSL=ON \
174+
-G Ninja
175+
- name: Build
176+
run: cmake --build build --verbose
177+
- name: Test
178+
run: ctest --test-dir build --output-on-failure --repeat until-pass:5
179+
- name: Verify Module Build
180+
run: |
181+
test -f build/modules/libcpr_module.a || test -f build/modules/libcpr_module.dylib
182+
echo "Module library built successfully"

0 commit comments

Comments
 (0)