-
Notifications
You must be signed in to change notification settings - Fork 713
293 lines (252 loc) · 10.9 KB
/
build.yml
File metadata and controls
293 lines (252 loc) · 10.9 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
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
name: CI
on: [push, pull_request]
jobs:
build-and-test-ubuntu:
#if: false # Temporarily disable
name: Build And Test Ubuntu ${{ matrix.row }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- row: clang-openssl-baseline
compiler: clang
build_dir: build-ci-quick-clang
sanitizer: none
use_webrtc: false
crypto: default
crypto25519: default
targets: "test_connection test_p2p trivial_signaling_server publish_test_script test_crypto"
run_tests: true
tests: "test_crypto test_connection:suite-quick test_p2p.py:--spewlevel=debug:--loglevel-p2prendezvous=debug"
- row: gcc-openssl-crypto
compiler: gcc
build_dir: build-ci-quick-gcc
sanitizer: none
use_webrtc: false
crypto: default
crypto25519: default
targets: "test_connection test_p2p trivial_signaling_server publish_test_script test_crypto"
run_tests: true
tests: "test_crypto test_connection:suite-quick test_p2p.py:--spewlevel=debug:--loglevel-p2prendezvous=debug"
- row: clang-libsodium
compiler: clang
build_dir: build-ci-quick-sodium
sanitizer: none
use_webrtc: false
crypto: libsodium
crypto25519: libsodium
targets: "test_connection test_p2p trivial_signaling_server publish_test_script test_crypto"
run_tests: true
tests: "test_crypto test_connection:suite-quick test_p2p.py:--spewlevel=debug:--loglevel-p2prendezvous=debug"
- row: clang-reference-25519
compiler: clang
build_dir: build-ci-quick-ref25519
sanitizer: none
use_webrtc: false
crypto: default
crypto25519: Reference
targets: "test_connection test_p2p trivial_signaling_server publish_test_script test_crypto"
run_tests: true
tests: "test_crypto test_connection:suite-quick test_p2p.py:--spewlevel=debug:--loglevel-p2prendezvous=debug"
- row: clang-openssl-webrtc
compiler: clang
build_dir: build-ci-quick-webrtc
sanitizer: none
use_webrtc: true
crypto: default
crypto25519: default
targets: "test_connection test_p2p trivial_signaling_server publish_test_script test_crypto"
run_tests: true
tests: "test_crypto test_connection:suite-quick test_p2p.py:--spewlevel=debug:--loglevel-p2prendezvous=debug"
env:
CI_BUILD: 1
IMAGE: ubuntu
IMAGE_TAG: noble
steps:
- uses: actions/checkout@main
# Note only alpine needs "preinstall" step
- name: Update packages
run: sudo -E bash .github/update-packages.sh
- name: Install dependencies
run: |
sudo -E bash .github/install.sh
sudo -E bash .github/install-post.sh
- name: Setup mock IPs
run: sudo python3 tests/test_p2p.py --setup-mock-ips
- name: Build and test (RelWithDebInfo)
run: |
set -euo pipefail
args=(
--compiler "${{ matrix.compiler }}"
--build-dir "${{ matrix.build_dir }}"
--sanitizer "${{ matrix.sanitizer }}"
)
if [[ "${{ matrix.use_webrtc }}" == "true" ]]; then
args+=(--use-webrtc)
fi
if [[ "${{ matrix.crypto }}" != "default" ]]; then
args+=(--crypto "${{ matrix.crypto }}")
fi
if [[ "${{ matrix.crypto25519 }}" != "default" ]]; then
args+=(--crypto25519 "${{ matrix.crypto25519 }}")
fi
if [[ -n "${{ matrix.targets }}" ]]; then
read -r -a target_args <<< "${{ matrix.targets }}"
args+=(--targets "${target_args[@]}")
fi
if [[ "${{ matrix.run_tests }}" == "true" ]]; then
args+=(--run-tests)
if [[ -n "${{ matrix.tests }}" ]]; then
read -r -a test_args <<< "${{ matrix.tests }}"
args+=(--tests "${test_args[@]}")
fi
fi
python3 .github/run-single-config.py "${args[@]}"
- name: Build (Release)
run: |
set -euo pipefail
args=(
--compiler "${{ matrix.compiler }}"
--build-dir "build-release"
--build-type Release
--sanitizer none
)
if [[ "${{ matrix.use_webrtc }}" == "true" ]]; then
args+=(--use-webrtc)
fi
if [[ "${{ matrix.crypto }}" != "default" ]]; then
args+=(--crypto "${{ matrix.crypto }}")
fi
if [[ "${{ matrix.crypto25519 }}" != "default" ]]; then
args+=(--crypto25519 "${{ matrix.crypto25519 }}")
fi
python3 .github/run-single-config.py "${args[@]}"
- name: Build (Debug)
run: |
set -euo pipefail
args=(
--compiler "${{ matrix.compiler }}"
--build-dir "build-debug"
--build-type Debug
--sanitizer none
)
if [[ "${{ matrix.use_webrtc }}" == "true" ]]; then
args+=(--use-webrtc)
fi
if [[ "${{ matrix.crypto }}" != "default" ]]; then
args+=(--crypto "${{ matrix.crypto }}")
fi
if [[ "${{ matrix.crypto25519 }}" != "default" ]]; then
args+=(--crypto25519 "${{ matrix.crypto25519 }}")
fi
python3 .github/run-single-config.py "${args[@]}"
# Don't do it this way. This causes the main badge to
# go red if one of the flavors fails.
## Trigger testing of more linux flavors
#- name: Trigger linux flavors build
# uses: peter-evans/repository-dispatch@v2
# with:
# event-type: build-linux-flavors
build-and-test-windows:
#if: false # Temporarily disable
name: Build And Test Windows ${{ matrix.os-version }} ${{ matrix.crypto }}
runs-on: windows-${{ matrix.os-version }}
strategy:
fail-fast: false
matrix:
# Windows Server 2019 has been retired. The Windows Server 2019 image has been removed as of 2025-06-30. For more details, see https://github.com/actions/runner-images/issues/12045
os-version: [2022, 2025]
crypto: [OpenSSL, BCrypt]
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
VCPKG_DEFAULT_BINARY_CACHE: ${{ github.workspace }}/vcpkg-bincache
VCPKG_BINARY_SOURCES: clear;files,${{ github.workspace }}/vcpkg-bincache,readwrite
steps:
- uses: actions/checkout@main
- name: Setup mock IPs
run: py -3 tests/test_p2p.py --setup-mock-ips
shell: cmd
# Mark all directories as safe so checkouts performed in CMakeLists.txt don't cause "unsafe repository" errors.
# See https://github.com/actions/checkout/issues/766
- name: Configure Git
run: git config --global --add safe.directory '*'
shell: cmd
- uses: lukka/get-cmake@latest
# Setup MSVC command prompt environment vars.
# We must do this before sedtting up our local vcpkg,
# Because it will set VCPKG_ROOT to point to some global
# install of vcpkg, and we don't want that
- uses: ilammy/msvc-dev-cmd@v1
- name: set VCPKG_ROOT
run: |
"VCPKG_ROOT=${{ github.workspace }}/vcpkg" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
shell: pwsh
- name: Setup local vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git "${{ env.VCPKG_ROOT }}"
cd /d "${{ env.VCPKG_ROOT }}"
git checkout 522253caf47268c1724f486a035e927a42a90092
call bootstrap-vcpkg.bat -disableMetrics
shell: cmd
- name: Ensure vcpkg cache directories exist
run: |
New-Item -ItemType Directory -Path "${{ env.VCPKG_ROOT }}/downloads" -Force | Out-Null
New-Item -ItemType Directory -Path "${{ env.VCPKG_DEFAULT_BINARY_CACHE }}" -Force | Out-Null
shell: pwsh
- name: Restore vcpkg caches
uses: actions/cache@v4
with:
path: |
${{ env.VCPKG_ROOT }}/downloads
${{ env.VCPKG_DEFAULT_BINARY_CACHE }}
key: vcpkg-${{ runner.os }}-${{ matrix.os-version }}-${{ matrix.crypto }}-${{ env.VCToolsVersion }}-522253caf47268c1724f486a035e927a42a90092-${{ hashFiles('vcpkg.json') }}
restore-keys: |
vcpkg-${{ runner.os }}-${{ matrix.os-version }}-${{ matrix.crypto }}-${{ env.VCToolsVersion }}-
vcpkg-${{ runner.os }}-${{ matrix.os-version }}-${{ matrix.crypto }}-
- name: vcpkg check / install dependencies
working-directory: '${{ github.workspace }}'
run: '"${{env.VCPKG_ROOT}}\vcpkg" install --vcpkg-root "${{env.VCPKG_ROOT}}" --triplet=x64-windows'
shell: cmd
- name: Configure CMake (RelWithDebInfo)
run: |
mkdir build
cd build
cmake -S .. -G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON "-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DUSE_CRYPTO=${{matrix.crypto}}
shell: cmd
- name: Build (RelWithDebInfo)
working-directory: '${{ github.workspace }}/build'
run: ninja
shell: cmd
- name: Test crypto
working-directory: '${{ github.workspace }}/build/bin'
run: test_crypto.exe
shell: cmd
- name: Test connection
working-directory: '${{ github.workspace }}/build/bin'
run: test_connection.exe suite-quick
shell: cmd
- name: Test p2p
working-directory: '${{ github.workspace }}/build/bin'
run: py -3 test_p2p.py --spewlevel=debug --loglevel-p2prendezvous=debug
shell: cmd
- name: Configure CMake (Release)
run: |
mkdir build-release
cd build-release
cmake -S .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON "-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DUSE_CRYPTO=${{matrix.crypto}}
shell: cmd
- name: Build (Release)
working-directory: '${{ github.workspace }}/build-release'
run: ninja
shell: cmd
- name: Configure CMake (Debug)
run: |
mkdir build-debug
cd build-debug
cmake -S .. -G Ninja -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=cl -DCMAKE_CXX_COMPILER=cl -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_TOOLS=ON "-DCMAKE_TOOLCHAIN_FILE=${{env.VCPKG_ROOT}}/scripts/buildsystems/vcpkg.cmake" -DUSE_CRYPTO=${{matrix.crypto}}
shell: cmd
- name: Build (Debug)
working-directory: '${{ github.workspace }}/build-debug'
run: ninja
shell: cmd