1111
1212jobs :
1313 build-sentry-native :
14- name : sentry-native (${{ matrix.os }})
15- runs-on : ${{ matrix.os }}
14+ name : sentry-native (${{ matrix.runner.container || matrix.runner.os }})
15+ runs-on : ${{ matrix.runner.os }}
16+ container : ${{ matrix.runner.container }}
1617 strategy :
1718 fail-fast : false
1819 matrix :
1920 # Pin ubuntu to ensure mono is installed
2021 # 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]
22+ runner : [
23+ {os: ubuntu-22.04},
24+ {os: ubuntu-latest, container: alpine:3.21},
25+ {os: windows-latest},
26+ {os: macos-15}
27+ ]
2228
2329 steps :
30+ - name : Install build dependencies for Alpine Linux
31+ if : ${{ startsWith(matrix.runner.container, 'alpine') }}
32+ run : |
33+ apk update
34+ apk add bash build-base cmake curl-dev git powershell sudo tar wget
35+ git config --global --add safe.directory $GITHUB_WORKSPACE
36+
2437 - name : Checkout
2538 uses : actions/checkout@v4
2639
@@ -30,14 +43,15 @@ jobs:
3043 id : cache
3144 with :
3245 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') }}
46+ key : sentry-native-${{ matrix.runner.container || runner.os }}-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
3447 enableCrossOsArchive : true
3548
3649 - name : Remove unused applications
50+ if : ${{ !matrix.runner.container }}
3751 uses : ./.github/actions/freediskspace
3852
3953 - name : Install build dependencies
40- if : steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux'
54+ if : steps.cache.outputs.cache-hit != 'true' && runner.os == 'Linux' && !matrix.runner.container
4155 run : |
4256 sudo apt update
4357 sudo apt install libcurl4-openssl-dev
@@ -48,28 +62,44 @@ jobs:
4862
4963 build :
5064 needs : build-sentry-native
51- name : .NET (${{ matrix.os }})
52- runs-on : ${{ matrix.os }}
65+ name : .NET (${{ matrix.runner.container || matrix.runner.os }})
66+ runs-on : ${{ matrix.runner.os }}
67+ container : ${{ matrix.runner.container }}
5368
5469 strategy :
5570 fail-fast : false
5671 matrix :
5772 # Pin ubuntu to ensure mono is installed
5873 # 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]
74+ runner : [
75+ {os: ubuntu-22.04},
76+ {os: ubuntu-latest, container: alpine:3.21},
77+ {os: windows-latest},
78+ {os: macos-15}
79+ ]
6080
6181 steps :
6282 - name : Cancel Previous Runs
6383 if : github.ref_name != 'main' && !startsWith(github.ref_name, 'release/')
6484 uses : styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # Tag: 0.12.1
6585
86+ - name : Install build dependencies for Alpine Linux
87+ if : ${{ startsWith(matrix.runner.container, 'alpine') }}
88+ run : |
89+ apk update
90+ apk add bash build-base cmake curl-dev git openjdk11 openjdk17 powershell sudo tar wget
91+ git config --global --add safe.directory $GITHUB_WORKSPACE
92+ curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash -eo pipefail /dev/stdin --channel 9.0 --install-dir /usr/share/dotnet
93+ ln -s /usr/share/dotnet/dotnet /usr/local/bin/dotnet
94+
6695 - name : Checkout
6796 uses : actions/checkout@v4
6897 with :
6998 submodules : recursive
7099 fetch-depth : 2 # default is 1 and codecov needs > 1
71100
72101 - name : Remove unused applications
102+ if : ${{ !matrix.runner.container }}
73103 uses : ./.github/actions/freediskspace
74104
75105 # We use macOS for the final publishing build so we get all the iOS/macCatalyst targets in the packages
@@ -85,6 +115,14 @@ jobs:
85115 key : sentry-native-Linux-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
86116 fail-on-cache-miss : true
87117
118+ - name : Download sentry-native (Linux musl)
119+ if : ${{ (env.CI_PUBLISHING_BUILD == 'true') || (startsWith(matrix.runner.container, 'alpine')) }}
120+ uses : actions/cache/restore@v4
121+ with :
122+ path : src/Sentry/Platforms/Native/sentry-native
123+ key : sentry-native-alpine:3.21-${{ hashFiles('scripts/build-sentry-native.ps1') }}-${{ hashFiles('.git/modules/modules/sentry-native/HEAD') }}
124+ fail-on-cache-miss : true
125+
88126 - name : Download sentry-native (macOS)
89127 if : ${{ (env.CI_PUBLISHING_BUILD == 'true') || (runner.os == 'macOS') }}
90128 uses : actions/cache/restore@v4
@@ -106,6 +144,7 @@ jobs:
106144 uses : ./.github/actions/environment
107145
108146 - name : Build Native Dependencies
147+ if : ${{ ! matrix.runner.container }}
109148 uses : ./.github/actions/buildnative
110149
111150 - name : Restore .NET Dependencies
0 commit comments