From c85dcd442da774e382f535a42265eebb548ed493 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Oct 2025 09:47:04 +0200 Subject: [PATCH 1/6] Install .NET --- .github/workflows/sdk.yml | 43 +++++++++++++++++++++++++++------------ 1 file changed, 30 insertions(+), 13 deletions(-) diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 073a6ac45..bc1e0e06e 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -70,31 +70,48 @@ jobs: fi shell: bash - - name: Restore from cache - uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3 - id: cache - with: - # Note: native SDKs are cached and only built if the respective 'package-dev/Plugins/' directories are empty. - # Output changes only depending on the git sha of the submodules - # hash of package/package.json for cache busting on release builds (version bump) - path: | - package-dev/Plugins - key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}${{ env.TARGET == 'Cocoa' && hashFiles('modules/sentry-cocoa.properties') || '' }} + # Temporarily disabled to verify .NET SDK installation works correctly + # - name: Restore from cache + # uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3 + # id: cache + # with: + # # Note: native SDKs are cached and only built if the respective 'package-dev/Plugins/' directories are empty. + # # Output changes only depending on the git sha of the submodules + # # hash of package/package.json for cache busting on release builds (version bump) + # path: | + # package-dev/Plugins + # key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}${{ env.TARGET == 'Cocoa' && hashFiles('modules/sentry-cocoa.properties') || '' }} - name: Installing Linux Dependencies - if: ${{ env.TARGET == 'Linux' && steps.cache.outputs.cache-hit != 'true' }} + if: ${{ env.TARGET == 'Linux' }} shell: bash run: | apt-get update apt-get install -y zlib1g-dev libcurl4-openssl-dev libssl-dev build-essential cmake curl set -eo pipefail - curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --channel 9.0 --install-dir /usr/share/dotnet + DOTNET_VERSION=$(grep -A 1 '"sdk":' global.json | grep '"version":' | sed 's/.*"version": *"\(.*\)".*/\1/') + curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $DOTNET_VERSION --install-dir /usr/share/dotnet echo "/usr/share/dotnet" >> $GITHUB_PATH env: DEBIAN_FRONTEND: noninteractive + - name: Install .NET SDK (macOS) + if: ${{ runner.os == 'macOS' }} + shell: bash + run: | + DOTNET_VERSION=$(grep -A 1 '"sdk":' global.json | grep '"version":' | sed 's/.*"version": *"\(.*\)".*/\1/') + curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $DOTNET_VERSION --install-dir $HOME/.dotnet + echo "$HOME/.dotnet" >> $GITHUB_PATH + + - name: Install .NET SDK (Windows) + if: ${{ runner.os == 'Windows' }} + shell: pwsh + run: | + $dotnetVersion = (Get-Content global.json | ConvertFrom-Json).sdk.version + Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "dotnet-install.ps1" + .\dotnet-install.ps1 -Version $dotnetVersion -InstallDir "$env:ProgramFiles\dotnet" + - name: Build - if: steps.cache.outputs.cache-hit != 'true' run: | git submodule update --init --recursive ${{ steps.env.outputs.submodules }} dotnet msbuild /t:Build${{ env.TARGET }}SDK /p:Configuration=Release /p:OutDir=other src/Sentry.Unity From 938d97e6295650f29e51665a8377c97ae162e7f3 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Oct 2025 09:52:32 +0200 Subject: [PATCH 2/6] Runner vs OS? --- .github/workflows/sdk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index bc1e0e06e..1c2176bac 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -83,7 +83,7 @@ jobs: # key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}${{ env.TARGET == 'Cocoa' && hashFiles('modules/sentry-cocoa.properties') || '' }} - name: Installing Linux Dependencies - if: ${{ env.TARGET == 'Linux' }} + if: ${{ runner.os == 'Linux' }} shell: bash run: | apt-get update From 426faa699b64f9fccdd8d0deed983ff3e0cd33aa Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Oct 2025 09:59:33 +0200 Subject: [PATCH 3/6] Split Android from Linux-Linux --- .github/workflows/sdk.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 1c2176bac..6c9a23c14 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -83,17 +83,22 @@ jobs: # key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}${{ env.TARGET == 'Cocoa' && hashFiles('modules/sentry-cocoa.properties') || '' }} - name: Installing Linux Dependencies - if: ${{ runner.os == 'Linux' }} + if: ${{ env.TARGET == 'Linux' }} shell: bash run: | apt-get update apt-get install -y zlib1g-dev libcurl4-openssl-dev libssl-dev build-essential cmake curl + env: + DEBIAN_FRONTEND: noninteractive + + - name: Install .NET SDK (Linux/Android) + if: ${{ runner.os == 'Linux' }} + shell: bash + run: | set -eo pipefail DOTNET_VERSION=$(grep -A 1 '"sdk":' global.json | grep '"version":' | sed 's/.*"version": *"\(.*\)".*/\1/') curl -sSL --retry 5 https://dot.net/v1/dotnet-install.sh | bash /dev/stdin --version $DOTNET_VERSION --install-dir /usr/share/dotnet echo "/usr/share/dotnet" >> $GITHUB_PATH - env: - DEBIAN_FRONTEND: noninteractive - name: Install .NET SDK (macOS) if: ${{ runner.os == 'macOS' }} From b42bfa495ee8d7f35fbe499635c3d9d01cbae242 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Oct 2025 10:04:37 +0200 Subject: [PATCH 4/6] Workload Restore --- .github/workflows/sdk.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index 6c9a23c14..bf4a1bd74 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -116,6 +116,9 @@ jobs: Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "dotnet-install.ps1" .\dotnet-install.ps1 -Version $dotnetVersion -InstallDir "$env:ProgramFiles\dotnet" + - name: Restore .NET workloads + run: dotnet workload restore + - name: Build run: | git submodule update --init --recursive ${{ steps.env.outputs.submodules }} From 2ec9d135e568015d49a64d4961c014232e44330e Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Oct 2025 10:08:10 +0200 Subject: [PATCH 5/6] Don't restore before fetching the submodule --- .github/workflows/sdk.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index bf4a1bd74..ef67d2a20 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -116,12 +116,10 @@ jobs: Invoke-WebRequest -Uri "https://dot.net/v1/dotnet-install.ps1" -OutFile "dotnet-install.ps1" .\dotnet-install.ps1 -Version $dotnetVersion -InstallDir "$env:ProgramFiles\dotnet" - - name: Restore .NET workloads - run: dotnet workload restore - - name: Build run: | git submodule update --init --recursive ${{ steps.env.outputs.submodules }} + dotnet workload restore dotnet msbuild /t:Build${{ env.TARGET }}SDK /p:Configuration=Release /p:OutDir=other src/Sentry.Unity - name: Upload build logs on failure From 932a19443fa47086b5ec629281a61c1e74705f82 Mon Sep 17 00:00:00 2001 From: bitsandfoxes Date: Fri, 24 Oct 2025 10:30:44 +0200 Subject: [PATCH 6/6] Put caching back in --- .github/workflows/sdk.yml | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index ef67d2a20..a9ddc4b97 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -70,20 +70,19 @@ jobs: fi shell: bash - # Temporarily disabled to verify .NET SDK installation works correctly - # - name: Restore from cache - # uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3 - # id: cache - # with: - # # Note: native SDKs are cached and only built if the respective 'package-dev/Plugins/' directories are empty. - # # Output changes only depending on the git sha of the submodules - # # hash of package/package.json for cache busting on release builds (version bump) - # path: | - # package-dev/Plugins - # key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}${{ env.TARGET == 'Cocoa' && hashFiles('modules/sentry-cocoa.properties') || '' }} + - name: Restore from cache + uses: actions/cache@2f8e54208210a422b2efd51efaa6bd6d7ca8920f # v3 + id: cache + with: + # Note: native SDKs are cached and only built if the respective 'package-dev/Plugins/' directories are empty. + # Output changes only depending on the git sha of the submodules + # hash of package/package.json for cache busting on release builds (version bump) + path: | + package-dev/Plugins + key: sdk=${{ env.TARGET }}-${{ hashFiles('submodules-status', 'package/package.json', 'Directory.Build.targets', 'sdk-static/**') }}${{ env.TARGET == 'Cocoa' && hashFiles('modules/sentry-cocoa.properties') || '' }} - name: Installing Linux Dependencies - if: ${{ env.TARGET == 'Linux' }} + if: ${{ env.TARGET == 'Linux' && steps.cache.outputs.cache-hit != 'true' }} shell: bash run: | apt-get update @@ -92,7 +91,7 @@ jobs: DEBIAN_FRONTEND: noninteractive - name: Install .NET SDK (Linux/Android) - if: ${{ runner.os == 'Linux' }} + if: ${{ runner.os == 'Linux' && steps.cache.outputs.cache-hit != 'true' }} shell: bash run: | set -eo pipefail @@ -101,7 +100,7 @@ jobs: echo "/usr/share/dotnet" >> $GITHUB_PATH - name: Install .NET SDK (macOS) - if: ${{ runner.os == 'macOS' }} + if: ${{ runner.os == 'macOS' && steps.cache.outputs.cache-hit != 'true' }} shell: bash run: | DOTNET_VERSION=$(grep -A 1 '"sdk":' global.json | grep '"version":' | sed 's/.*"version": *"\(.*\)".*/\1/') @@ -109,7 +108,7 @@ jobs: echo "$HOME/.dotnet" >> $GITHUB_PATH - name: Install .NET SDK (Windows) - if: ${{ runner.os == 'Windows' }} + if: ${{ runner.os == 'Windows' && steps.cache.outputs.cache-hit != 'true' }} shell: pwsh run: | $dotnetVersion = (Get-Content global.json | ConvertFrom-Json).sdk.version @@ -117,6 +116,7 @@ jobs: .\dotnet-install.ps1 -Version $dotnetVersion -InstallDir "$env:ProgramFiles\dotnet" - name: Build + if: steps.cache.outputs.cache-hit != 'true' run: | git submodule update --init --recursive ${{ steps.env.outputs.submodules }} dotnet workload restore