Skip to content

Commit 37160dd

Browse files
committed
add update rountrip integration tests
1 parent 8ee1f2b commit 37160dd

4 files changed

Lines changed: 140 additions & 1 deletion

File tree

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: ModVerify Update Integration Test
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
jobs:
8+
update-cycle:
9+
name: Update cycle (${{ matrix.scenario.name }})
10+
runs-on: windows-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
scenario:
15+
- { name: single, script: ./test-local-update.ps1 }
16+
- { name: dual, script: ./test-local-update-dual.ps1 }
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
with:
21+
fetch-depth: 0
22+
submodules: recursive
23+
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v5
26+
with:
27+
dotnet-version: 10.0.x
28+
29+
- name: Run ${{ matrix.scenario.name }}-channel update cycle
30+
shell: pwsh
31+
run: ${{ matrix.scenario.script }}
32+
33+
- name: Upload diagnostics on failure
34+
if: failure()
35+
uses: actions/upload-artifact@v7
36+
with:
37+
name: update-cycle-${{ matrix.scenario.name }}-logs
38+
# Updater log: %TEMP%\extUpdateLog-*.txt; ModVerify app log: %APPDATA%\ModVerify\*.txt
39+
path: |
40+
${{ runner.temp }}\extUpdateLog-*.txt
41+
${{ env.APPDATA }}\ModVerify\*.txt
42+
if-no-files-found: ignore
43+
retention-days: 7

.github/workflows/release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,11 @@ jobs:
4040
test:
4141
uses: ./.github/workflows/test.yml
4242

43+
# End-to-end self-update test (single-channel + dual-channel via /v2/).
44+
integration-test:
45+
needs: [test]
46+
uses: ./.github/workflows/integration-test.yml
47+
4348
pack:
4449
name: Pack
4550
needs: [test]
@@ -76,7 +81,7 @@ jobs:
7681
(github.event_name == 'push' && github.ref == 'refs/heads/main') ||
7782
(github.event_name == 'workflow_dispatch' &&
7883
(github.event.inputs.branch != 'stable' || github.ref == 'refs/heads/main'))
79-
needs: [pack]
84+
needs: [pack, integration-test]
8085
runs-on: ubuntu-latest
8186
steps:
8287
- name: Checkout sources

test-local-update-dual.ps1

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# =========================================================================================
2+
# Local bootstrap for the dual-deploy self-update integration test.
3+
#
4+
# Stages a dual-channel local deploy (primary + /v2/) via deploy-local.ps1 -DualPublish,
5+
# then runs the shared end-to-end test against the next-generation `/v2/` server. Validates
6+
# that a full update cycle works after the post-migration server URL base change.
7+
#
8+
# Optionally accepts -CompatibilityUpdater to substitute an older external-updater binary
9+
# into the primary channel's manifest (the production migration-release shape).
10+
#
11+
# Independent of test-local-update.ps1.
12+
#
13+
# Windows-only.
14+
# =========================================================================================
15+
16+
#Requires -Version 7.0
17+
18+
[CmdletBinding()]
19+
param(
20+
[string]$InstalledVersion = '0.0.1-local',
21+
[string]$ServerVersion = '99.99.99-local',
22+
[string]$Branch = 'beta',
23+
[string]$CompatibilityUpdater
24+
)
25+
26+
$ErrorActionPreference = 'Stop'
27+
28+
$root = $PSScriptRoot
29+
if ([string]::IsNullOrEmpty($root)) { $root = Get-Location }
30+
31+
$deployArgs = @{
32+
InstalledVersion = $InstalledVersion
33+
ServerVersion = $ServerVersion
34+
DualPublish = $true
35+
}
36+
if ($CompatibilityUpdater) { $deployArgs.CompatibilityUpdater = $CompatibilityUpdater }
37+
38+
& (Join-Path $root 'deploy-local.ps1') @deployArgs
39+
if ($LASTEXITCODE -ne 0) { throw "deploy-local.ps1 -DualPublish failed (exit $LASTEXITCODE)." }
40+
41+
$nextServerDir = Join-Path $root '.local_deploy\server\v2'
42+
if (-not (Test-Path $nextServerDir)) {
43+
throw "Expected /v2/ server dir at '$nextServerDir' but it does not exist."
44+
}
45+
$nextServerUri = "file:///$(((Resolve-Path $nextServerDir).Path -replace '\\','/'))"
46+
47+
& (Join-Path $root 'modules\ModdingToolBase\scripts\Test-LocalUpdateCycle.ps1') `
48+
-AppExePath (Join-Path $root '.local_deploy\install\ModVerify.exe') `
49+
-ServerUri $nextServerUri `
50+
-Branch $Branch `
51+
-NoUpdateMessage 'No update available.' `
52+
-ExpectedNewVersion $ServerVersion
53+
54+
exit $LASTEXITCODE

test-local-update.ps1

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# =========================================================================================
2+
# Local bootstrap for the self-update integration test.
3+
#
4+
# Stages a local deploy via deploy-local.ps1, then runs the shared end-to-end test from
5+
# ModdingToolBase against the staged install dir + signed local server.
6+
#
7+
# Windows-only.
8+
# =========================================================================================
9+
10+
#Requires -Version 7.0
11+
12+
[CmdletBinding()]
13+
param(
14+
[string]$InstalledVersion = '0.0.1-local',
15+
[string]$ServerVersion = '99.99.99-local',
16+
[string]$Branch = 'beta'
17+
)
18+
19+
$ErrorActionPreference = 'Stop'
20+
21+
$root = $PSScriptRoot
22+
if ([string]::IsNullOrEmpty($root)) { $root = Get-Location }
23+
24+
& (Join-Path $root 'deploy-local.ps1') -InstalledVersion $InstalledVersion -ServerVersion $ServerVersion
25+
if ($LASTEXITCODE -ne 0) { throw "deploy-local.ps1 failed (exit $LASTEXITCODE)." }
26+
27+
$serverDir = Join-Path $root '.local_deploy\server'
28+
$serverUri = "file:///$(((Resolve-Path $serverDir).Path -replace '\\','/'))"
29+
30+
& (Join-Path $root 'modules\ModdingToolBase\scripts\Test-LocalUpdateCycle.ps1') `
31+
-AppExePath (Join-Path $root '.local_deploy\install\ModVerify.exe') `
32+
-ServerUri $serverUri `
33+
-Branch $Branch `
34+
-NoUpdateMessage 'No update available.' `
35+
-ExpectedNewVersion $ServerVersion
36+
37+
exit $LASTEXITCODE

0 commit comments

Comments
 (0)