-
-
Notifications
You must be signed in to change notification settings - Fork 204
433 lines (394 loc) · 15.3 KB
/
ci.yml
File metadata and controls
433 lines (394 loc) · 15.3 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
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
name: CI
on:
push:
branches:
- master
- "release/**"
paths-ignore:
- "*.md"
pull_request:
paths-ignore:
- "*.md"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 # v4 # v2
- run: make style
build-ios-inproc:
name: Xcode Build for inproc on iOS
runs-on: macos-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 # v4 # v2
with:
submodules: "recursive"
- run: |
cmake -B sentry-native-xcode -GXcode -DCMAKE_SYSTEM_NAME=iOS -DSENTRY_BACKEND=inproc
xcodebuild build -project sentry-native-xcode/Sentry-Native.xcodeproj -sdk iphonesimulator
build-ios-breakpad:
name: Xcode Build for breakpad on iOS
runs-on: macos-latest
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 # v4 # v2
with:
submodules: "recursive"
- run: |
cmake -B sentry-native-xcode -GXcode -DCMAKE_SYSTEM_NAME=iOS -DSENTRY_BACKEND=breakpad
xcodebuild build -project sentry-native-xcode/Sentry-Native.xcodeproj -sdk iphonesimulator
test:
strategy:
fail-fast: false
matrix:
include:
# toolchain per runner-image availability:
# ubuntu 22.04
# GCC: 9-12
# clang: 11-15
# kcov: 9-12
# ubuntu 24.04
# GCC: 9-14
# clang: 16-20
# kcov: 9-14
# note:
# Since available GCCs on 22.04 are a strict
# subset of the ones available on 24.04, we
# run all GCC tests on the latter version.
- name: Linux (GCC 9.5.0, 32-bit)
os: ubuntu-24.04
CC: gcc-9
CXX: g++-9
TEST_X86: 1
- name: Linux (GCC 9.5.0)
os: ubuntu-24.04
CC: gcc-9
CXX: g++-9
- name: Linux (GCC 12.3.0)
os: ubuntu-24.04
CC: gcc-12
CXX: g++-12
- name: Linux Arm64 (GCC 14.2.0)
os: ubuntu-24.04-arm
CC: gcc-14
CXX: g++-14
- name: Linux (GCC 14.2.0)
os: ubuntu-24.04
CC: gcc-14
CXX: g++-14
- name: Linux Arm64 (GCC 14.2.0 + tsan)
os: ubuntu-24.04-arm
CC: gcc-14
CXX: g++-14
RUN_ANALYZER: tsan
- name: Linux (GCC 14.2.0 + tsan)
os: ubuntu-24.04
CC: gcc-14
CXX: g++-14
RUN_ANALYZER: tsan
- name: Linux (clang 11)
os: ubuntu-22.04
CC: clang-11
CXX: clang++-11
- name: Linux (clang 20 + asan + llvm-cov)
os: ubuntu-24.04
CC: clang-20
CXX: clang++-20
ERROR_ON_WARNINGS: 1
RUN_ANALYZER: asan,llvm-cov
- name: Linux Arm64 (clang 20 + asan + llvm-cov)
os: ubuntu-24.04-arm
CC: clang-20
CXX: clang++-20
ERROR_ON_WARNINGS: 1
RUN_ANALYZER: asan,llvm-cov
- name: Linux (clang 20 + tsan)
os: ubuntu-24.04
CC: clang-20
CXX: clang++-20
ERROR_ON_WARNINGS: 1
RUN_ANALYZER: tsan
- name: Linux Arm64 (clang 20 + tsan)
os: ubuntu-24.04-arm
CC: clang-20
CXX: clang++-20
ERROR_ON_WARNINGS: 1
RUN_ANALYZER: tsan
- name: Linux (clang 20 + kcov)
os: ubuntu-24.04
CC: clang-20
CXX: clang++-20
ERROR_ON_WARNINGS: 1
RUN_ANALYZER: kcov
- name: Linux (GCC 13.3.0 + code-checker + valgrind)
CC: gcc-13
CXX: g++-13
os: ubuntu-24.04
RUN_ANALYZER: code-checker,valgrind
- name: Linux (GCC + musl + libunwind)
os: ubuntu-latest
container: ghcr.io/getsentry/sentry-native-alpine:3.21
CMAKE_DEFINES: -DSENTRY_LIBUNWIND_SHARED=OFF
CC: gcc
CXX: g++
SYSTEM_PYTHON: 1
- name: Linux (clang + musl + libunwind)
os: ubuntu-latest
container: ghcr.io/getsentry/sentry-native-alpine:3.21
CMAKE_DEFINES: -DSENTRY_LIBUNWIND_SHARED=OFF
CC: clang
CXX: clang++
SYSTEM_PYTHON: 1
- name: macOS 14 (xcode llvm)
os: macos-14
ERROR_ON_WARNINGS: 1
SYSTEM_VERSION_COMPAT: 0
- name: macOS 14 (xcode llvm + universal)
os: macos-14
ERROR_ON_WARNINGS: 1
SYSTEM_VERSION_COMPAT: 0
CMAKE_DEFINES: -DCMAKE_OSX_ARCHITECTURES=arm64;x86_64
- name: macOS 15 (clang 18 + asan + llvm-cov)
os: macos-15-large
CC: clang
CXX: clang++
ERROR_ON_WARNINGS: 1
SYSTEM_VERSION_COMPAT: 0
RUN_ANALYZER: asan,llvm-cov
- name: Windows (old VS, 32-bit)
os: windows-2022
TEST_X86: 1
- name: Windows (latest)
os: windows-latest
- name: Windows (latest, UTF-8 paths)
os: windows-latest
UTF8_TEST_CWD: 1
- name: Windows ClangCL (latest)
os: windows-latest
VS_GENERATOR_TOOLSET: ClangCL
- name: LLVM-Mingw
os: windows-latest
TEST_MINGW: 1
MINGW_PKG_PREFIX: x86_64-w64-mingw32
MINGW_ASM_MASM_COMPILER: llvm-ml
MINGW_ASM_MASM_FLAGS: -m64
# The Android emulator is currently only available on macos, see:
# https://docs.microsoft.com/en-us/azure/devops/pipelines/ecosystems/android?view=azure-devops#test-on-the-android-emulator
# TODO: switch to reactivecircus/android-emulator-runner, concurrently running emulators continuously fail now.
# - name: Android (API 31, NDK 23)
# os: macos-15-large
# ANDROID_API: 31
# ANDROID_NDK: 23.2.8568313
# ANDROID_ARCH: x86_64
- name: Android (API 35, NDK 27)
os: macos-15-large
ANDROID_API: 35
ANDROID_NDK: 27.2.12479018
ANDROID_ARCH: x86_64
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
env:
CC: ${{ matrix.CC }}
CXX: ${{ matrix.CXX }}
TEST_X86: ${{ matrix.TEST_X86 }}
TEST_MINGW: ${{ matrix.TEST_MINGW }}
ERROR_ON_WARNINGS: ${{ matrix.ERROR_ON_WARNINGS }}
RUN_ANALYZER: ${{ matrix.RUN_ANALYZER }}
ANDROID_API: ${{ matrix.ANDROID_API }}
ANDROID_NDK: ${{ matrix.ANDROID_NDK }}
ANDROID_ARCH: ${{ matrix.ANDROID_ARCH }}
CMAKE_DEFINES: ${{ matrix.CMAKE_DEFINES }}
SYSTEM_VERSION_COMPAT: ${{ matrix.SYSTEM_VERSION_COMPAT }}
VS_GENERATOR_TOOLSET: ${{ matrix.VS_GENERATOR_TOOLSET }}
SYSTEM_PYTHON: ${{ matrix.SYSTEM_PYTHON }}
UTF8_TEST_CWD: ${{ matrix.UTF8_TEST_CWD }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 # v4 # v2
with:
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: ${{ !env['SYSTEM_PYTHON'] && '3.12' || '' }}
cache: "pip"
- name: Check Linux CC/CXX
if: ${{ runner.os == 'Linux' && !matrix.container }}
run: |
[ -n "$CC" ] && [ -n "$CXX" ] || { echo "Ubuntu runner configurations require toolchain selection via CC and CXX" >&2; exit 1; }
- name: Installing Linux Dependencies
if: ${{ runner.os == 'Linux' && !env['TEST_X86'] && !matrix.container }}
run: |
sudo apt update
# Install common dependencies
sudo apt install cmake llvm valgrind zlib1g-dev libcurl4-openssl-dev
# For GCC, install both gcc-X and g++-X. For Clang, only install clang-X (includes C++ compiler)
if [[ "$CC" == gcc-* ]]; then
sudo apt install "${CC}" "${CXX}"
elif [[ "$CC" == clang-* ]]; then
sudo apt install "${CC}"
else
echo "Unknown CC: $CC" >&2
exit 1
fi
- name: Installing kcov dependencies
if: ${{ contains(env['RUN_ANALYZER'], 'kcov') }}
run: |
# Install kcov from source
sudo apt-get install binutils-dev libssl-dev libelf-dev libstdc++-14-dev libdw-dev libiberty-dev
git clone https://github.com/SimonKagstrom/kcov.git
cd kcov
# pin to a known good version with the coveralls git integration and performance bottlenecks fixed
git checkout b370df05ccc96facfd83a9e101e35263457b8035
mkdir build
cd build
cmake ..
make
sudo make install
- name: Installing Linux 32-bit Dependencies
if: ${{ runner.os == 'Linux' && env['TEST_X86'] && !matrix.container }}
run: |
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install cmake "${CC}-multilib" "${CXX}-multilib" zlib1g-dev:i386 libssl-dev:i386 libcurl4-openssl-dev:i386
- name: Installing Alpine Linux Dependencies
if: ${{ contains(matrix.container, 'alpine') }}
run: |
apk update
apk add curl-dev libunwind-dev libunwind-static xz-dev
# install manually until available by default (also for future .NET updates)
- name: Install .NET 10 SDK for ARM64 runners
if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' && !matrix.container }}
run: |
wget https://dot.net/v1/dotnet-install.sh -O dotnet-install.sh
chmod +x dotnet-install.sh
./dotnet-install.sh --channel 10.0 --install-dir $HOME/.dotnet
echo "$HOME/.dotnet" >> $GITHUB_PATH
echo "DOTNET_ROOT=$HOME/.dotnet" >> $GITHUB_ENV
# https://github.com/actions/runner-images/issues/9491
- name: Decrease vm.mmap_rnd_bit to prevent ASLR ASAN issues
if: ${{ runner.os == 'Linux' && contains(env['RUN_ANALYZER'], 'asan') }}
run: sudo sysctl vm.mmap_rnd_bits=28
- name: Installing CodeChecker
if: ${{ contains(env['RUN_ANALYZER'], 'code-checker') }}
run: sudo snap install codechecker --classic
- name: Expose llvm@15 PATH for Mac
if: ${{ runner.os == 'macOS' }}
run: echo $(brew --prefix llvm@15)/bin >> $GITHUB_PATH
- name: Expose llvm@18 PATH for Mac
if: ${{ runner.os == 'macOS' && matrix.os == 'macos-15-large' && matrix.RUN_ANALYZER == 'asan,llvm-cov' }}
run: echo $(brew --prefix llvm@18)/bin >> $GITHUB_PATH
- name: Set macOS SDKROOT
if: ${{ runner.os == 'macOS' }}
run: echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "$GITHUB_ENV"
- name: Remove Strawberry Perl from PATH
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: |
$strawberryBins = @(
'C:\Strawberry\c\bin',
'C:\Strawberry\perl\site\bin',
'C:\Strawberry\perl\bin'
)
$cleanedPaths = $env:Path -split ';' | Where-Object { $_ -and ($strawberryBins -notcontains $_) }
$newPath = ($cleanedPaths -join ';')
"PATH=$newPath" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
- name: Installing LLVM-MINGW Dependencies
if: ${{ runner.os == 'Windows' && env['TEST_MINGW'] }}
shell: powershell
env:
MINGW_PKG_PREFIX: ${{ matrix.MINGW_PKG_PREFIX }}
MINGW_ASM_MASM_COMPILER: ${{ matrix.MINGW_ASM_MASM_COMPILER }}
MINGW_ASM_MASM_FLAGS: ${{ matrix.MINGW_ASM_MASM_FLAGS }}
run: . "scripts\install-llvm-mingw.ps1"
- name: Set up zlib for Windows
if: ${{ runner.os == 'Windows' }}
shell: powershell
run: . "scripts\install-zlib.ps1"
- name: Setup Java Version
if: ${{ env['ANDROID_API'] }}
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Setup Gradle
if: ${{ env['ANDROID_API'] }}
uses: gradle/actions/setup-gradle@579fbbe7221704325eb4c4d4bf20c2b0859fba76 # pin@v3
with:
gradle-home-cache-cleanup: true
- name: Starting Android Simulator
if: ${{ env['ANDROID_API'] }}
run: bash scripts/start-android.sh
timeout-minutes: 20
- name: Add sentry.native.test hostname
if: ${{ runner.os == 'Windows' }}
# The path is usually C:\Windows\System32\drivers\etc\hosts
run: |
Add-Content -Path $env:SystemRoot\System32\drivers\etc\hosts -Value "127.0.0.1 sentry.native.test"
shell: powershell
- name: Print hosts file
if: ${{ runner.os == 'Windows' }}
run: type $env:SystemRoot\System32\drivers\etc\hosts
shell: powershell
- name: Add sentry.native.test hostname
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }}
run: |
echo "127.0.0.1 sentry.native.test" | sudo tee -a /etc/hosts
# remove "::1 localhost ..." to avoid conflicts with proxy tests (musl)
sed '/^::1/d' /etc/hosts | sudo tee /etc/hosts
cat /etc/hosts
shell: bash
- name: Test
shell: bash
run: |
pip install --upgrade --requirement tests/requirements.txt
pytest --capture=no --verbose tests
- name: Check NDK
if: ${{ env['ANDROID_API'] }}
working-directory: ndk
run: make check
- name: "Upload to codecov.io"
if: ${{ contains(env['RUN_ANALYZER'], 'cov') }}
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d # pin@v5.4.2
with:
directory: coverage
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
archive:
name: Create Release Archive
runs-on: ubuntu-latest
needs: [lint, test]
# only run this on pushes, combined with the CI triggers, this will only
# run on master or the release branch
if: ${{ needs.test.result == 'success' && github.event_name == 'push' }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 # v4 # v2
with:
submodules: recursive
- name: Setup Java Version
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@579fbbe7221704325eb4c4d4bf20c2b0859fba76 # pin@v3
with:
gradle-home-cache-cleanup: true
- name: Create source archive
run: |
rm -rf build .c* .e* .git* scripts Makefile external/breakpad/src/tools external/breakpad/src/processor
zip -r sentry-native.zip .
- name: Build NDK artifacts
working-directory: ndk
run: ./gradlew clean distZip
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
if-no-files-found: error
path: |
sentry-native.zip
ndk/lib/build/distributions/*.zip
ndk/lib/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib/*