Freelancer XML Project in Github Workflows
-
Having a bit of a problem getting the Freelancer XML project to run in a github workflow environment. I had the bright idea of storing all my UTF files (cmp, etc) as XML in our repository so any changes to them would be properly tracked.
This works fairly well, and when building the mod we have a neat little python script that iterates over the XML folder and converts them all. However, when trying to run XMLUTF.exe in a workflow, it simply hangs. My sample PowerShell in the workflow to do this is as follows:
Invoke-WebRequest "http://adoxa.altervista.org/freelancer/dlt.php?f=xmlproject" -OutFile ${github.workspace}\xmlproject.zip Expand-Archive ${github.workspace}\xmlproject.zip Start-Process -Wait ${{ github.workspace }}\xmlproject\XMLUTF.exe -ArgumentList "-o, ${{ github.workspace }}/staging/mod-assets/DATA/, ${{ github.workspace }}/staging/mod-assets/XML/bmod_aux_energy_weapons.ale.xml"
The command this would work out to runs correctly when done in a local terminal, but hangs indefinitely in the workflow with the following (I cancelled the job after about 15 minutes:
Is there a dependency the project requires when running in CLI for the first time I should be mindful of here? I can’t really get any feedback as to why this is hanging in the workflow, so I’m not really sure how to proceed.
-
Quick update: Attempting to set the registry key required by the project results in similar behaviour:
-
IrateRedKite Administrators Historic Supporter Wiki Contributorreplied to adoxa on global:last_edited_by,
@adoxa I think this worked! (The workflow didn’t hang and the process concluded) Will set up outputs to be sure and then post here with results. Many thanks!
-
@adoxa It works! The xml2utf executable creates valid UTF files within the workflow. My build time for a few thousand XML files is about 5 minutes, which is perfect. I’ll post my full workflow in a few hours when I have it polished and running correctly.
An aside: will you be publishing this one on your site along with the source as well? Will adjust the link in my workflow to reflect that if so.
Update: The workflow can be found here, if anyone would like to adapt it to suit their own purposes: https://github.com/better-modernized-combat/bmod-client/blob/main/.github/workflows/release.yml
-
Could you download
frc.zip
directly, rather than going throughdlt
? Don’t want to count that in my download stats (not that I’ve looked at them for a couple of years…).The recurse code is still present, so I could make it available. (It’s partially implemented now, try "All " (that’s A-l-l-space) as the name, but I won’t keep that, it’s a remnant of the GUI.)
-
IrateRedKite Administrators Historic Supporter Wiki Contributorreplied to adoxa on global:last_edited_by,
@adoxa Thanks for this! I’ve updated my workflow accordingly and will do some testing a little later today. I may keep using the PowerShell foreach loop, simply as it allows me to filter by filename, but having the
-r
options is really nice.Looking into caching
frc.exe
andxml2utf.exe
as well, so that should further save your site bandwidth and download stats -
How can I put 227 wav file inside an UTF file?
More specifically I’m talking about trent_voice.utf, I’ve extracted and edited all the wav file but I can’t find a suitable operation to reinsert the wav file inside the UTF if not one by one by hand with UTFEditor -
IrateRedKite Administrators Historic Supporter Wiki Contributorreplied to maximilianps on global:last_edited_by,
@maximilianps Hiya, welcome to the Starport! Your best bet if you’re doing this sort of thing in bulk, is the Freelancer XML Project, which provides an easy-to-use GUI for conversion in both directions (XML -> UTF and back).
-
@adoxa This might be a bit of an ask, but is is possible to prevent frc and xml2utf from writing metadata into the files they generate? I was hoping to compare the sha256 hash of zipped releases as a measure to prevent accidental releases if the workflow is triggered, but each run of the two programs generates files with completely different hashes as I think in both instances metadata is written to the compiled files!
Edit: I am also caching both the applications now, so you should see way fewer hits on these from Github as the workflow runs.
-
In my (admittedly limited) test
frc
generated the same file. The test was simply compile a file, wait a bit (I thought it might be the timestamp in the PE header), compile again and compare; I also touched the source file, but that was still the same.You should generate the XML files with the Timestamps (-t) option, otherwise the current time is used when creating the UTF.
-
IrateRedKite Administrators Historic Supporter Wiki Contributorreplied to adoxa on global:last_edited_by,
@adoxa An update: It was indeed the timestamps! Thankyou for your help You’ll be pleased to know I am also caching and no longer using the
dlt
links.An aside: is the source for xml2utf available?
-
IrateRedKite Administrators Historic Supporter Wiki Contributorreplied to adoxa on global:last_edited_by,
@adoxa Thanks! I don’t suppose you have this set up running in the other direction too? (UTF -> XML) We’ve got a local script that converts things in the other direction for upload, but I’ve found for quite a few of the folks working on the mod, UTFXML simply won’t run properly when invoked via a script, and I think it’s a similar set of dependency issues.