Skip to content

Commit 232a610

Browse files
committed
WIP: ci: try build on alpine
1 parent 321223e commit 232a610

File tree

2 files changed

+58
-22
lines changed

2 files changed

+58
-22
lines changed

.github/actions/environment/action.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ runs:
1111
echo "DOTNET_CLI_TELEMETRY_OPTOUT=1" >> $GITHUB_ENV
1212
echo "DOTNET_NOLOGO=1" >> $GITHUB_ENV
1313
14+
- name: Set Environment Variables for Alpine Linux
15+
if: ${{ contains(matrix.container, 'alpine') }}
16+
shell: bash
17+
run: echo "NO_MOBILE=true" >> $GITHUB_ENV
18+
1419
# See https://github.com/actions/runner-images/blob/main/images/macos/macos-15-Readme.md#xcode
1520
- name: Pin the Xcode Version
1621
if: runner.os == 'macOS'
@@ -19,11 +24,13 @@ runs:
1924

2025
# Needed for Android SDK setup step
2126
- uses: actions/setup-java@v3
27+
if: ${{ !matrix.container }}
2228
with:
2329
distribution: 'temurin'
2430
java-version: '17'
2531

2632
- name: Setup Android SDK
33+
if: ${{ !matrix.container }}
2734
uses: android-actions/setup-android@07976c6290703d34c16d382cb36445f98bb43b1f # v3.2.0
2835
with:
2936
log-accepted-android-sdk-licenses: false
@@ -41,6 +48,7 @@ runs:
4148
cd -
4249
4350
- name: Set Java Version
51+
if: ${{ !matrix.container }}
4452
uses: actions/setup-java@v3
4553
with:
4654
distribution: 'temurin'

.github/workflows/build.yml

Lines changed: 50 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,20 @@ on:
1111

1212
jobs:
1313
build-sentry-native:
14-
name: sentry-native (${{ matrix.os }})
14+
name: sentry-native (${{ matrix.container || matrix.os }})
1515
runs-on: ${{ matrix.os }}
16+
container: ${{ matrix.container }}
1617
strategy:
1718
fail-fast: false
1819
matrix:
19-
# Pin ubuntu to ensure mono is installed
20-
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
21-
os: [ubuntu-22.04, windows-latest, macos-15]
20+
include:
21+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
22+
target: Linux
23+
- os: ubuntu-latest
24+
container: ghcr.io/jpnurmi/alpine:sentry-3.21 # TODO: getsentry
25+
target: Linux-musl
26+
- os: windows-latest
27+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
2228

2329
steps:
2430
- name: Checkout
@@ -30,14 +36,15 @@ jobs:
3036
id: cache
3137
with:
3238
path: src/Sentry/Platforms/Native/sentry-native
33-
key: sentry-native-${{ runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
39+
key: sentry-native-${{ matrix.target || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
3440
enableCrossOsArchive: true
3541

3642
- name: Remove unused applications
43+
if: ${{ !matrix.container }}
3744
uses: ./.github/actions/freediskspace
3845

3946
- name: Install build dependencies
40-
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
47+
if: steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux' && !matrix.container
4148
run: |
4249
sudo apt update
4350
sudo apt install libcurl4-openssl-dev
@@ -48,15 +55,21 @@ jobs:
4855

4956
build:
5057
needs: build-sentry-native
51-
name: .NET (${{ matrix.os }})
58+
name: .NET (${{ matrix.container || matrix.os }})
5259
runs-on: ${{ matrix.os }}
60+
container: ${{ matrix.container }}
5361

5462
strategy:
5563
fail-fast: false
5664
matrix:
57-
# Pin ubuntu to ensure mono is installed
58-
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
59-
os: [ubuntu-22.04, windows-latest, macos-15]
65+
include:
66+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
67+
target: Linux
68+
- os: ubuntu-latest
69+
container: ghcr.io/jpnurmi/alpine:sentry-3.21 # TODO: getsentry
70+
target: Linux-musl
71+
- os: windows-latest
72+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
6073

6174
steps:
6275
- name: Cancel Previous Runs
@@ -70,6 +83,7 @@ jobs:
7083
fetch-depth: 2 # default is 1 and codecov needs > 1
7184

7285
- name: Remove unused applications
86+
if: ${{ !matrix.container }}
7387
uses: ./.github/actions/freediskspace
7488

7589
# We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
@@ -78,13 +92,21 @@ jobs:
7892
run: echo "CI_PUBLISHING_BUILD=true" >> $GITHUB_ENV
7993

8094
- name: Download sentry-native (Linux)
81-
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'Linux') }}
95+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux') }}
8296
uses: actions/cache/restore@v4
8397
with:
8498
path: src/Sentry/Platforms/Native/sentry-native
8599
key: sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
86100
fail-on-cache-miss: true
87101

102+
- name: Download sentry-native (Linux musl)
103+
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (matrix.target == 'Linux-musl') }}
104+
uses: actions/cache/restore@v4
105+
with:
106+
path: src/Sentry/Platforms/Native/sentry-native
107+
key: sentry-native-Linux-musl-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
108+
fail-on-cache-miss: true
109+
88110
- name: Download sentry-native (macOS)
89111
if: ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
90112
uses: actions/cache/restore@v4
@@ -106,24 +128,25 @@ jobs:
106128
uses: ./.github/actions/environment
107129

