Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 11 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,16 @@ jobs:
- name: Checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@f68fdb76e2ea636224182cfb7377ff9a1708f9b8 # v1.3.0
with:
android: true
dotnet: false
haskell: true
large-packages: false
docker-images: false
swap-storage: true

- name: Checkout submodules
run: git submodule update --init --recursive src/sentry-dotnet

Expand Down Expand Up @@ -72,11 +82,6 @@ jobs:
- name: Restore .NET Workload
run: dotnet workload restore

- name: Install Android dotnet workflow
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet workload restore already does that for us

run: dotnet workload install android --temp-dir "$RUNNER_TEMP"
env:
RUNNER_TEMP: ${{ env.RUNNER_TEMP }}

- name: Download CLI
run: ./scripts/download-sentry-cli.ps1

Expand Down Expand Up @@ -134,9 +139,7 @@ jobs:
package-release.zip

- name: Run Unity tests (playmode)
run: |
docker exec unity dotnet msbuild /t:UnityConfigureSentryOptions /p:TestDsn= /p:Configuration=Release /p:OutDir=other src/Sentry.Unity
docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests
run: docker exec unity dotnet msbuild /t:UnityPlayModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Tests
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running it twice was a leftover from a time where we had to manually set/replace the TestDsn. That's no longer needed.


- name: Run Unity tests (editmode)
run: docker exec unity dotnet msbuild /t:UnityEditModeTest /p:Configuration=Release /p:OutDir=other test/Sentry.Unity.Editor.Tests
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ jobs:
secrets: inherit
strategy:
fail-fast: false
max-parallel: 1 # Run Unity versions sequentially to avoid license exhaustion
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
uses: ./.github/workflows/smoke-test-create.yml
with:
Expand All @@ -106,6 +107,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
fail-fast: false
max-parallel: 2 # Run 2 jobs at a time (one per platform), versions run sequentially
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
platform: ["WebGL", "Linux"]
Expand Down Expand Up @@ -162,6 +164,15 @@ jobs:
- name: Extract project archive
run: tar -xvzf test-project.tar.gz

- name: Cache Unity Library
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: samples/IntegrationTest/Library
key: Library-IntegrationTest-${{ matrix.platform }}-${{ matrix.unity-version }}-v1
restore-keys: |
Library-IntegrationTest-${{ matrix.platform }}-${{ matrix.unity-version }}-
Library-IntegrationTest-${{ matrix.platform }}-

# - name: Build without Sentry SDK
# run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "${{ env.UNITY_PATH }}" -Platform "${{ matrix.platform }}"

Expand Down Expand Up @@ -224,6 +235,7 @@ jobs:
secrets: inherit
strategy:
fail-fast: false
max-parallel: 1 # Run Unity versions sequentially to avoid license exhaustion
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
uses: ./.github/workflows/smoke-test-build-android.yml
with:
Expand Down Expand Up @@ -252,6 +264,7 @@ jobs:
secrets: inherit
strategy:
fail-fast: false
max-parallel: 1 # Run Unity versions sequentially to avoid license exhaustion
matrix: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix) }}
uses: ./.github/workflows/smoke-test-build-ios.yml
with:
Expand Down Expand Up @@ -342,6 +355,7 @@ jobs:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
max-parallel: 1 # Run Unity versions sequentially to avoid license exhaustion
matrix:
unity-version: ${{ fromJSON(needs.create-unity-matrix.outputs.unity-matrix).unity-version }}
os: ["windows"]
Expand Down Expand Up @@ -390,6 +404,15 @@ jobs:
- name: Extract project archive
run: tar -xvzf test-project.tar.gz

- name: Cache Unity Library
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: samples/IntegrationTest/Library
key: Library-IntegrationTest-${{ matrix.os }}-${{ matrix.unity-version }}-v1
restore-keys: |
Library-IntegrationTest-${{ matrix.os }}-${{ matrix.unity-version }}-
Library-IntegrationTest-${{ matrix.os }}-

- name: Build without Sentry SDK
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH"

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ jobs:
DEBIAN_FRONTEND: noninteractive

- name: Install .NET SDK
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added missing skips if the cache was hit.

uses: actions/setup-dotnet@d4c94342e560b34958eacfc5d055d21461ed1c5d # v5
with:
global-json-file: global.json

- name: Restore .NET Workload
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: dotnet workload restore

- name: Build
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/smoke-test-build-android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,15 @@ jobs:
- name: Extract project archive
run: tar -xvzf test-project.tar.gz

- name: Cache Unity Library
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: samples/IntegrationTest/Library
key: Library-IntegrationTest-Android-${{ env.UNITY_VERSION }}-v1
restore-keys: |
Library-IntegrationTest-Android-${{ env.UNITY_VERSION }}-
Library-IntegrationTest-Android-

