Skip to content

Commit

Permalink
Merge pull request #4 from ecsact-dev/chore/add-ci
Browse files Browse the repository at this point in the history
chore: add ci
  • Loading branch information
zaucy authored Aug 7, 2024
2 parents 9a1e0c0 + c687607 commit 0980413
Show file tree
Hide file tree
Showing 5 changed files with 122 additions and 79 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,15 @@ insert_final_newline = true
indent_size = 4
indent_style = tab

[*.{yml,yaml}]
indent_size = 2
indent_style = space

[*.clang-format]
indent_size = 2
indent_style = space

[*.{cc,hh,cpp,hpp,h,cpp}]
# matching .clang-format IndentWidth
indent_size = 2
indent_style = tab
22 changes: 22 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: main

on:
pull_request:
merge_group:

jobs:
typos-check:
name: Typos Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: crate-ci/typos@cfe759ac8dd421e203cc293a373396fbc6fe0d4b # v1.22.7

formatting-check:
name: Formatting Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: greut/eclint-action@v0
- uses: jidicula/clang-format-action@v4.11.0
with: { clang-format-version: "18" }
160 changes: 82 additions & 78 deletions Source/EcsactEditor/Private/EcsactEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,11 @@ auto FEcsactEditorModule::RunCodegen() -> void {

auto FEcsactEditorModule::RunBuild() -> void {
const auto* settings = GetDefault<UEcsactSettings>();
auto ecsact_runtime_path = FPaths::Combine(
FPaths::ProjectDir(),
TEXT("Binaries/Win64/EcsactRuntime.dll")
);

auto ecsact_runtime_path = FPaths::Combine(
FPaths::ProjectDir(),
TEXT("Binaries/Win64/EcsactRuntime.dll")
);
auto temp_dir = FPaths::CreateTempFilename(TEXT("EcsactBuild"));

auto ecsact_files = GetAllEcsactFiles();
Expand Down Expand Up @@ -290,86 +291,89 @@ auto FEcsactEditorModule::OnReceiveEcsactCliJsonMessage(FString Json) -> void {
auto json_object = TSharedPtr<FJsonObject>{};
auto reader = TJsonReaderFactory<>::Create(Json);

if(FJsonSerializer::Deserialize(reader, json_object) &&
json_object.IsValid()) {
auto message_type = json_object->GetStringField(TEXT("type"));

if(message_type == "info") {
UE_LOG(
EcsactEditor,
Log,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else if(message_type == "error") {
UE_LOG(
EcsactEditor,
Error,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else if(message_type == "warning") {
UE_LOG(
EcsactEditor,
Warning,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else if(message_type == "subcommand_start") {
UE_LOG(
EcsactEditor,
Log,
TEXT("subcommand(%i): %s"),
json_object->GetIntegerField(TEXT("id")),
*json_object->GetStringField(TEXT("executable"))
);
} else if(message_type == "subcommand_end") {
UE_LOG(
EcsactEditor,
Log,
TEXT("subcommand(%i): exit code %i"),
json_object->GetIntegerField(TEXT("id")),
json_object->GetIntegerField(TEXT("exit_code"))
);
} else if(message_type == "subcommand_stdout") {
UE_LOG(
EcsactEditor,
Log,
TEXT("subcommand(%i): %s"),
json_object->GetIntegerField(TEXT("id")),
*json_object->GetStringField(TEXT("line"))
);
} else if(message_type == "subcommand_stderr") {
UE_LOG(
EcsactEditor,
Error,
TEXT("subcommand(%i): %s"),
json_object->GetIntegerField(TEXT("id")),
*json_object->GetStringField(TEXT("line"))
);
} else if(message_type == "success") {
UE_LOG(
EcsactEditor,
Log,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else {
UE_LOG(
EcsactEditor,
Warning,
TEXT("Unhandled Message (%s): %s"),
*message_type,
*Json
);
}
} else {
if(!FJsonSerializer::Deserialize(reader, json_object)) {
UE_LOG(
EcsactEditor,
Error,
TEXT("Failed to parse JSON message: %s"),
*Json
);
return;
}
if(!json_object.IsValid()) {
return;
}

auto message_type = json_object->GetStringField(TEXT("type"));

if(message_type == "info") {
UE_LOG(
EcsactEditor,
Log,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else if(message_type == "error") {
UE_LOG(
EcsactEditor,
Error,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else if(message_type == "warning") {
UE_LOG(
EcsactEditor,
Warning,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else if(message_type == "subcommand_start") {
UE_LOG(
EcsactEditor,
Log,
TEXT("subcommand(%i): %s"),
json_object->GetIntegerField(TEXT("id")),
*json_object->GetStringField(TEXT("executable"))
);
} else if(message_type == "subcommand_end") {
UE_LOG(
EcsactEditor,
Log,
TEXT("subcommand(%i): exit code %i"),
json_object->GetIntegerField(TEXT("id")),
json_object->GetIntegerField(TEXT("exit_code"))
);
} else if(message_type == "subcommand_stdout") {
UE_LOG(
EcsactEditor,
Log,
TEXT("subcommand(%i): %s"),
json_object->GetIntegerField(TEXT("id")),
*json_object->GetStringField(TEXT("line"))
);
} else if(message_type == "subcommand_stderr") {
UE_LOG(
EcsactEditor,
Error,
TEXT("subcommand(%i): %s"),
json_object->GetIntegerField(TEXT("id")),
*json_object->GetStringField(TEXT("line"))
);
} else if(message_type == "success") {
UE_LOG(
EcsactEditor,
Log,
TEXT("%s"),
*json_object->GetStringField(TEXT("content"))
);
} else {
UE_LOG(
EcsactEditor,
Warning,
TEXT("Unhandled Message (%s): %s"),
*message_type,
*Json
);
}
}

Expand Down
1 change: 0 additions & 1 deletion Source/EcsactEditor/Private/EcsactSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

UEcsactSettings::UEcsactSettings() {
}

6 changes: 6 additions & 0 deletions typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[files]
extend-exclude = ["CHANGELOG.md"]

[default]
extend-ignore-re = ["(?Rm)^.*(#|//)\\s*typos:disable-line$"]
extend-ignore-words-re = ["UE"]

0 comments on commit 0980413

Please sign in to comment.