Skip to content

Commit cfecfae

Browse files
authored
ci: specify RID & .slnf in the matrix (#4349)
1 parent 935ce5b commit cfecfae

File tree

1 file changed

+48
-34
lines changed

1 file changed

+48
-34
lines changed

.github/workflows/build.yml

Lines changed: 48 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -11,23 +11,29 @@ on:
1111

1212
jobs:
1313
build-sentry-native:
14-
name: sentry-native (${{ matrix.container.image || matrix.os }})
14+
name: sentry-native (${{ matrix.rid }})
1515
runs-on: ${{ matrix.os }}
16-
container: ${{ matrix.container.image }}
16+
container: ${{ matrix.container }}
1717
strategy:
1818
fail-fast: false
1919
matrix:
2020
include:
2121
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
22+
rid: linux-x64
2223
- os: ubuntu-22.04-arm
24+
rid: linux-arm64
2325
target: Linux-arm64
2426
- os: ubuntu-latest
27+
rid: linux-musl-x64
2528
target: Linux-musl
2629
container:
2730
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
2831
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
32+
rid: macos # universal (osx-arm64 + osx-x64)
2933
- os: windows-latest
34+
rid: win-x64
3035
- os: windows-11-arm
36+
rid: win-arm64
3137
target: Windows-arm64
3238

3339
steps:
@@ -47,7 +53,7 @@ jobs:
4753
id: cache
4854
with:
4955
path: src/Sentry/Platforms/Native/sentry-native
50-
key: sentry-native-${{ matrix.target || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
56+
key: sentry-native-${{ matrix.rid }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
5157
enableCrossOsArchive: true
5258

5359
- name: Remove unused applications
@@ -60,7 +66,7 @@ jobs:
6066

6167
build:
6268
needs: build-sentry-native
63-
name: .NET (${{ matrix.container.image || matrix.os }})
69+
name: .NET (${{ matrix.rid }})
6470
runs-on: ${{ matrix.os }}
6571
container: ${{ matrix.container }}
6672

@@ -69,19 +75,27 @@ jobs:
6975
matrix:
7076
include:
7177
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
72-
target: Linux
78+
rid: linux-x64
79+
slnf: Sentry-CI-Build-Linux.slnf
7380
- os: ubuntu-22.04-arm
74-
target: Linux-arm64
81+
rid: linux-arm64
82+
slnf: Sentry-CI-Build-Linux-arm64.slnf
7583
- os: ubuntu-latest
76-
target: Linux-musl
84+
rid: linux-musl-x64
85+
slnf: Sentry-CI-Build-Linux-musl.slnf
7786
container:
7887
image: ghcr.io/getsentry/sentry-dotnet-alpine:3.21
7988
volumes:
8089
- /var/run/docker.sock:/var/run/docker.sock
8190
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
91+
rid: macos # universal (osx-arm64 + osx-x64)
92+
slnf: Sentry-CI-Build-macOS.slnf
8293
- os: windows-latest
94+
rid: win-x64
95+
slnf: Sentry-CI-Build-Windows.slnf
8396
- os: windows-11-arm
84-
target: Windows-arm64
97+
rid: win-arm64
98+
slnf: Sentry-CI-Build-Windows-arm64.slnf
8599

86100
steps:
87101
- name: Cancel Previous Runs
@@ -106,53 +120,53 @@ jobs:
106120
if: runner.os == 'macOS'
107121
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
108122

109-
- name: Download sentry-native (Linux)
110-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux') }}
123+
- name: Download sentry-native (linux-x64)
124+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-x64') }}
111125
uses: actions/cache/restore@v4
112126
with:
113127
path: src/Sentry/Platforms/Native/sentry-native
114-
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
128+
key: sentry-native-linux-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
115129
fail-on-cache-miss: true
116130

117-
- name: Download sentry-native (Linux arm64)
118-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-arm64') }}
131+
- name: Download sentry-native (linux-arm64)
132+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-arm64') }}
119133
uses: actions/cache/restore@v4
120134
with:
121135
path: src/Sentry/Platforms/Native/sentry-native
122-
key: sentry-native-Linux-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
136+
key: sentry-native-linux-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
123137
fail-on-cache-miss: true
124138

125-
- name: Download sentry-native (Linux musl)
126-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-musl') }}
139+
- name: Download sentry-native (linux-musl-x64)
140+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'linux-musl-x64') }}
127141
uses: actions/cache/restore@v4
128142
with:
129143
path: src/Sentry/Platforms/Native/sentry-native
130-
key: sentry-native-Linux-musl-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
144+
key: sentry-native-linux-musl-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
131145
fail-on-cache-miss: true
132146

133-
- name: Download sentry-native (macOS)
134-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
147+
- name: Download sentry-native (macos)
148+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'macos') }}
135149
uses: actions/cache/restore@v4
136150
with:
137151
path: src/Sentry/Platforms/Native/sentry-native
138-
key: sentry-native-macOS-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
152+
key: sentry-native-macos-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
139153
fail-on-cache-miss: true
140154