- name: Download UPM package
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 # v4-with-wait-timeout
with:
Expand Down
17 changes: 13 additions & 4 deletions .github/workflows/smoke-test-build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ jobs:
- name: Extract project archive
run: tar -xvzf test-project.tar.gz

- name: Cache Unity Library
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: samples/IntegrationTest/Library
key: Library-IntegrationTest-iOS-${{ env.UNITY_VERSION }}-v1
restore-keys: |
Library-IntegrationTest-iOS-${{ env.UNITY_VERSION }}-
Library-IntegrationTest-iOS-

- name: Download UPM package
uses: vaind/download-artifact@e7141b6a94ef28aa3d828b52830cfa1f406a1848 # v4-with-wait-timeout
with:
Expand All @@ -72,21 +81,21 @@ jobs:
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}

- name: Build Project
- name: Build Project with runtime initialization
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}

# We create tar explicitly because upload-artifact is slow for many files.
- name: Create archive
- name: Create archive (runtime initialization)
shell: bash
run: |
# Note: remove local.properties file that contains Android SDK & NDK paths in the Unity installation.
rm -rf samples/IntegrationTest/Build/*_BackUpThisFolder_ButDontShipItWithYourGame
tar -cvzf test-app-runtime.tar.gz samples/IntegrationTest/Build

# Upload runtime initialization build
- name: Upload test app
- name: Upload test app (runtime initialization)
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: testapp-ios-${{ env.UNITY_VERSION }}-runtime
Expand All @@ -101,7 +110,7 @@ jobs:
$content = $content -replace 'IosNativeInitializationType = NativeInitializationType.Runtime', 'IosNativeInitializationType = NativeInitializationType.BuildTime'
Set-Content $optionsPath $content

- name: Build Project for mobile platforms (build-time initialization)
- name: Build Project with build-time initialization
run: ./test/Scripts.Integration.Test/build-project.ps1 -UnityPath "$env:UNITY_PATH" -Platform "$env:BUILD_PLATFORM" -CheckSymbols:$false -UnityVersion "$env:UNITY_VERSION"
env:
BUILD_PLATFORM: ${{ matrix.build_platform }}
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/smoke-test-create.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,24 @@ jobs:
username: ${{ env.GITHUB_ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Cache IntegrationTest Project
id: cache-project
uses: actions/cache@d4323d4df104b026a6aa633fdb11d772146be0bf # v4.2.2
with:
path: samples/IntegrationTest
key: IntegrationTest-Project-${{ env.UNITY_VERSION }}-${{ hashFiles('test/Scripts.Integration.Test/**') }}-v1
restore-keys: |
IntegrationTest-Project-${{ env.UNITY_VERSION }}-

- name: Start the Unity docker container
if: steps.cache-project.outputs.cache-hit != 'true'
run: ./scripts/ci-docker.sh "$UNITY_VERSION" 'base' "$UNITY_LICENSE_SERVER_CONFIG"
shell: bash
env:
UNITY_LICENSE_SERVER_CONFIG: ${{ secrets.UNITY_LICENSE_SERVER_CONFIG }}

- name: Create new Project
if: steps.cache-project.outputs.cache-hit != 'true'
run: ./test/Scripts.Integration.Test/create-project.ps1 -UnityPath "$env:UNITY_PATH"

# We create tar explicitly because upload-artifact is slow for many files.
Expand Down
8 changes: 5 additions & 3 deletions scripts/ci-docker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ docker run -td --name $container \
-e GITHUB_ACTIONS="${GITHUB_ACTIONS}" \
--workdir /sentry-unity $image

# Generate unique machine-id to avoid any hardcoded values and license-fetch congestion
$suexec $container rm -f /etc/machine-id
$suexec $container dbus-uuidgen --ensure=/etc/machine-id

$suexec $container groupadd -g $gid $user
$suexec $container useradd -u $uid -g $gid --create-home $user

Expand All @@ -50,9 +54,7 @@ echo $licenseConfig | $suexec -i $container sh -c "cat > /usr/share/unity3d/conf
$suexec $container chown -R $uid /usr/share/unity3d/config/

# Unity 2021+ tries to write to this directory during asset import...
if [[ $unityPrefix -ge 2021 ]]; then
$suexec $container chmod -R 755 /opt/unity/Editor/Data/UnityReferenceAssemblies/
fi
$suexec $container chmod -R 755 /opt/unity/Editor/Data/UnityReferenceAssemblies/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was failing with

./scripts/ci-docker.sh: line 53: [[: 6000.0: syntax error: invalid arithmetic operator (error token is ".0")

and we're running on 2021+ only anyway.


echo "Container started successfully: "
docker ps --filter "name=^/$container$"
Loading