Skip to content

Commit b20cd4e

Browse files
authored
Merge pull request #34 from Cysharp/feature/unittest
ci: Change Unity UnitTest from Mono to IL2CPP and enabled on CI
2 parents 8289ccf + b800843 commit b20cd4e

21 files changed

+523
-126
lines changed

.github/workflows/build-debug.yml

Lines changed: 44 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,11 @@ on:
1010

1111
jobs:
1212
build-unity:
13-
if: ${{ (github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:') }}
13+
if: ${{ ((github.event_name == 'push' && github.repository_owner == 'Cysharp') || startsWith(github.event.pull_request.head.label, 'Cysharp:')) && github.triggering_actor != 'dependabot[bot]' }}
1414
strategy:
15+
fail-fast: false
1516
matrix:
16-
unity: ["2019.3.9f1", "2019.4.13f1", "2020.1.12f1"]
17+
unity: ["2021.3.41f1", "2022.3.39f1", "6000.0.12f1"] # Test with LTS
1718
runs-on: ubuntu-latest
1819
timeout-minutes: 15
1920
steps:
@@ -28,10 +29,29 @@ jobs:
2829
UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential"
2930
UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial"
3031

31-
- uses: actions/checkout@v3
32-
# Execute scripts: RuntimeUnitTestToolkit(Linux64/Mono2x)
32+
- uses: actions/checkout@v4
33+
34+
# Execute scripts: Export Package
35+
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
36+
- name: Build Unity (.unitypacakge)
37+
uses: Cysharp/Actions/.github/actions/unity-builder@main
38+
env:
39+
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
40+
UNITY_PASSWORD: ${{ steps.op-load-secret.outputs.UNITY_PASSWORD }}
41+
UNITY_SERIAL: ${{ steps.op-load-secret.outputs.UNITY_SERIAL }}
42+
with:
43+
projectPath: RuntimeUnitTestToolkit
44+
unityVersion: ${{ matrix.unity }}
45+
targetPlatform: StandaloneLinux64
46+
buildMethod: PackageExporter.Export
47+
48+
- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
49+
with:
50+
directory: RuntimeUnitTestToolkit
51+
52+
# Execute Unittest
3353
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend Mono2x /BuildTarget StandaloneLinux64
34-
- name: Build UnitTest(Linux64, mono)
54+
- name: Build UnitTest
3555
uses: Cysharp/Actions/.github/actions/unity-builder@main
3656
env:
3757
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
@@ -42,13 +62,17 @@ jobs:
4262
unityVersion: ${{ matrix.unity }}
4363
targetPlatform: StandaloneLinux64
4464
buildMethod: UnitTestBuilder.BuildUnitTest
45-
customParameters: /headless /ScriptBackend Mono2x
65+
customParameters: "/headless /ScriptBackend Mono2x"
66+
- name: Check UnitTest file is generated
67+
run: ls -lR ./RuntimeUnitTestToolkit/bin/UnitTest
4668
- name: Execute UnitTest
4769
run: ./RuntimeUnitTestToolkit/bin/UnitTest/StandaloneLinux64_Mono2x/test
4870

49-
# Execute scripts: Export Package
50-
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod PackageExporter.Export
51-
- name: Build Unity (.unitypacakge)
71+
- name: Remove Library
72+
run: sudo rm -rf ./RuntimeUnitTestToolkit/Library
73+
74+
# /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64
75+
- name: Build UnitTest
5276
uses: Cysharp/Actions/.github/actions/unity-builder@main
5377
env:
5478
UNITY_EMAIL: ${{ steps.op-load-secret.outputs.UNITY_EMAIL }}
@@ -58,8 +82,16 @@ jobs:
5882
projectPath: RuntimeUnitTestToolkit
5983
unityVersion: ${{ matrix.unity }}
6084
targetPlatform: StandaloneLinux64
61-
buildMethod: PackageExporter.Export
85+
buildMethod: UnitTestBuilder.BuildUnitTest
86+
customParameters: "/headless /ScriptBackend IL2CPP"
87+
- name: Check UnitTest file is generated
88+
run: ls -lR ./RuntimeUnitTestToolkit/bin/UnitTest
89+
- name: Execute UnitTest
90+
run: ./RuntimeUnitTestToolkit/bin/UnitTest/StandaloneLinux64_IL2CPP/test
6291

63-
- uses: Cysharp/Actions/.github/actions/check-metas@main # check meta files
92+
# Store artifacts.
93+
- uses: Cysharp/Actions/.github/actions/upload-artifact@main
6494
with:
65-
directory: RuntimeUnitTestToolkit
95+
name: RuntimeUnitTestToolkit.${{ matrix.unity }}.unitypackage.zip
96+
path: ./RuntimeUnitTestToolkit/*.unitypackage
97+
retention-days: 1

.github/workflows/build-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040
UNITY_PASSWORD: "op://GitHubActionsPublic/UNITY_LICENSE/credential"
4141
UNITY_SERIAL: "op://GitHubActionsPublic/UNITY_LICENSE/serial"
4242

43-
- uses: actions/checkout@v3
43+
- uses: actions/checkout@v4
4444
with:
4545
ref: ${{ needs.update-packagejson.outputs.sha }}
4646
# Execute scripts: Export Package

.gitignore

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ _ReSharper*
5858
*.ncrunch*
5959
.*crunch*.local.xml
6060

61-
# Installshield output folder
61+
# Installshield output folder
6262
[Ee]xpress
6363

6464
# DocProject is a documentation generator add-in
@@ -105,22 +105,15 @@ Generated_Code #added for RIA/Silverlight projects
105105
_UpgradeReport_Files/
106106
Backup*/
107107
UpgradeLog*.XML
108-
.vs/config/applicationhost.config
109-
.vs/restore.dg
108+
.vs
110109

111110
# Unity
112-
RuntimeUnitTestToolkit/bin/*
111+
.vsconfig
113112
RuntimeUnitTestToolkit/Library/*
114-
RuntimeUnitTestToolkit/obj/*
115113
RuntimeUnitTestToolkit/Temp/*
116-
RuntimeUnitTestToolkit/.vs/
117-
RuntimeUnitTestToolkit/UpgradeLog.htm
118-
RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.unitypackage
119-
120-
RuntimeUnitTestToolkit/Assembly-CSharp-Editor.csproj
121-
122-
RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.csproj
123-
124-
RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.sln
125-
126-
RuntimeUnitTestToolkit/Tests.csproj
114+
RuntimeUnitTestToolkit/Logs/*
115+
RuntimeUnitTestToolkit/[Uu]ser[Ss]ettings/
116+
RuntimeUnitTestToolkit/*.sln
117+
RuntimeUnitTestToolkit/*.csproj
118+
RuntimeUnitTestToolkit/*.unitypackage
119+
!RuntimeUnitTestToolkit/Packages/

README.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,24 @@ For example, this library's CI(GitHub Actions) itself.
5757
run: ./RuntimeUnitTestToolkit/bin/UnitTest/StandaloneLinux64_Mono2x/test
5858
```
5959
60+
```yml
61+
# Execute scripts: RuntimeUnitTestToolkit(Linux64/IL2CPP)
62+
- name: Build UnitTest(Linux64, il2cpp)
63+
run: /opt/Unity/Editor/Unity -quit -batchmode -nographics -silent-crashes -logFile -projectPath . -executeMethod UnitTestBuilder.BuildUnitTest /headless /ScriptBackend IL2CPP /BuildTarget StandaloneLinux64
64+
working-directory: RuntimeUnitTestToolkit
65+
66+
# Execute player:
67+
- name: Execute UnitTest
68+
run: ./RuntimeUnitTestToolkit/bin/UnitTest/StandaloneLinux64_IL2CPP/test
69+
```
70+
6071
You can invoke `-executeMethod UnitTestBuilder.BuildUnitTest` and some options.
6172

6273
| Command | Desc |
6374
| --- | --- |
6475
| **/headless** | Boolean switch, build CLI mode. Default is false. |
6576
| **/scriptBackend** ScriptingImplementation | Enum string(`Mono2x` or `IL2CPP` or `WinRTDotNET` )|
66-
| **/buildTarget** BuildTarget |Enum string(`StandaloneWindows64`, `StandaloneLinux64`, `StandaloneOSX`, `iOS`, `Android`, etc...) |
77+
| **/buildTarget** BuildTarget |Enum string(`StandaloneWindows64`, `StandaloneLinux64`, `StandaloneOSX`, `iOS`, `Android`, etc...) |
6778
| **/buildPath** FilePath | String path. Default is `bin/UnitTest/{BuildTarget}_{ScriptBackend}/test`(If windows `test.exe`, Android `test.apk`, OSX `test.app`) |
6879

6980
You can pass by `/` prefix.
@@ -116,7 +127,7 @@ Advanced
116127

117128
`/headless` argument offer CUI player, therefore user can handle stdout/stderr and ExitCode on CI.
118129

119-
However you will find it's not for StandaloneOSX. `BuildUnitTest` on StandaloneOSX generate `.app` but you cannot get any output or ExitCode with `open -a xxxx.app`
130+
However you will find it's not for StandaloneOSX. `BuildUnitTest` on StandaloneOSX generate `.app` but you cannot get any output or ExitCode with `open -a xxxx.app`
120131
Let's see what going on with this repository's UnitTest.
121132

122133
```shell

RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/Editor.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/Editor/HierarchyTreeBuilder.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/Editor/UnitTestBuilder.MenuItems.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/Editor/UnitTestBuilder.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/RuntimeUnitTestToolkit.asmdef.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

RuntimeUnitTestToolkit/Assets/RuntimeUnitTestToolkit/UnitTestData.cs.meta

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)