141-
- name: Download sentry-native (Windows)
142-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows' && runner.arch == 'X64') }}
155+
- name: Download sentry-native (win-x64)
156+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'win-x64') }}
143157
uses: actions/cache/restore@v4
144158
with:
145159
path: src/Sentry/Platforms/Native/sentry-native
146-
key: sentry-native-Windows-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
160+
key: sentry-native-win-x64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
147161
fail-on-cache-miss: true
148162
enableCrossOsArchive: true
149163

150-
- name: Download sentry-native (Windows arm64)
151-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows' && runner.arch == 'ARM64') }}
164+
- name: Download sentry-native (win-arm64)
165+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.rid == 'win-arm64') }}
152166
uses: actions/cache/restore@v4
153167
with:
154168
path: src/Sentry/Platforms/Native/sentry-native
155-
key: sentry-native-Windows-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
169+
key: sentry-native-win-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
156170
fail-on-cache-miss: true
157171
enableCrossOsArchive: true
158172

@@ -161,21 +175,21 @@ jobs:
161175
uses: ./.github/actions/buildnative
162176

163177
- name: Restore .NET Dependencies
164-
run: dotnet restore Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf --nologo
178+
run: dotnet restore ${{ matrix.slnf }} --nologo
165179

166180
- name: Build
167181
id: build
168-
run: dotnet build Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
182+
run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
169183

170184
- name: Upload build logs
171185
if: ${{ steps.build.outcome != 'skipped' }}
172186
uses: actions/upload-artifact@v4
173187
with:
174-
name: ${{ matrix.target || runner.os }}-build-logs
188+
name: ${{ matrix.rid }}-build-logs
175189
path: build.binlog
176190

177191
- name: Test
178-
run: dotnet test Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
192+
run: dotnet test ${{ matrix.slnf }} -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
179193

180194
- name: Upload code coverage
181195
uses: codecov/codecov-action@18283e04ce6e62d37312384ff67231eb8fd56d24
@@ -184,11 +198,11 @@ jobs:
184198
if: failure()
185199
uses: actions/upload-artifact@v4
186200
with:
187-
name: ${{ matrix.target || runner.os }}-verify-test-results
201+
name: ${{ matrix.rid }}-verify-test-results
188202
path: "**/*.received.*"
189203

190204
- name: Create NuGet Packages
191-
run: dotnet pack Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-build --nologo
205+
run: dotnet pack ${{ matrix.slnf }} -c Release --no-build --nologo
192206

193207
- name: Archive NuGet Packages
194208
if: env.CI_PUBLISHING_BUILD == 'true'
@@ -258,7 +272,7 @@ jobs:
258272
if: ${{ steps.msbuild.outcome != 'skipped' }}
259273
uses: actions/upload-artifact@v4
260274
with:
261-
name: ${{ matrix.target || runner.os }}-msbuild-logs
275+
name: ${{ runner.os }}-msbuild-logs
262276
path: |
263277
msbuild.log
264278
msbuild.binlog
@@ -283,7 +297,7 @@ jobs:
283297
uses: actions/cache/restore@v4
284298
with:
285299
path: src/Sentry/Platforms/Native/sentry-native
286-
key: sentry-native-macOS-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
300+
key: sentry-native-macos-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
287301
fail-on-cache-miss: true
288302

289303
- name: Setup Environment

0 commit comments

Comments
 (0)