108130
- name: Build Native Dependencies
131+
if: ${{ !matrix.container }}
109132
uses: ./.github/actions/buildnative
110133

111134
- name: Restore .NET Dependencies
112-
run: dotnet restore Sentry-CI-Build-${{ runner.os }}.slnf --nologo
135+
run: dotnet restore Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf --nologo
113136

114137
- name: Build
115138
id: build
116-
run: dotnet build Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-restore --nologo -v:minimal -flp:logfile=build.log -p:CopyLocalLockFileAssemblies=true -bl:build.binlog
139+
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
117140

118141
- name: Upload build logs
119142
if: ${{ steps.build.outcome != 'skipped' }}
120143
uses: actions/upload-artifact@v4
121144
with:
122-
name: ${{ runner.os }}-build-logs
145+
name: ${{ matrix.target || runner.os }}-build-logs
123146
path: build.binlog
124147

125148
- name: Test
126-
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"
149+
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"
127150

128151
- name: Upload code coverage
129152
uses: codecov/codecov-action@ad3126e916f78f00edff4ed0317cf185271ccc2d
@@ -132,14 +155,14 @@ jobs:
132155
if: failure()
133156
uses: actions/upload-artifact@v4
134157
with:
135-
name: ${{ runner.os }}-verify-test-results
158+
name: ${{ matrix.target || runner.os }}-verify-test-results
136159
path: "**/*.received.*"
137160

138161
# To save time and disk space, we only create and archive the Nuget packages when we're actually releasing.
139162

140163
- name: Create Nuget Packages
141164
if: env.CI_PUBLISHING_BUILD == 'true'
142-
run: dotnet pack Sentry-CI-Build-${{ runner.os }}.slnf -c Release --no-build --nologo
165+
run: dotnet pack Sentry-CI-Build-${{ matrix.target || runner.os }}.slnf -c Release --no-build --nologo
143166

144167
- name: Archive Nuget Packages
145168
if: env.CI_PUBLISHING_BUILD == 'true'
@@ -153,15 +176,20 @@ jobs:
153176
154177
integration-test:
155178
needs: build
156-
name: Integration test (${{ matrix.os }})
179+
name: Integration test (${{ matrix.container || matrix.os }})
157180
runs-on: ${{ matrix.os }}
181+
container: ${{ matrix.container }}
158182

159183
strategy:
160184
fail-fast: false
161185
matrix:
162-
# Pin ubuntu to ensure mono is installed
163-
# Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
164-
os: [ubuntu-22.04, windows-latest, macos-15]
186+
include:
187+
- os: ubuntu-22.04 # Pin ubuntu to ensure mono is installed
188+
- os: ubuntu-latest
189+
container: ghcr.io/jpnurmi/alpine:sentry-3.21 # TODO: getsentry
190+
target: Linux-musl
191+
- os: windows-latest
192+
- os: macos-15 # Pin macos to get the version of Xcode that we need: https://github.com/actions/runner-images/issues/10703
165193

166194
steps:
167195
- uses: actions/checkout@v4
@@ -180,7 +208,7 @@ jobs:
180208
path: src
181209

182210
- name: Install build dependencies
183-
if: runner.os == 'Linux'
211+
if: runner.os == 'Linux' && !matrix.container
184212
run: |
185213
sudo apt update
186214
sudo apt install libcurl4-openssl-dev

0 commit comments

Comments
 (0)