From 44d826e6e379ba5ca1bf0743c1a62558c5bc615c Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Wed, 16 Apr 2025 17:35:26 +0200 Subject: [PATCH 1/2] fix: use ubuntu-20.04 container --- .github/workflows/ci.yml | 4 +++- .github/workflows/sdk.yml | 38 ++++++++++++++++++++++++++++++++++---- Directory.Build.targets | 10 +--------- scripts/build-linux-sdk.sh | 21 +++++++++++++++++++++ 4 files changed, 59 insertions(+), 14 deletions(-) create mode 100755 scripts/build-linux-sdk.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 49c323c6b..f8fab3b0f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -32,15 +32,17 @@ jobs: - target: Android host: ubuntu-latest - target: Linux + host: ubuntu-latest # Build using older Linux version to preserve sdk compatibility with old GLIBC # See discussion in https://github.com/getsentry/sentry-unity/issues/1730 for more details - host: ubuntu-20.04 + container: ubuntu:20.04 - target: Windows host: windows-latest uses: ./.github/workflows/sdk.yml with: target: ${{ matrix.target }} runsOn: ${{ matrix.host }} + container: ${{ matrix.container }} build-unity-sdk: name: Build Unity SDK diff --git a/.github/workflows/sdk.yml b/.github/workflows/sdk.yml index a63d11880..5e0ef05df 100644 --- a/.github/workflows/sdk.yml +++ b/.github/workflows/sdk.yml @@ -7,6 +7,10 @@ on: target: required: true type: string + container: + required: false + type: string + default: '' env: DOTNET_CLI_TELEMETRY_OPTOUT: 1 @@ -15,8 +19,26 @@ env: jobs: build: runs-on: ${{ inputs.runsOn }} + container: ${{ inputs.container }} timeout-minutes: 30 steps: + - name: Set up Git in container + if: ${{ inputs.container != '' }} + # ubuntu:20.04 does not have git installed by default. Make it available + # for actions/checkout to get a proper clone instead of downloading a + # tarball using the GitHub REST API. This ensures that git submodule + # commands work as expected. + # + # Furthermore, add an exception for the workspace directory to avoid the + # following git error (runner host vs. container): + # fatal: detected dubious ownership in repository at '/__w/sentry-unity/sentry-unity' + run: | + apt-get update + apt-get install -y git + git config --global --add safe.directory $GITHUB_WORKSPACE + env: + DEBIAN_FRONTEND: noninteractive + - uses: actions/checkout@v3 - name: Select submodules @@ -52,11 +74,19 @@ jobs: - name: Installing Linux Dependencies if: ${{ inputs.target == 'Linux' && steps.cache.outputs.cache-hit != 'true' }} run: | - sudo apt-get update - sudo apt-get install zlib1g-dev libcurl4-openssl-dev libssl-dev + apt-get update + apt-get install -y zlib1g-dev libcurl4-openssl-dev libssl-dev build-essential cmake + env: + DEBIAN_FRONTEND: noninteractive + + - name: Build for Linux + if: ${{ inputs.target == 'Linux' && steps.cache.outputs.cache-hit != 'true' }} + run: | + git submodule update --init --recursive ${{ steps.env.outputs.submodules }} + ./scripts/build-linux-sdk.sh modules/sentry-native package-dev/Plugins/Linux/Sentry - - name: Build - if: steps.cache.outputs.cache-hit != 'true' + - name: Run MSBuild + if: ${{ inputs.target != 'Linux' && steps.cache.outputs.cache-hit != 'true' }} run: | git submodule update --init --recursive ${{ steps.env.outputs.submodules }} dotnet msbuild /t:Build${{ inputs.target }}SDK /p:Configuration=Release /p:OutDir=other src/Sentry.Unity diff --git a/Directory.Build.targets b/Directory.Build.targets index 2e8431a21..ca9d4d603 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -307,15 +307,7 @@ Expected to exist: - - - - - - - - - + + + +