ci: Add workflow that compares the compiled output between the PR and master (#3626)

Fixes #3063
This commit is contained in:
Tyler Wilding
2024-08-03 02:42:34 -04:00
committed by GitHub
parent 2e9b099d58
commit a13b0dce45
14 changed files with 170 additions and 38 deletions
+15 -4
View File
@@ -8,6 +8,8 @@
#include "BinaryWriter.h"
#include "FileUtil.h"
#include "common/log/log.h"
void build_dgo(const DgoDescription& description, const std::string& output_prefix) {
BinaryWriter writer;
// dgo header
@@ -15,8 +17,14 @@ void build_dgo(const DgoDescription& description, const std::string& output_pref
writer.add_cstr_len(description.dgo_name.c_str(), 60);
for (auto& obj : description.entries) {
auto obj_data = file_util::read_binary_file(file_util::get_jak_project_dir() / "out" /
output_prefix / "obj" / obj.file_name);
// Ensure the directory exists
const auto file_path =
file_util::get_jak_project_dir() / "out" / output_prefix / "obj" / obj.file_name;
if (!file_util::file_exists(file_path.string())) {
lg::warn("tried to build a DGO with a file that doesn't exist: {}", file_path.string());
continue;
}
auto obj_data = file_util::read_binary_file(file_path);
// size
writer.add<uint32_t>(obj_data.size());
// name
@@ -29,6 +37,9 @@ void build_dgo(const DgoDescription& description, const std::string& output_pref
}
}
writer.write_to_file(file_util::get_jak_project_dir() / "out" / output_prefix / "iso" /
description.dgo_name);
// Ensure the output directory exists
const auto dgo_path =
file_util::get_jak_project_dir() / "out" / output_prefix / "iso" / description.dgo_name;
file_util::create_dir_if_needed_for_file(dgo_path);
writer.write_to_file(dgo_path);
}