Skip to content

Use working-directory for "Download I:R save from MEGA" wf step #311

Use working-directory for "Download I:R save from MEGA" wf step

Use working-directory for "Download I:R save from MEGA" wf step #311

name: "Integration tests"
on:
push:
branches:
- '**' # This will trigger the workflow on push to any branch
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/SZti3DTD#lM6J00wp1NGbcdsS5d330UAzztoci2xKLltSfNjxXXk # 453.12.28 - Dumnoniens.rome
# 2.0 with mods
- https://mega.nz/file/zRUxTaiD#8Iqu53tcFIgzNmO5ySALlDW-fXbiAPUVssCCMlwUFq4 # 848.7.14 - Indian Empire - 2.rome, uploaded 2024-06-30
- https://mega.nz/file/TY8hTSLZ#1Qt-yEoe9Pi6cAa3Em8UOiXdjQi8nJFxRgQfoGlOnMg # Grande Campagne.rome, uploaded 2024-09-11
- https://mega.nz/file/HBMgWDbY#KQPtifb1BU2zZGeFVO0sgGwbYFt2ap1YcZ2Lques4_A # Roman Empire Convert Save 2.rome, uploaded 2024-09-23
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"
working-directory: C:/Users/Administrator/AppData/Local/MEGAcmd
run: | # save the downloaded save.rome file to the action's default folder
& "./mega-get.bat" ${{ matrix.save_url }} ${{ github.workspace }}/save.rome
- 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
echo 'SkipDynamicCoAExtraction = 1' >> configuration.txt
cat configuration.txt
- name: "Run conversion"
working-directory: Release/ImperatorToCK3
run: |
dotnet ImperatorToCK3Converter.dll
- 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
}