mirror of
https://github.com/game-ci/unity-test-runner.git
synced 2026-01-29 06:20:07 +08:00
Add standalone testmode support (#219)
* Add standalone support. * Add standalone tests. * UnityStandaloneScripts volume on windows * Update test framework in test project. * Revert IL2CPP setting in test project. Add test for IL2CPP. * Update dist/test-standalone-scripts/Assets/Player/UnityTestRunnerAction/TestRunCallback.cs Co-authored-by: Webber Takken <webber.nl@gmail.com> * Use 2019.2.21f1 * Unity is being dumb, use 2019.4.40f1 for all workflows. * Disable PlayerConnection on build. Print player log. * Add comment about code coverage support in standalone. * Update node-version in test --------- Co-authored-by: Webber Takken <webber.nl@gmail.com>
This commit is contained in:
123
.github/workflows/main.yml
vendored
123
.github/workflows/main.yml
vendored
@@ -16,7 +16,7 @@ jobs:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 12.x
|
||||
node-version: 18.x
|
||||
- run: yarn
|
||||
- run: yarn lint
|
||||
- run: yarn test
|
||||
@@ -32,10 +32,11 @@ jobs:
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
- 2019.2.11f1
|
||||
- 2019.4.40f1
|
||||
testMode:
|
||||
- playmode
|
||||
- editmode
|
||||
- standalone
|
||||
steps:
|
||||
###########################
|
||||
# Checkout #
|
||||
@@ -77,7 +78,7 @@ jobs:
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
- 2019.2.11f1
|
||||
- 2019.4.40f1
|
||||
steps:
|
||||
###########################
|
||||
# Checkout #
|
||||
@@ -131,7 +132,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
unityVersion:
|
||||
- 2019.2.11f1
|
||||
- 2019.4.40f1
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
steps:
|
||||
@@ -188,7 +189,7 @@ jobs:
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
- 2019.2.11f1
|
||||
- 2019.4.40f1
|
||||
steps:
|
||||
###########################
|
||||
# Checkout #
|
||||
@@ -234,6 +235,107 @@ jobs:
|
||||
path: ${{ steps.playMode.outputs.coveragePath }}
|
||||
retention-days: 14
|
||||
|
||||
testRunnerInStandalone:
|
||||
name: Test standalone 📺
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
- 2019.4.40f1
|
||||
steps:
|
||||
###########################
|
||||
# Checkout #
|
||||
###########################
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.projectPath }}-
|
||||
Library-
|
||||
|
||||
# Configure test runner
|
||||
- name: Run tests
|
||||
id: standalone
|
||||
uses: ./
|
||||
with:
|
||||
projectPath: ${{ matrix.projectPath }}
|
||||
unityVersion: ${{ matrix.unityVersion }}
|
||||
testMode: standalone
|
||||
artifactsPath: artifacts/standalone
|
||||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Test results (play mode)
|
||||
path: ${{ steps.standalone.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
testRunnerInStandaloneWithIL2CPP:
|
||||
name: Test standalone with IL2CPP 📺
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
unityVersion:
|
||||
- 2019.4.40f1 # Only 2019.4+ docker images contain the IL2CPP backend installed.
|
||||
steps:
|
||||
###########################
|
||||
# Checkout #
|
||||
###########################
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
lfs: true
|
||||
|
||||
###########################
|
||||
# Cache #
|
||||
###########################
|
||||
- uses: actions/cache@v3
|
||||
with:
|
||||
path: ${{ matrix.projectPath }}/Library
|
||||
key: Library-${{ matrix.projectPath }}-${{ matrix.targetPlatform }}
|
||||
restore-keys: |
|
||||
Library-${{ matrix.projectPath }}-
|
||||
Library-
|
||||
|
||||
# Set scripting backend to IL2CPP
|
||||
- name: Rewrite ProjectSettings
|
||||
run: |
|
||||
DefineOriginal=" scriptingBackend: {}"
|
||||
DefineReplace=" scriptingBackend: \\n Standalone: 1"
|
||||
sed -i "{s/$DefineOriginal/$DefineReplace/g}" ${{ matrix.projectPath }}/ProjectSettings/ProjectSettings.asset
|
||||
|
||||
# Configure test runner
|
||||
- name: Run tests
|
||||
id: standalone
|
||||
uses: ./
|
||||
with:
|
||||
projectPath: ${{ matrix.projectPath }}
|
||||
unityVersion: ${{ matrix.unityVersion }}
|
||||
testMode: standalone
|
||||
artifactsPath: artifacts/standalone
|
||||
|
||||
# Upload artifacts
|
||||
- name: Upload test results
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: Test results (play mode)
|
||||
path: ${{ steps.standalone.outputs.artifactsPath }}
|
||||
retention-days: 14
|
||||
|
||||
testEachModeSequentially:
|
||||
name: Test each mode sequentially 👩👩👧👦 # don't try this at home (it's much slower)
|
||||
runs-on: ubuntu-latest
|
||||
@@ -241,7 +343,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
unityVersion:
|
||||
- 2019.2.11f1
|
||||
- 2019.4.40f1
|
||||
projectPath:
|
||||
- unity-project-with-correct-tests
|
||||
steps:
|
||||
@@ -281,6 +383,15 @@ jobs:
|
||||
testMode: playmode
|
||||
artifactsPath: artifacts/playmode
|
||||
|
||||
# Configure third test runner
|
||||
- name: Tests in standalone 📺
|
||||
uses: ./
|
||||
with:
|
||||
projectPath: ${{ matrix.projectPath }}
|
||||
unityVersion: ${{ matrix.unityVersion }}
|
||||
testMode: standalone
|
||||
artifactsPath: artifacts/playmode
|
||||
|
||||
# Upload combined artifacts
|
||||
- name: Upload combined test results
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
Reference in New Issue
Block a user