-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
342 changed files
with
27,257 additions
and
6 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-20.04 | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- uses: mpewsey/[email protected] | ||
with: | ||
working-directory: 'docs/' | ||
doxyfile-path: 'Doxyfile' | ||
|
||
- name: Deploy | ||
uses: mpewsey/actions-gh-pages@v3 | ||
if: ${{ github.ref == 'refs/heads/main' }} | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./docs/output/html |
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,55 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
paths: | ||
- '**.cs' | ||
- '**.csproj' | ||
- '**.sln' | ||
- '**.tscn' | ||
- '**.scn' | ||
- '**.tres' | ||
- '**.res' | ||
- '**.gd' | ||
- '.github/workflows/**' | ||
pull_request: | ||
branches: [ main ] | ||
paths: | ||
- '**.cs' | ||
- '**.csproj' | ||
- '**.sln' | ||
- '**.tscn' | ||
- '**.scn' | ||
- '**.tres' | ||
- '**.res' | ||
- '**.gd' | ||
- '.github/workflows/**' | ||
|
||
jobs: | ||
unit-tests: | ||
runs-on: ubuntu-20.04 | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
godot-version: ['4.2.2'] | ||
godot-status: ['stable'] | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: GdUnit4 - Test Runner Action | ||
uses: mpewsey/[email protected] | ||
with: | ||
godot-version: ${{ matrix.godot-version }} | ||
godot-status: ${{ matrix.godot-status }} | ||
godot-net: true | ||
version: 'v4.2.5' | ||
paths: 'res://tests/scripts' # Tests path | ||
retries: 3 | ||
report-name: Report_GdUnit4_Godot${{ matrix.godot-version }}-${{ matrix.godot-status }}.xml | ||
|
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
docs/output/* | ||
temp/* | ||
|
||
# Godot 4+ specific ignores | ||
.godot/ | ||
|
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 |
---|---|---|
@@ -1,8 +1,13 @@ | ||
<Project Sdk="Godot.NET.Sdk/4.2.2"> | ||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<LangVersion>11.0</LangVersion> | ||
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies> | ||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'android' ">net7.0</TargetFramework> | ||
<TargetFramework Condition=" '$(GodotTargetPlatform)' == 'ios' ">net8.0</TargetFramework> | ||
<EnableDynamicLoading>true</EnableDynamicLoading> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="gdUnit4.api" Version="4.2.3" /> | ||
</ItemGroup> | ||
</Project> |
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 @@ | ||
{"included":{"res://tests/":[]},"server_port":31002,"skipped":{},"version":"1.0"} |
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,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 Mike Schulze | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
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,110 @@ | ||
#!/usr/bin/env -S godot -s | ||
extends SceneTree | ||
|
||
enum { | ||
INIT, | ||
PROCESSING, | ||
EXIT | ||
} | ||
|
||
const RETURN_SUCCESS = 0 | ||
const RETURN_ERROR = 100 | ||
const RETURN_WARNING = 101 | ||
|
||
var _console := CmdConsole.new() | ||
var _cmd_options: = CmdOptions.new([ | ||
CmdOption.new( | ||
"-scp, --src_class_path", | ||
"-scp <source_path>", | ||
"The full class path of the source file.", | ||
TYPE_STRING | ||
), | ||
CmdOption.new( | ||
"-scl, --src_class_line", | ||
"-scl <line_number>", | ||
"The selected line number to generate test case.", | ||
TYPE_INT | ||
) | ||
]) | ||
|
||
var _status := INIT | ||
var _source_file :String = "" | ||
var _source_line :int = -1 | ||
|
||
|
||
func _init(): | ||
var cmd_parser := CmdArgumentParser.new(_cmd_options, "GdUnitBuildTool.gd") | ||
var result := cmd_parser.parse(OS.get_cmdline_args()) | ||
if result.is_error(): | ||
show_options() | ||
exit(RETURN_ERROR, result.error_message()); | ||
return | ||
var cmd_options = result.value() | ||
for cmd in cmd_options: | ||
if cmd.name() == '-scp': | ||
_source_file = cmd.arguments()[0] | ||
_source_file = ProjectSettings.localize_path(ProjectSettings.localize_path(_source_file)) | ||
if cmd.name() == '-scl': | ||
_source_line = int(cmd.arguments()[0]) | ||
# verify required arguments | ||
if _source_file == "": | ||
exit(RETURN_ERROR, "missing required argument -scp <source>") | ||
return | ||
if _source_line == -1: | ||
exit(RETURN_ERROR, "missing required argument -scl <number>") | ||
return | ||
_status = PROCESSING | ||
|
||
|
||
func _idle(_delta): | ||
if _status == PROCESSING: | ||
var script := ResourceLoader.load(_source_file) as Script | ||
if script == null: | ||
exit(RETURN_ERROR, "Can't load source file %s!" % _source_file) | ||
var result := GdUnitTestSuiteBuilder.create(script, _source_line) | ||
if result.is_error(): | ||
print_json_error(result.error_message()) | ||
exit(RETURN_ERROR, result.error_message()) | ||
return | ||
_console.prints_color("Added testcase: %s" % result.value(), Color.CORNFLOWER_BLUE) | ||
print_json_result(result.value()) | ||
exit(RETURN_SUCCESS) | ||
|
||
|
||
func exit(code :int, message :String = "") -> void: | ||
_status = EXIT | ||
if code == RETURN_ERROR: | ||
if not message.is_empty(): | ||
_console.prints_error(message) | ||
_console.prints_error("Abnormal exit with %d" % code) | ||
else: | ||
_console.prints_color("Exit code: %d" % RETURN_SUCCESS, Color.DARK_SALMON) | ||
quit(code) | ||
|
||
|
||
func print_json_result(result :Dictionary) -> void: | ||
# convert back to system path | ||
var path = ProjectSettings.globalize_path(result["path"]); | ||
var json = 'JSON_RESULT:{"TestCases" : [{"line":%d, "path": "%s"}]}' % [result["line"], path] | ||
prints(json) | ||
|
||
|
||
func print_json_error(error :String) -> void: | ||
prints('JSON_RESULT:{"Error" : "%s"}' % error) | ||
|
||
|
||
func show_options() -> void: | ||
_console.prints_color(" Usage:", Color.DARK_SALMON) | ||
_console.prints_color(" build -scp <source_path> -scl <line_number>", Color.DARK_SALMON) | ||
_console.prints_color("-- Options ---------------------------------------------------------------------------------------", | ||
Color.DARK_SALMON).new_line() | ||
for option in _cmd_options.default_options(): | ||
descripe_option(option) | ||
|
||
|
||
func descripe_option(cmd_option :CmdOption) -> void: | ||
_console.print_color(" %-40s" % str(cmd_option.commands()), Color.CORNFLOWER_BLUE) | ||
_console.prints_color(cmd_option.description(), Color.LIGHT_GREEN) | ||
if not cmd_option.help().is_empty(): | ||
_console.prints_color("%-4s %s" % ["", cmd_option.help()], Color.DARK_TURQUOISE) | ||
_console.new_line() |
Oops, something went wrong.