Skip to content

Commit 3af984d

Browse files
committed
use matrix.os for cache & matrix.slnf for solution filter
1 parent 077f53b commit 3af984d

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ on:
1111

1212
jobs:
1313
build-sentry-native:
14-
name: sentry-native (${{ matrix.os }}${{ matrix.arch && format('-{0}', matrix.arch) || '' }}
14+
name: sentry-native (${{ matrix.os }})
1515
runs-on: ${{ matrix.os }}
1616
strategy:
1717
fail-fast: false
@@ -21,7 +21,6 @@ jobs:
2121
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
2222
- os: windows-latest
2323
- os: windows-11-arm
24-
arch: arm64
2524

2625
steps:
2726
- name: Checkout
@@ -40,8 +39,7 @@ jobs:
4039
id: cache
4140
with:
4241
path: src/Sentry/Platforms/Native/sentry-native
43-
# On Windows, it'll be either: Windows or Windows-arm64:
44-
key: sentry-native-${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
42+
key: sentry-native-${{ matrix.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
4543
enableCrossOsArchive: true
4644

4745
- name: Remove unused applications
@@ -67,10 +65,13 @@ jobs:
6765
matrix:
6866
include:
6967
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
68+
slnf: Sentry-CI-Build-Linux.slnf
7069
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
70+
slnf: Sentry-CI-Build-macOS.slnf
7171
- os: windows-latest
72+
slnf: Sentry-CI-Build-Windows.slnf
7273
- os: windows-11-arm
73-
arch: arm64
74+
slnf: Sentry-CI-Build-Windows-arm64.slnf
7475

7576
steps:
7677
- name: Cancel Previous Runs
@@ -95,58 +96,58 @@ jobs:
9596
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
9697

9798
- name: Download sentry-native (Linux)
98-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux') }}
99+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.os == 'ubuntu-22.04') }}
99100
uses: actions/cache/restore@v4
100101
with:
101102
path: src/Sentry/Platforms/Native/sentry-native
102-
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
103+
key: sentry-native-ubuntu-22.04-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
103104
fail-on-cache-miss: true
104105

105106
- name: Download sentry-native (macOS)
106-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
107+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.os == 'macos-15') }}
107108
uses: actions/cache/restore@v4
108109
with:
109110
path: src/Sentry/Platforms/Native/sentry-native
110-
key: sentry-native-macOS-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
111+
key: sentry-native-macos-15-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
111112
fail-on-cache-miss: true
112113

113114
- name: Download sentry-native (Windows)
114-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows' && runner.arch == 'X64') }}
115+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.os == 'windows-latest') }}
115116
uses: actions/cache/restore@v4
116117
with:
117118
path: src/Sentry/Platforms/Native/sentry-native
118-
key: sentry-native-Windows-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
119+
key: sentry-native-windows-latest-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
119120
fail-on-cache-miss: true
120121
enableCrossOsArchive: true
121122

122123
- name: Download sentry-native (Windows arm64)
123-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Windows' && runner.arch == 'ARM64') }}
124+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.os == 'windows-11-arm') }}
124125
uses: actions/cache/restore@v4
125126
with:
126127
path: src/Sentry/Platforms/Native/sentry-native
127-
key: sentry-native-Windows-arm64-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
128+
key: sentry-native-windows-11-arm-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
128129
fail-on-cache-miss: true
129130
enableCrossOsArchive: true
130131

131132
- name: Build Native Dependencies
132133
uses: ./.github/actions/buildnative
133134

134135
- name: Restore .NET Dependencies
135-
run: dotnet restore Sentry-CI-Build-${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}.slnf --nologo
136+
run: dotnet restore ${{ matrix.slnf }} --nologo
136137

137138
- name: Build
138139
id: build
139-
run: dotnet build Sentry-CI-Build-${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
140+
run: dotnet build ${{ matrix.slnf }} -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
140141

141142
- name: Upload build logs
142143
if: ${{ steps.build.outcome != 'skipped' }}
143144
uses: actions/upload-artifact@v4
144145
with:
145-
name: ${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}-build-logs
146+
name: ${{ matrix.os }}-build-logs
146147
path: build.binlog
147148

148149
- name: Test
149-
run: dotnet test Sentry-CI-Build-${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}.slnf -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
150+
run: dotnet test ${{ matrix.slnf }} -c Release --no-build --nologo -l GitHubActions -l "trx;LogFilePrefix=testresults_${{ runner.os }}" --collect "XPlat Code Coverage"
150151

151152
- name: Upload code coverage
152153
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d
@@ -155,14 +156,14 @@ jobs:
155156
if: failure()
156157
uses: actions/upload-artifact@v4
157158
with:
158-
name: ${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}-verify-test-results
159+
name: ${{ matrix.os }}-verify-test-results
159160
path: "**/*.received.*"
160161

161162
# To save time and disk space, we only create and archive the NuGet packages when we're actually releasing.
162163

163164
- name: Create NuGet Packages
164165
if: env.CI_PUBLISHING_BUILD == 'true'
165-
run: dotnet pack Sentry-CI-Build-${{ matrix.arch && format('{0}-{1}', runner.os, matrix.arch) || runner.os }}.slnf -c Release --no-build --nologo
166+
run: dotnet pack ${{ matrix.slnf }} -c Release --no-build --nologo
166167

167168
- name: Archive NuGet Packages
168169
if: env.CI_PUBLISHING_BUILD == 'true'
@@ -187,7 +188,6 @@ jobs:
187188
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
188189
- os: windows-latest
189190
- os: windows-11-arm
190-
arch: arm64
191191

192192
steps:
193193
- uses: actions/checkout@v4
@@ -240,7 +240,7 @@ jobs:
240240
uses: actions/cache/restore@v4
241241
with:
242242
path: src/Sentry/Platforms/Native/sentry-native
243-
key: sentry-native-macOS-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
243+
key: sentry-native-macos-15-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
244244
fail-on-cache-miss: true
245245

246246
- name: Setup Environment

0 commit comments

Comments
 (0)