Debian Codegraph @

.github/workflows/ci.yml

raw symbols SCIP
1 name: D++ CI
2 on:
3 push:
4 paths:
5 - '**Dockerfile'
6 - '**.cxx'
7 - '**.cpp'
8 - '**.h'
9 - '**.hpp'
10 - '**.cmake'
11 - '**ci.yml'
12 - '**CMakeLists.txt'
13 - '!**/docpages/**' # Never allow docpages to build CI from doc PRs.
14 pull_request:
15 paths:
16 - '**Dockerfile'
17 - '**.cxx'
18 - '**.cpp'
19 - '**.h'
20 - '**.hpp'
21 - '**.cmake'
22 - '**ci.yml'
23 - '**CMakeLists.txt'
24 - '!**/docpages/**'
25
26 permissions:
27 contents: read
28
29 jobs:
30 linux:
31 permissions:
32 contents: write
33 concurrency:
34 group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.cfg.arch }}-(${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }})
35 cancel-in-progress: true
36 name: Linux ${{ matrix.cfg.arch }} (${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }}${{ matrix.cfg.name-extra }})
37 runs-on: ${{ matrix.cfg.os }}
38 strategy:
39 fail-fast: false # Don't fail everything if one fails. We want to test each OS/Compiler individually
40 matrix:
41 # GitHub hosted runners on Azure
42 # arm7hf is a self-hosted docker-based runner at Brainbox.cc. Raspberry Pi 4, 8gb 4-core with NEON
43 cfg:
44 # clang++
45 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-11, cpp: clang++, version: 11, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
46 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-12, cpp: clang++, version: 12, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
47 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-13, cpp: clang++, version: 13, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
48 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-14, cpp: clang++, version: 14, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
49 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: clang-15, cpp: clang++, version: 15, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
50 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: clang-16, cpp: clang++, version: 16, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
51 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: clang-17, cpp: clang++, version: 17, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
52 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: clang-18, cpp: clang++, version: 18, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
53 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: clang-19, cpp: clang++, version: 19, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
54 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: clang-20, cpp: clang++, version: 20, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
55 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: 'clang-21 libc++-21-dev libc++abi-21-dev', cpp: clang++, version: 21, cmake-flags: '-DCMAKE_CXX_FLAGS="-stdlib=libc++" -DCMAKE_EXE_LINKER_FLAGS="-stdlib=libc++"', cpack: 'no', ctest: 'no', mold: 'yes', name-extra: ' libc++', llvm-apt: 'yes' }
56 # g++
57 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: g++-10, cpp: g++, version: 10, cmake-flags: '-DDPP_NO_CORO=ON', cpack: 'no', ctest: 'no', mold: 'yes' }
58 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: g++-11, cpp: g++, version: 11, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
59 - { arch: 'amd64', concurrency: 4, os: ubuntu-22.04, package: g++-12, cpp: g++, version: 12, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
60 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: g++-13, cpp: g++, version: 13, cmake-flags: '', cpack: 'yes', ctest: 'yes', mold: 'yes' }
61 - { arch: 'amd64', concurrency: 4, os: ubuntu-24.04, package: g++-14, cpp: g++, version: 14, cmake-flags: '', cpack: 'no', ctest: 'no', mold: 'yes' }
62 # Self hosted
63 - { arch: 'arm7hf', concurrency: 4, os: [self-hosted, linux, ARM], package: g++-12, cpp: g++, version: 12, cmake-flags: '', cpack: 'yes', ctest: 'no', mold: 'no' }
64 - { arch: 'arm64', concurrency: 4, os: [self-hosted, linux, ARM64], package: g++-12, cpp: g++, version: 12, cmake-flags: '', cpack: 'yes', ctest: 'no', mold: 'yes' }
65 steps:
66 - name: Harden Runner
67 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
68 with:
69 egress-policy: audit
70
71 - name: Checkout D++
72 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
73
74 - name: Setup mold
75 if: ${{ matrix.cfg.mold == 'yes' }}
76 uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
77
78 - name: Add LLVM apt repository
79 if: ${{ matrix.cfg.llvm-apt }}
80 run: |
81 osname=`cat /etc/os-release | grep -e "^VERSION_CODENAME" | cut -d= -f2`
82 wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
83 sudo apt-add-repository -y "deb http://apt.llvm.org/$osname/ llvm-toolchain-$osname-${{ matrix.cfg.version }} main"
84
85 - name: Install apt packages
86 run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt update && sudo apt-get install -y ${{ matrix.cfg.package }} pkg-config libopus-dev zlib1g-dev rpm
87
88 - name: Generate CMake
89 run: cmake -B build -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DCMAKE_BUILD_TYPE=Release ${{matrix.cfg.cmake-flags}}
90 env:
91 CXX: ${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }}
92
93 - name: Build Project
94 run: cd build && make -j${{ matrix.cfg.concurrency }}
95
96 - name: Run unit tests
97 if: ${{ matrix.cfg.ctest == 'yes' }}
98 run: cd build/library && ./unittest
99 env:
100 DPP_UNIT_TEST_TOKEN: ${{secrets.DPP_UNIT_TEST_TOKEN}}
101 TEST_GUILD_ID: ${{secrets.TEST_GUILD_ID}}
102 TEST_TEXT_CHANNEL_ID: ${{secrets.TEST_TEXT_CHANNEL_ID}}
103 TEST_VC_ID: ${{secrets.TEST_VC_ID}}
104 TEST_USER_ID: ${{secrets.TEST_USER_ID}}
105 TEST_EVENT_ID: ${{secrets.TEST_EVENT_ID}}
106
107 - name: Package distributable
108 if: ${{ matrix.cfg.cpack == 'yes' }}
109 run: cd build && cpack --verbose
110
111 - name: Upload Binary (DEB)
112 if: ${{ matrix.cfg.cpack == 'yes' }}
113 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
114 with:
115 name: "libdpp - Debian Package ${{matrix.cfg.arch}}"
116 path: '${{github.workspace}}/build/*.deb'
117
118 - name: Upload Binary (RPM)
119 if: ${{ matrix.cfg.cpack == 'yes' }}
120 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
121 with:
122 name: "libdpp - RPM Package ${{matrix.cfg.arch}}"
123 path: '${{github.workspace}}/build/*.rpm'
124
125 macos:
126 permissions:
127 contents: write
128 name: macOS ${{ matrix.cfg.arch }} (${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }})
129 runs-on: ${{ matrix.cfg.os }}
130 strategy:
131 fail-fast: false # Don't fail everything if one fails. We want to test each OS/Compiler individually
132 matrix:
133 cfg:
134 - { arch: 'arm64', concurrency: 3, os: macos-latest, cpp: clang++, version: 26, cmake-flags: '', xcode-version: '26' }
135 steps:
136 - name: Harden Runner
137 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
138 with:
139 egress-policy: audit
140
141 - name: Checkout D++
142 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
143
144 - name: Update Xcode
145 uses: maxim-lobanov/setup-xcode@60606e260d2fc5762a71e64e74b2174e8ea3c8bd # v1.6.0
146 with:
147 xcode-version: ${{ matrix.cfg.xcode-version }}
148
149 - name: Install homebrew packages
150 run: brew install make opus openssl
151
152 - name: Generate CMake
153 run: cmake -B build -DDPP_NO_VCPKG=ON -DCMAKE_BUILD_TYPE=Release -DDPP_CORO=ON -DAVX_TYPE=AVX0
154 env:
155 DONT_RUN_VCPKG: true
156
157 - name: Build Project
158 run: cmake --build build -j${{ matrix.cfg.concurrency }}
159 env:
160 DONT_RUN_VCPKG: true
161
162 - name: Run offline unit tests
163 run: cd build/library && ./unittest
164
165 windows: # Windows x64 and x86 build matrix
166 permissions:
167 contents: write
168 strategy:
169 fail-fast: false # Don't cancel other matrix jobs if one fails
170 matrix:
171 cfg:
172 - { name: 'x64', arch: x64, config: Release, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '' }
173 - { name: 'x64', arch: x64, config: Debug, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '' }
174 - { name: 'x86', arch: x86, config: Release, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '-T host=x86' }
175 - { name: 'x86', arch: x86, config: Debug, vs: '2022', os: 'windows-2022', vsv: '17', upload: true, options: '-T host=x86' }
176 - { name: 'x64-Clang', arch: x64, config: Debug, vs: '2022', os: 'windows-2022', vsv: '17', upload: false, options: '-T ClangCL' }
177
178 name: "Windows ${{matrix.cfg.name}}-${{matrix.cfg.config}}-vs${{matrix.cfg.vs}}"
179 runs-on: ${{matrix.cfg.os}}
180 steps:
181 - name: Harden Runner
182 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
183 with:
184 egress-policy: audit
185
186 - name: Checkout D++
187 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
188 with:
189 path: main
190
191 - name: Add MSBuild to PATH
192 uses: microsoft/setup-msbuild@30375c66a4eea26614e0d39710365f22f8b0af57 # v3.0.0
193
194 - name: Install chocolatey packages ${{ matrix.cfg.arch}}
195 uses: seanmiddleditch/gha-setup-ninja@3b1f8f94a2f8254bd26914c4ab9474d4f0015f67 # master
196
197 - name: Generate CMake (x64)
198 if: ${{ matrix.cfg.arch == 'x64' }}
199 run: mkdir main/build && cd main/build && cmake -G "Visual Studio ${{matrix.cfg.vsv}} ${{matrix.cfg.vs}}" -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DDPP_USE_PCH=on ${{matrix.cfg.options}} ..
200 env:
201 DONT_RUN_VCPKG: true
202
203 - name: Generate CMake (x86)
204 if: ${{ matrix.cfg.arch == 'x86' }}
205 run: mkdir main/build && cd main/build && cmake -DCMAKE_TOOLCHAIN_FILE="cmake\Win32Toolchain.cmake" -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DDPP_USE_PCH=on -G "Visual Studio ${{matrix.cfg.vsv}} ${{matrix.cfg.vs}}" -A Win32 ${{matrix.cfg.options}} ..
206 env:
207 DONT_RUN_VCPKG: true
208
209 - name: Build Project
210 run: cmake --build main/build --target dpp --config ${{matrix.cfg.config}} --parallel 2
211 env:
212 DONT_RUN_VCPKG: true
213
214 - name: Move debug files for packaging
215 if: ${{ matrix.cfg.config == 'Debug' }}
216 run: xcopy main\build\library\Debug\* main\build\library\Release\ /s /q
217
218 - name: Package distributable
219 run: cd main/build && cpack --verbose
220 env:
221 DONT_RUN_VCPKG: true
222
223 - name: Upload Binary
224 if: ${{ matrix.cfg.upload }}
225 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
226 with:
227 name: "libdpp - Windows ${{matrix.cfg.name}}-${{matrix.cfg.config}}-vs${{matrix.cfg.vs}}"
228 path: '${{github.workspace}}/main/build/*.zip'
229
230 cross-compiles:
231 permissions:
232 contents: write
233 strategy:
234 fail-fast: false
235 matrix:
236 cfg:
237 # Replaced with self-hosted runner
238 - {name: "Linux x86", os: ubuntu-24.04, cmake-options: -DCMAKE_TOOLCHAIN_FILE=cmake/LINUXx86ToolChain.cmake -DBUILD_VOICE_SUPPORT=OFF}
239 - {name: "ARMv6", os: ubuntu-24.04, cmake-options: -DDPP_NO_CORO=ON -DCMAKE_TOOLCHAIN_FILE=cmake/ARMv6ToolChain.cmake}
240
241 name: ${{matrix.cfg.name}}
242 runs-on: ${{matrix.cfg.os}}
243 steps:
244 - name: Harden Runner
245 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
246 with:
247 egress-policy: audit
248
249 - name: Checkout D++
250 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
251
252 - name: Install Packages
253 run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt update && sudo apt-get install -y cmake rpm
254
255 - name: Generate CMakeFiles
256 run: mkdir build && cd build && sudo cmake ${{matrix.cfg.cmake-options}} -DDPP_NO_VCPKG=ON -DCMAKE_BUILD_TYPE=Release -DAVX_TYPE=AVX0 ..
257
258 - name: Compile Source
259 run: cd build && sudo make -j2
260
261 - name: Package Distributable
262 run: cd build && sudo cpack --verbose || cat /home/runner/work/DPP/DPP/build/_CPack_Packages/Linux/DEB/PreinstallOutput.log
263
264 - name: Upload Binaries (DEB)
265 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
266 with:
267 name: "libdpp - Debian Package ${{matrix.cfg.name}}"
268 path: "${{github.workspace}}/build/*.deb"
269
270 - name: Upload Binaries (RPM)
271 uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
272 with:
273 name: "libdpp - RPM Package ${{matrix.cfg.name}}"
274 path: "${{github.workspace}}/build/*.rpm"
275
276 # Static library build (BUILD_SHARED_LIBS=OFF)
277 static-linux:
278 permissions:
279 contents: read
280 concurrency:
281 group: ${{ github.workflow }}-${{ github.ref }}-static-${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }}
282 cancel-in-progress: true
283 name: Static Linux (${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }})
284 runs-on: ${{ matrix.cfg.os }}
285 strategy:
286 fail-fast: false
287 matrix:
288 cfg:
289 - { os: ubuntu-24.04, package: g++-13, cpp: g++, version: 13, concurrency: 4 }
290 - { os: ubuntu-24.04, package: clang-20, cpp: clang++, version: 20, concurrency: 4 }
291 steps:
292 - name: Harden Runner
293 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
294 with:
295 egress-policy: audit
296
297 - name: Checkout D++
298 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
299
300 - name: Setup mold
301 uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
302
303 - name: Install apt packages
304 run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt update && sudo apt-get install -y ${{ matrix.cfg.package }} pkg-config libopus-dev zlib1g-dev libssl-dev rpm
305
306 - name: Generate CMake
307 run: cmake -B build -DBUILD_SHARED_LIBS=OFF -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DCMAKE_BUILD_TYPE=Release
308 env:
309 CXX: ${{ matrix.cfg.cpp }}-${{ matrix.cfg.version }}
310
311 - name: Build Project
312 run: cd build && make -j${{ matrix.cfg.concurrency }}
313
314 # Install D++ and consume it from a separate project via find_package(dpp)
315 install-consumer:
316 permissions:
317 contents: read
318 name: Install & find_package(dpp)
319 runs-on: ubuntu-24.04
320 steps:
321 - name: Harden Runner
322 uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
323 with:
324 egress-policy: audit
325
326 - name: Checkout D++
327 uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
328
329 - name: Setup mold
330 uses: rui314/setup-mold@9c9c13bf4c3f1adef0cc596abc155580bcb04444 # v1
331
332 - name: Install apt packages
333 run: sudo sed -i 's/azure\.//' /etc/apt/sources.list && sudo apt update && sudo apt-get install -y g++-13 pkg-config libopus-dev zlib1g-dev libssl-dev
334
335 - name: Build and install D++
336 run: |
337 cmake -B build -DDPP_NO_VCPKG=ON -DAVX_TYPE=AVX0 -DCMAKE_BUILD_TYPE=Release -DDPP_BUILD_TEST=OFF -DCMAKE_INSTALL_PREFIX="$GITHUB_WORKSPACE/_install"
338 cmake --build build -j$(nproc)
339 cmake --install build
340 env:
341 CXX: g++-13
342
343 - name: Consume D++ via find_package
344 run: |
345 mkdir -p consumer && cd consumer
346 cat > CMakeLists.txt <<'EOF'
347 cmake_minimum_required(VERSION 3.16)
348 project(dpp_consumer CXX)
349 find_package(dpp REQUIRED)
350 add_executable(consumer main.cpp)
351 target_link_libraries(consumer dpp::dpp)
352 EOF
353 cat > main.cpp <<'EOF'
354 #include <dpp/dpp.h>
355 int main() { dpp::cluster bot("token"); return 0; }
356 EOF
357 cmake -B build -DCMAKE_PREFIX_PATH="$GITHUB_WORKSPACE/_install" -DCMAKE_BUILD_TYPE=Release
358 cmake --build build -j$(nproc)
359 env:
360 CXX: g++-13