Skip to content

v3.1.0

v3.1.0 #1443

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
- 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: 120
# Workaround for NUnit XML (see https://github.com/dorny/test-reporter/issues/98#issuecomment-867106931)
- name: Install NUnit
if: always()
run: |
nuget install NUnit.Console -Version 3.12.0
- name: Fetch transform code
if: always()
run: |
wget https://raw.githubusercontent.com/nunit/nunit-transforms/master/nunit3-junit/nunit3-junit.xslt
shell: bash
- name: Transform NUnit3 to JUnit
if: always()
run: |
Get-ChildItem . -Filter artifacts/*.xml | Foreach-Object {
$xml = Resolve-Path $_.FullName
$output = Join-Path ($pwd) ($_.BaseName + '_junit.xml')
$xslt = New-Object System.Xml.Xsl.XslCompiledTransform;
$xslt.Load("nunit3-junit.xslt");
$xslt.Transform($xml, $output);
}
shell: pwsh
- uses: dorny/test-reporter@v1
if: always()
with:
name: unity-test-results-${{ matrix.unity.major }}-${{ matrix.testMode.name }}-${{ matrix.configuration.name }}-${{ matrix.objectPooling.name }}
path: "*_junit.xml"
reporter: java-junit
- 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