Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add standalone testmode support #219

Merged
merged 11 commits into from
Apr 21, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
123 changes: 117 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -32,10 +32,11 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2019.2.11f1
- 2019.4.40f1
testMode:
- playmode
- editmode
- standalone
steps:
###########################
# Checkout #
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2019.2.11f1
- 2019.4.40f1
steps:
###########################
# Checkout #
Expand Down Expand Up @@ -131,7 +132,7 @@ jobs:
fail-fast: false
matrix:
unityVersion:
- 2019.2.11f1
- 2019.4.40f1
projectPath:
- unity-project-with-correct-tests
steps:
Expand Down Expand Up @@ -188,7 +189,7 @@ jobs:
projectPath:
- unity-project-with-correct-tests
unityVersion:
- 2019.2.11f1
- 2019.4.40f1
steps:
###########################
# Checkout #
Expand Down Expand Up @@ -234,14 +235,115 @@ 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
strategy:
fail-fast: false
matrix:
unityVersion:
- 2019.2.11f1
- 2019.4.40f1
projectPath:
- unity-project-with-correct-tests
steps:
Expand Down Expand Up @@ -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
Expand Down
Loading