Don't log Imperator's standard output (#2051) #261
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
name: "Integration tests" | |
on: | |
push: # TODO: remove this when integration tests cleanup works correctly | |
branches: | |
- master | |
release: | |
types: [published] | |
concurrency: | |
group: ci-integration-${{ github.ref }}-1 | |
cancel-in-progress: true | |
jobs: | |
run_test_conversions: | |
runs-on: [self-hosted, windows] | |
strategy: | |
fail-fast: false | |
matrix: | |
save_url: | |
# 2.0 vanilla | |
- https://mega.nz/file/HEF2HDgD#lM6J00wp1NGbcdsS5d330UAzztoci2xKLltSfNjxXXk # 453.12.28 - Dumnoniens.rome | |
# 2.0 with mods | |
- https://mega.nz/file/jYdn3SQT#-vILaPKF30pFEiPUbuOm0KryNFrR2CpZBkNpWcoCrkI # 1229.9.5 - Nabhaka.rome | |
- https://mega.nz/file/bd0EAZCL#ZTDCCDpyBrlByX2rOCn0z4FtvHRDQ0H-7i6b7netSnY # 450.10.1 - Rome.rome | |
- https://mega.nz/file/aIlRRQgI#CaVRD2wIKuN2jwGvsXUAR4hVblUobICZzys-rHyBloc # 753.12.31 - The Kingdom of Fezzan.rome | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: recursive | |
- name: "Check if docs folders exist" | |
run: | | |
ls "C:\Users\Administrator\Documents\Paradox Interactive\Imperator" | |
ls "C:\Users\Administrator\Documents\Paradox Interactive\Imperator\mod" | |
ls "C:\Users\Administrator\Documents\Paradox Interactive\Crusader Kings III\mod" | |
- name: "Setup Dotnet for use with actions" | |
uses: actions/setup-dotnet@v4 | |
with: | |
global-json-file: global.json | |
- name: "Build converter backend" | |
working-directory: ImperatorToCK3 | |
run: | | |
dotnet build -c:Release | |
- name: "Download I:R save from MEGA" | |
run: | | |
& "C:/Program Files/megatools/megatools.exe" dl --path "save.rome" ${{ matrix.save_url }} | |
- name: "Create configuration.txt" | |
working-directory: Release/ImperatorToCK3 | |
run: | | |
echo 'ImperatorDirectory = "C:\Program Files (x86)\Steam\steamapps\common\ImperatorRome"' > configuration.txt | |
echo 'ImperatorDocDirectory = "C:\Users\Administrator\Documents\Paradox Interactive\Imperator"' >> configuration.txt | |
echo 'CK3directory = "C:\Program Files (x86)\Steam\steamapps\common\Crusader Kings III"' >> configuration.txt | |
echo 'targetGameModPath = "C:\Users\Administrator\Documents\Paradox Interactive\Crusader Kings III\mod"' >> configuration.txt | |
echo 'SaveGame = "../../save.rome"' >> configuration.txt | |
cat configuration.txt | |
- name: "Run conversion" | |
working-directory: Release/ImperatorToCK3 | |
run: | | |
dotnet ImperatorToCK3Converter.dll | |
- name: "Check file handles" | |
# check what processes have handles to the files in the Github workspace dir | |
run: | | |
Get-ChildItem -Path C:\actions-runner\_work\ImperatorToCK3\ImperatorToCK3\Release\ImperatorToCK3 -Recurse -Force | ForEach-Object { | |
Write-Host "" | |
Write-Host "Checking handles for $($_.FullName)" | |
c:\sysinternals\handle.exe -a -nobanner -accepteula $_.FullName | |
} | |
- name: "Cleanup" | |
if: always() | |
run: | | |
function Remove-ItemWithRetry { | |
param ( | |
[string]$Path, | |
[int]$Retries = 5, | |
[int]$Delay = 2000 | |
) | |
for ($i = 0; $i -lt $Retries; $i++) { | |
try { | |
Remove-Item -Path $Path -Force -Recurse | |
Write-Host "Successfully deleted $Path" | |
return | |
} catch { | |
Write-Host "Attempt $($i+1) failed: $_" | |
Start-Sleep -Milliseconds $Delay | |
} | |
} | |
throw "Failed to delete $Path after $Retries attempts" | |
} | |
Get-ChildItem -Path $Env:GITHUB_WORKSPACE -Recurse -Force | ForEach-Object { | |
Remove-ItemWithRetry -Path $_.FullName | |
} | |