Skip to content

Use RuntimeHelpers.IsReferenceOrContainsReferences #1525

Use RuntimeHelpers.IsReferenceOrContainsReferences

Use RuntimeHelpers.IsReferenceOrContainsReferences #1525

Workflow file for this run

name: Unity Tests
on: [pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
unity-tests:
name: ${{ matrix.unity.major }}-${{ matrix.configuration.name }}-${{ matrix.objectPooling.name }}-${{ matrix.testMode.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
testMode:
- {
name: Editor,
value: PlayMode,
}
- {
name: Standalone,
value: Standalone,
}
# Not testing WebGL as unity-test-runner does not support it.
#- {
# name: WebGL,
# value: WebGL,
# buildTargetId: 13
# }
configuration:
- {
name: Release,
symbol: PROTO_PROMISE_DEBUG_DISABLE
}
- {
name: Debug,
symbol: PROTO_PROMISE_DEBUG_ENABLE
}
objectPooling:
- {
name: Pool_Enabled,
symbol: PROTO_PROMISE_POOL_ENABLE
}
- {
name: Pool_Disabled,
symbol: PROTO_PROMISE_POOL_DISABLE
}
# Editor uses 2018 to test netstandard2.0 in Mono.
# Standalone uses 2019 and 2023 to test IL2CPP with netstandard2.0 and netstandard2.1.
unity:
- {
major: 2018,
version: 2018.4.36f1,
}
- {
major: 2019,
version: 2019.4.40f1,
}
- {
major: 2023,
version: 2023.1.0f1,
}
exclude:
# DEBUG mode forces pooling disabled.
- {
configuration: { name: Debug },
objectPooling: { name: Pool_Enabled }
}
# Editor tests only run in 2018.4 to keep CI times down.
- {
testMode: { name: Editor },
unity: { major: 2019 }
}
- {
testMode: { name: Editor },
unity: { major: 2023 }
}
# Standalone with IL2CPP can only be built with 2019.4+ (unity-builder docker images constraint).
- {
testMode: { name: Standalone },
unity: { major: 2018 }
}
include:
# id 1 for old Unity versions, Standalone for new Unity versions.
# This is hard-coded for Standalone, since we can't run WebGL tests in CI.
- unity: { major: 2018 }
buildTargetId: 1
- unity: { major: 2019 }
buildTargetId: 1
- unity: { major: 2023 }
buildTargetId: standalone
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy Project Settings
run: cp -a .github/unityci/Unity_${{ matrix.unity.major }}_Settings/. ProtoPromise_Unity/
- name: Rewrite ProjectSettings
run: |
DefineOriginal=" scriptingDefineSymbols: {}"
DefineReplace=" scriptingDefineSymbols: \\n ${{ matrix.buildTargetId }}: ${{ matrix.configuration.symbol }};${{ matrix.objectPooling.symbol }}"
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ProtoPromise_Unity/ProjectSettings/ProjectSettings.asset
# Linux IL2CPP builds consume extra disk space, so we free up some disk space to prevent the build from failing.
- name: Delete Extra ProjectSettings
run: rm -r -f .github/unityci
if: matrix.testMode.name == 'Standalone'
- uses: jlumbroso/free-disk-space@v1.3.1
if: matrix.testMode.name == 'Standalone'
- name: Run tests
id: tests
uses: game-ci/unity-test-runner@v4
env:
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE_2018_4_36F1_UBUNTU }}
with:
projectPath: ProtoPromise_Unity
testMode: ${{ matrix.testMode.value }}
unityVersion: ${{ matrix.unity.version }}
timeout-minutes: 180
- uses: dorny/test-reporter@main
if: always()
with:
name: unity-test-results-${{ matrix.unity.major }}-${{ matrix.testMode.name }}-${{ matrix.configuration.name }}-${{ matrix.objectPooling.name }}
path: 'artifacts/*.xml'
reporter: dotnet-nunit
- uses: actions/upload-artifact@v4
if: always()
with:
name: unity-test-results-${{ matrix.unity.major }}-${{ matrix.testMode.name }}-${{ matrix.configuration.name }}-${{ matrix.objectPooling.name }}
path: artifacts