-
Notifications
You must be signed in to change notification settings - Fork 424
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
Create UnityPackage Action でとりあえず EditMode Tests まで走らせる #2271
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
99b3e94
特定ブランチで動作させる
Santarh f48afa1
yq command を導入
Santarh c0144de
yq GitHub Action を使用
Santarh 2138800
Revert "yq GitHub Action を使用"
Santarh 3fe683b
yq を使用しない
Santarh b4ebf99
step まとめる
Santarh 13204e5
escape 調整
Santarh 45fa445
Add TestRunner method
Santarh a02304d
テストメソッドを呼び出す
Santarh 43bd3ee
edit mode test が実行されるようにする
Santarh 0862a6b
わざと失敗する
Santarh df0497a
テスト結果を出力してエラー終了できるようにする
Santarh cdf10f2
typo
Santarh ae297bf
output log
Santarh 14e0209
変数展開で初期値
Santarh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
using UnityEditor; | ||
using UnityEditor.TestTools.TestRunner.Api; | ||
using UnityEngine; | ||
|
||
namespace UniGLTF | ||
{ | ||
public static class TestRunner | ||
{ | ||
public static void RunEditModeTests() | ||
{ | ||
var testRunnerApi = ScriptableObject.CreateInstance<TestRunnerApi>(); | ||
testRunnerApi.RegisterCallbacks(new TestCallback()); | ||
testRunnerApi.Execute(new ExecutionSettings(new Filter | ||
{ | ||
testMode = TestMode.EditMode, | ||
})); | ||
} | ||
|
||
private class TestCallback : ICallbacks | ||
{ | ||
private static readonly string LogPrefix = $"[[TestRunnerLog]] "; | ||
private static readonly string ResultLogPrefix = $"[[TestRunnerResult]] "; | ||
private StackTraceLogType _tmpStackTraceLogType; | ||
|
||
public void RunStarted(ITestAdaptor testsToRun) | ||
{ | ||
_tmpStackTraceLogType = Application.GetStackTraceLogType(LogType.Log); | ||
Application.SetStackTraceLogType(LogType.Log, StackTraceLogType.None); | ||
|
||
Debug.Log($"{LogPrefix}Edit Mode Tests Started."); | ||
} | ||
|
||
public void RunFinished(ITestResultAdaptor result) | ||
{ | ||
Debug.Log($"{LogPrefix}Passed: {result.PassCount}, Skipped: {result.SkipCount}, Failed: {result.FailCount}"); | ||
Debug.Log($"{ResultLogPrefix}{result.FailCount}"); | ||
|
||
Application.SetStackTraceLogType(LogType.Log, _tmpStackTraceLogType); | ||
|
||
if (Application.isBatchMode) | ||
{ | ||
EditorApplication.Exit(result.FailCount > 0 ? 1 : 0); | ||
} | ||
} | ||
|
||
public void TestStarted(ITestAdaptor test) | ||
{ | ||
} | ||
|
||
public void TestFinished(ITestResultAdaptor result) | ||
{ | ||
if (result.HasChildren) return; | ||
|
||
if (result.TestStatus != TestStatus.Passed) | ||
{ | ||
Debug.Log($"{LogPrefix}{result.Message}"); | ||
Debug.Log($"{LogPrefix}{result.StackTrace}"); | ||
} | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
batchMode 起動のときに fail したテストがあったら終了コード
1
を返す