Skip to content

Commit ce53639

Browse files
authored
Set up Unit tests (#220)
* Add a base Unity project to run unit tests in * Add Windsurf IDE support so I can test more easily * Add a dummy script * feat: add unit tests for CommandRegistry and document prefab asset workflows * Run tests when code is pushed to main * Bump version of actions * Install the MCP plugin via relative path * Remove test branch from GH workflow
1 parent c9d30da commit ce53639

File tree

19 files changed

+1037
-0
lines changed

19 files changed

+1037
-0
lines changed

.github/workflows/unity-tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Unity Tests
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
paths:
7+
- TestProjects/UnityMCPTests/**
8+
- UnityMcpBridge/Editor/**
9+
- .github/workflows/unity-tests.yml
10+
11+
jobs:
12+
testAllModes:
13+
name: Test in ${{ matrix.testMode }}
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
projectPath:
19+
- TestProjects/UnityMCPTests
20+
testMode:
21+
- editmode
22+
unityVersion:
23+
- 2021.3.45f1
24+
steps:
25+
# Checkout
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
lfs: true
30+
31+
# Cache
32+
- uses: actions/cache@v4
33+
with:
34+
path: ${{ matrix.projectPath }}/Library
35+
key: Library-${{ matrix.projectPath }}-${{ matrix.unityVersion }}
36+
restore-keys: |
37+
Library-${{ matrix.projectPath }}-
38+
Library-
39+
40+
# Test
41+
- name: Run tests
42+
uses: game-ci/unity-test-runner@v4
43+
id: tests
44+
env:
45+
UNITY_EMAIL: ${{ secrets.UNITY_EMAIL }}
46+
UNITY_PASSWORD: ${{ secrets.UNITY_PASSWORD }}
47+
UNITY_LICENSE: ${{ secrets.UNITY_LICENSE }}
48+
with:
49+
projectPath: ${{ matrix.projectPath }}
50+
unityVersion: ${{ matrix.unityVersion }}
51+
testMode: ${{ matrix.testMode }}
52+
53+
# Upload test results
54+
- uses: actions/upload-artifact@v4
55+
if: always()
56+
with:
57+
name: Test results for ${{ matrix.testMode }}
58+
path: ${{ steps.tests.outputs.artifactsPath }}
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
# This .gitignore file should be placed at the root of your Unity project directory
2+
#
3+
# Get latest from https://github.com/github/gitignore/blob/main/Unity.gitignore
4+
#
5+
.utmp/
6+
/[Ll]ibrary/
7+
/[Tt]emp/
8+
/[Oo]bj/
9+
/[Bb]uild/
10+
/[Bb]uilds/
11+
/[Ll]ogs/
12+
/[Uu]ser[Ss]ettings/
13+
*.log
14+
15+
# By default unity supports Blender asset imports, *.blend1 blender files do not need to be commited to version control.
16+
*.blend1
17+
*.blend1.meta
18+
19+
# MemoryCaptures can get excessive in size.
20+
# They also could contain extremely sensitive data
21+
/[Mm]emoryCaptures/
22+
23+
# Recordings can get excessive in size
24+
/[Rr]ecordings/
25+
26+
# Uncomment this line if you wish to ignore the asset store tools plugin
27+
# /[Aa]ssets/AssetStoreTools*
28+
29+
# Autogenerated Jetbrains Rider plugin
30+
/[Aa]ssets/Plugins/Editor/JetBrains*
31+
# Jetbrains Rider personal-layer settings
32+
*.DotSettings.user
33+
34+
# Visual Studio cache directory
35+
.vs/
36+
37+
# Gradle cache directory
38+
.gradle/
39+
40+
# Autogenerated VS/MD/Consulo solution and project files
41+
ExportedObj/
42+
.consulo/
43+
*.csproj
44+
*.unityproj
45+
*.sln
46+
*.suo
47+
*.tmp
48+
*.user
49+
*.userprefs
50+
*.pidb
51+
*.booproj
52+
*.svd
53+
*.pdb
54+
*.mdb
55+
*.opendb
56+
*.VC.db
57+
58+
# Unity3D generated meta files
59+
*.pidb.meta
60+
*.pdb.meta
61+
*.mdb.meta
62+
63+
# Unity3D generated file on crash reports
64+
sysinfo.txt
65+
66+
# Mono auto generated files
67+
mono_crash.*
68+
69+
# Builds
70+
*.apk
71+
*.aab
72+
*.unitypackage
73+
*.unitypackage.meta
74+
*.app
75+
76+
# Crashlytics generated file
77+
crashlytics-build.properties
78+
79+
# TestRunner generated files
80+
InitTestScene*.unity*
81+
82+
# Addressables default ignores, before user customizations
83+
/ServerData
84+
/[Aa]ssets/StreamingAssets/aa*
85+
/[Aa]ssets/AddressableAssetsData/link.xml*
86+
/[Aa]ssets/Addressables_Temp*
87+
# By default, Addressables content builds will generate addressables_content_state.bin
88+
# files in platform-specific subfolders, for example:
89+
# /Assets/AddressableAssetsData/OSX/addressables_content_state.bin
90+
/[Aa]ssets/AddressableAssetsData/*/*.bin*
91+
92+
# Visual Scripting auto-generated files
93+
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db
94+
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Flow/UnitOptions.db.meta
95+
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers
96+
/[Aa]ssets/Unity.VisualScripting.Generated/VisualScripting.Core/Property Providers.meta
97+
98+
# Auto-generated scenes by play mode tests
99+
/[Aa]ssets/[Ii]nit[Tt]est[Ss]cene*.unity*
100+
101+
.vscode
102+
.cursor
103+
.windsurf
104+
.claude
105+
.DS_Store

TestProjects/UnityMCPTests/Assets/Scenes.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)