Optimize CI workflow. (#1743)

See pull request for details. Summary:

* Reduce dependencies between CI jobs, allowing more of them to run in parallel.
* Use Linux for as many jobs as possible.
* Merge matching "-ndll" and "-samples" jobs. This way, the latter doesn't have to waste time recreating the former's environment, and the workflow summary is simplified. Downside: this delays package-haxelib.
* Update to a newer macOS version, as the old version massively slowed down Homebrew.
* Skip the HelloWorld test for Mac and iOS, as those two can build slowly under some circumstances, delaying package-haxelib. These could be restored later, if performance seems good enough.
* Add `HAXE_VERSION` environment variable, so future updates will only have to make one change. Unfortunately, doing the same for the Windows/Mac/Linux versions would severely hurt performance, so those remain hard-coded.
* Split up some steps within jobs for better organization.
This commit is contained in:
player-03
2024-01-18 13:22:05 -05:00
committed by GitHub
parent a48898849e
commit a414f64173
2 changed files with 269 additions and 407 deletions

View File

@@ -52,31 +52,39 @@ class PlatformTarget
this.additionalArguments = additionalArguments;
var metaFields = Meta.getFields(Type.getClass(this));
if (/*!Reflect.hasField (metaFields.watch, "ignore") && */ (project.targetFlags.exists("watch")))
// known issue: this may not log in `-eval` mode on Linux
inline function logCommand(command:String):Void
{
if (!Reflect.hasField(metaFields, command)
|| !Reflect.hasField(Reflect.field(metaFields, command), "ignore"))
{
Log.info("", "\n" + Log.accentColor + "Running command: " + command.toUpperCase() + Log.resetColor);
}
}
if (project.targetFlags.exists("watch"))
{
Log.info("", "\n" + Log.accentColor + "Running command: WATCH" + Log.resetColor);
watch();
return;
}
if ((!Reflect.hasField(metaFields, "display") || !Reflect.hasField(metaFields.display, "ignore")) && (command == "display"))
if (command == "display")
{
display();
}
// if (!Reflect.hasField (metaFields.clean, "ignore") && (command == "clean" || targetFlags.exists ("clean"))) {
if ((!Reflect.hasField(metaFields, "clean") || !Reflect.hasField(metaFields.clean, "ignore"))
&& (command == "clean"
|| (project.targetFlags.exists("clean") && (command == "update" || command == "build" || command == "test"))))
// if (command == "clean" || project.targetFlags.exists ("clean")) {
if (command == "clean"
|| (project.targetFlags.exists("clean") && (command == "update" || command == "build" || command == "test")))
{
Log.info("", Log.accentColor + "Running command: CLEAN" + Log.resetColor);
logCommand("CLEAN");
clean();
}
if ((!Reflect.hasField(metaFields, "rebuild") || !Reflect.hasField(metaFields.rebuild, "ignore"))
&& (command == "rebuild" || project.targetFlags.exists("rebuild")))
if (command == "rebuild" || project.targetFlags.exists("rebuild"))
{
Log.info("", "\n" + Log.accentColor + "Running command: REBUILD" + Log.resetColor);
logCommand("REBUILD");
// hack for now, need to move away from project.rebuild.path, probably
@@ -88,60 +96,53 @@ class PlatformTarget
rebuild();
}
if ((!Reflect.hasField(metaFields, "update") || !Reflect.hasField(metaFields.update, "ignore"))
&& (command == "update" || command == "build" || command == "test"))
if (command == "update" || command == "build" || command == "test")
{
Log.info("", "\n" + Log.accentColor + "Running command: UPDATE" + Log.resetColor);
logCommand("update");
// #if lime
// AssetHelper.processLibraries (project, targetDirectory);
// #end
update();
}
if ((!Reflect.hasField(metaFields, "build") || !Reflect.hasField(metaFields.build, "ignore"))
&& (command == "build" || command == "test"))
if (command == "build" || command == "test")
{
CommandHelper.executeCommands(project.preBuildCallbacks);
Log.info("", "\n" + Log.accentColor + "Running command: BUILD" + Log.resetColor);
logCommand("build");
build();
CommandHelper.executeCommands(project.postBuildCallbacks);
}
if ((!Reflect.hasField(metaFields, "deploy") || !Reflect.hasField(metaFields.deploy, "ignore")) && (command == "deploy"))
if (command == "deploy")
{
Log.info("", "\n" + Log.accentColor + "Running command: DEPLOY" + Log.resetColor);
logCommand("deploy");
deploy();
}
if ((!Reflect.hasField(metaFields, "install") || !Reflect.hasField(metaFields.install, "ignore"))
&& (command == "install" || command == "run" || command == "test"))
if (command == "install" || command == "run" || command == "test")
{
Log.info("", "\n" + Log.accentColor + "Running command: INSTALL" + Log.resetColor);
logCommand("install");
install();
}
if ((!Reflect.hasField(metaFields, "run") || !Reflect.hasField(metaFields.run, "ignore"))
&& (command == "run" || command == "rerun" || command == "test"))
if (command == "run" || command == "rerun" || command == "test")
{
Log.info("", "\n" + Log.accentColor + "Running command: RUN" + Log.resetColor);
logCommand("run");
run();
}
if ((!Reflect.hasField(metaFields, "trace") || !Reflect.hasField(metaFields.trace, "ignore"))
&& (command == "test" || command == "trace" || command == "run" || command == "rerun"))
if ((command == "test" || command == "trace" || command == "run" || command == "rerun")
&& (traceEnabled || command == "trace"))
{
if (traceEnabled || command == "trace")
{
Log.info("", "\n" + Log.accentColor + "Running command: TRACE" + Log.resetColor);
this.trace();
}
logCommand("trace");
this.trace();
}
if ((!Reflect.hasField(metaFields, "uninstall") || !Reflect.hasField(metaFields.uninstall, "ignore")) && (command == "uninstall"))
if (command == "uninstall")
{
Log.info("", "\n" + Log.accentColor + "Running command: UNINSTALL" + Log.resetColor);
logCommand("UNINSTALL");
uninstall();
}
}