-
-
Notifications
You must be signed in to change notification settings - Fork 206
243 lines (199 loc) · 8.03 KB
/
build.yml
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
name: build
on:
push:
branches:
- main
- release/*
pull_request:
paths-ignore:
- "**.md"
env:
XCODE_VERSION: 16
jobs:
build-sentry-native:
name: sentry-native (${{ matrix.os }})
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu, windows, macos]
steps:
- name: Checkout
uses: actions/checkout@v4
- run: git submodule update --init modules/sentry-native
- uses: actions/cache@v4
id: cache
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-${{ runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
enableCrossOsArchive: true
- name: Free Disk Space (Ubuntu)
if: matrix.os == 'ubuntu-latest'
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: false
swap-storage: true
- name: Install build dependencies
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev
- run: scripts/build-sentry-native.ps1
if: steps.cache.outputs.cache-hit != 'true'
shell: pwsh
build:
needs: build-sentry-native
name: .NET (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- name: Cancel Previous Runs
if: github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1
- name: Setup Xcode
if: matrix.os == 'macos-latest'
run: |
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
xcodebuild -version
# We only use Xcode 16
- name: Remove unused applications
if: matrix.os == 'macos-latest'
run: |
df -hI /dev/disk3s1s1
sudo rm -rf /Applications/Xcode_14.3.1.app
sudo rm -rf /Applications/Xcode_15.0.1.app
sudo rm -rf /Applications/Xcode_15.1.app
sudo rm -rf /Applications/Xcode_15.2.app
sudo rm -rf /Applications/Xcode_15.3.app
df -hI /dev/disk3s1s1
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 2 # default is 1 and codecov needs > 1
# We use macOS for the final publishing build so we we get all the iOS/macCatalyst targets in the packages
- name: Set Environment Variables
if: startsWith(matrix.os, 'macos')
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
- name: Download sentry-native (Linux)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux') }}
uses: actions/cache/restore@v4
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (macOS)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
uses: actions/cache/restore@v4
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-macOS-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
- name: Download sentry-native (Windows)
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows') }}
uses: actions/cache/restore@v4
with:
path: src/Sentry/Platforms/Native/sentry-native
key: sentry-native-Windows-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
fail-on-cache-miss: true
enableCrossOsArchive: true
- name: Setup Environment
uses: ./.github/actions/environment
- name: Build Native Dependencies
uses: ./.github/actions/buildnative
- name: Build Cocoa SDK
if: runner.os == 'macOS'
uses: ./.github/actions/buildcocoasdk
- name: Restore .NET Dependencies
run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo
- name: Build
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true
- name: Test
run: dotnet test Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
- name: Upload code coverage
uses: codecov/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238
- name: Upload build and test outputs
if: failure()
uses: actions/upload-artifact@v4
with:
name: verify-test-results
path: "**/*.received.*"
# To save time and disk space, we only create and archive the Nuget packages when we're actually releasing.
- name: Create Nuget Packages
if: env.CI_PUBLISHING_BUILD == 'true'
run: dotnet pack Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo
- name: Archive Nuget Packages
if: env.CI_PUBLISHING_BUILD == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ github.sha }}
if-no-files-found: error
path: |
src/**/Release/*.nupkg
src/**/Release/*.snupkg
integration-test:
needs: build
name: Integration test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
steps:
- uses: actions/checkout@v4
with:
# We only check out what is absolutely necessary to reduce a chance of local files impacting
# integration tests, e.g. Directory.Build.props, nuget.config, ...
sparse-checkout: |
Directory.Build.props
integration-test
- name: Fetch Nuget Packages
uses: actions/download-artifact@v4
with:
name: ${{ github.sha }}
path: src
- name: Install build dependencies
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libcurl4-openssl-dev
- uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
- name: Setup Xcode
if: matrix.os == 'macos-latest'
run: |
sudo xcode-select --switch /Applications/Xcode_${{env.XCODE_VERSION}}.app/Contents/Developer
xcodebuild -version
# Needed for Android SDK setup step
- uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@00854ea68c109d98c75d956347303bf7c45b0277 # v3.2.1
- run: dotnet workload install android maui-android
- name: Test
uses: getsentry/github-workflows/sentry-cli/integration-test/@v2
with:
path: integration-test
test-solution-filters:
runs-on: ubuntu-latest
if: ${{ !startsWith(github.ref_name, 'release/') }}
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Rebuild Solution Filters
shell: pwsh
run: pwsh scripts/generate-solution-filters.ps1
- name: Ensure Solution Filters are up to date
shell: pwsh
run: scripts/dirty-check.ps1 -PathToCheck ./*.sln* -GuidanceOnFailure "Uncommitted changes to the solution filters detected. Run `scripts/generate-solution-filters.ps1` locally and commit changes."