mirror of
https://github.com/ZoiteChat/zoitechat.git
synced 2026-03-19 12:10:19 +00:00
Update Windows ARM64 workflow for MSYS2
This commit is contained in:
committed by
GitHub
parent
3d86ae55e9
commit
bb820c1c25
97
.github/workflows/windows-arm64-msys2.yml
vendored
97
.github/workflows/windows-arm64-msys2.yml
vendored
@@ -2,10 +2,9 @@ name: Windows ARM64 Installer (MSYS2 + Inno Setup)
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [main, master]
|
branches: [master]
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [main, master]
|
branches: [master]
|
||||||
workflow_dispatch: {}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
windows_arm64_installer:
|
windows_arm64_installer:
|
||||||
@@ -44,9 +43,7 @@ jobs:
|
|||||||
export MSGFMT="/clangarm64/bin/msgfmt"
|
export MSGFMT="/clangarm64/bin/msgfmt"
|
||||||
export GETTEXTDATADIR="/clangarm64/share/gettext"
|
export GETTEXTDATADIR="/clangarm64/share/gettext"
|
||||||
|
|
||||||
pacman -S --noconfirm --needed mingw-w64-clang-aarch64-python mingw-w64-clang-aarch64-python-cffi
|
rm -rf build dist rel
|
||||||
|
|
||||||
rm -rf build dist
|
|
||||||
mkdir -p dist
|
mkdir -p dist
|
||||||
|
|
||||||
meson setup build \
|
meson setup build \
|
||||||
@@ -63,10 +60,6 @@ jobs:
|
|||||||
|
|
||||||
/clangarm64/bin/python.exe -c "import sys, cffi; print('python:', sys.version); print('cffi:', cffi.__version__)"
|
/clangarm64/bin/python.exe -c "import sys, cffi; print('python:', sys.version); print('cffi:', cffi.__version__)"
|
||||||
|
|
||||||
APPVER="$(meson introspect build --projectinfo | /clangarm64/bin/python.exe -c 'import json,sys; print(json.load(sys.stdin)[\"version\"])')"
|
|
||||||
echo "APPVER=$APPVER" >> "$GITHUB_ENV"
|
|
||||||
echo "Meson APPVER=$APPVER"
|
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
run: |
|
run: |
|
||||||
@@ -86,7 +79,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
export PATH="/clangarm64/bin:$PATH"
|
export PATH="/clangarm64/bin:$PATH"
|
||||||
|
|
||||||
DESTDIR="$PWD/dist" ninja -C build install
|
DESTDIR="$PWD/dist" ninja -C build install
|
||||||
|
|
||||||
echo "Installed files (debug):"
|
echo "Installed files (debug):"
|
||||||
@@ -100,7 +92,6 @@ jobs:
|
|||||||
shopt -s nullglob
|
shopt -s nullglob
|
||||||
|
|
||||||
mapfile -t targets < <(find dist -type f \( -iname 'zoitechat*.exe' -o -ipath '*/plugins/*.dll' \) 2>/dev/null || true)
|
mapfile -t targets < <(find dist -type f \( -iname 'zoitechat*.exe' -o -ipath '*/plugins/*.dll' \) 2>/dev/null || true)
|
||||||
|
|
||||||
if [ "${#targets[@]}" -eq 0 ]; then
|
if [ "${#targets[@]}" -eq 0 ]; then
|
||||||
echo "No installed binaries/plugins found under dist/ (skipping dep harvest)"
|
echo "No installed binaries/plugins found under dist/ (skipping dep harvest)"
|
||||||
exit 0
|
exit 0
|
||||||
@@ -131,32 +122,28 @@ jobs:
|
|||||||
)
|
)
|
||||||
done
|
done
|
||||||
|
|
||||||
- name: Prepare Inno Setup source tree (win32/rel)
|
- name: Prepare Inno Setup source tree (rel/)
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
run: |
|
run: |
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
export PATH="/clangarm64/bin:$PATH"
|
export PATH="/clangarm64/bin:$PATH"
|
||||||
|
|
||||||
rm -rf win32/rel
|
rm -rf rel
|
||||||
mkdir -p win32/rel
|
mkdir -p rel
|
||||||
|
|
||||||
app_exe="$(find dist -type f -iname 'zoitechat.exe' | head -n1 || true)"
|
app_exe="$(find dist -type f -iname 'zoitechat.exe' | head -n1 || true)"
|
||||||
if [ -z "$app_exe" ]; then
|
if [ -z "$app_exe" ]; then
|
||||||
echo "zoitechat.exe not found under dist/; cannot build installer."
|
echo "zoitechat.exe not found under dist/; cannot build installer."
|
||||||
find dist -maxdepth 8 -type f -print || true
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bin_dir="$(dirname "$app_exe")"
|
bin_dir="$(dirname "$app_exe")"
|
||||||
install_root="$(cd "$bin_dir/.." && pwd)"
|
install_root="$(cd "$bin_dir/.." && pwd)"
|
||||||
|
|
||||||
echo "app_exe: $app_exe"
|
cp -a "$install_root/." rel/
|
||||||
echo "install_root: $install_root"
|
|
||||||
|
|
||||||
cp -a "$install_root/." win32/rel/
|
echo "rel/ contents (debug):"
|
||||||
|
find rel -maxdepth 5 -type f \( -iname 'zoitechat*.exe' -o -iname '*.dll' \) -print || true
|
||||||
echo "win32/rel contents (debug):"
|
|
||||||
find win32/rel -maxdepth 5 -type f \( -iname 'zoitechat*.exe' -o -iname '*.dll' \) -print || true
|
|
||||||
|
|
||||||
- name: Install Inno Setup (find real ISCC.exe)
|
- name: Install Inno Setup (find real ISCC.exe)
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
@@ -170,20 +157,20 @@ jobs:
|
|||||||
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Force reinstall so we get real binaries in expected locations on these odd runners
|
||||||
choco install innosetup -y --force --no-progress | Out-Host
|
choco install innosetup -y --force --no-progress | Out-Host
|
||||||
|
|
||||||
$candidates = @()
|
$candidates = @()
|
||||||
|
|
||||||
$pf = ${env:ProgramFiles}
|
$pf = ${env:ProgramFiles}
|
||||||
$pfx86 = ${env:ProgramFiles(x86)}
|
$pfx86 = ${env:ProgramFiles(x86)}
|
||||||
if ($pf) { $candidates += (Join-Path $pf "Inno Setup 6\ISCC.exe") }
|
if ($pf) { $candidates += (Join-Path $pf "Inno Setup 6\ISCC.exe") }
|
||||||
if ($pfx86) { $candidates += (Join-Path $pfx86 "Inno Setup 6\ISCC.exe") }
|
if ($pfx86) { $candidates += (Join-Path $pfx86 "Inno Setup 6\ISCC.exe") }
|
||||||
|
|
||||||
$chocoRoot = ${env:ChocolateyInstall}
|
$chocoRoot = ${env:ChocolateyInstall}
|
||||||
if ($chocoRoot -and (Test-Path $chocoRoot)) {
|
if ($chocoRoot -and (Test-Path $chocoRoot)) {
|
||||||
$candidates += (Join-Path $chocoRoot "lib\innosetup\tools\ISCC.exe")
|
$candidates += (Join-Path $chocoRoot "lib\innosetup\tools\ISCC.exe")
|
||||||
$candidates += (Get-ChildItem -Path (Join-Path $chocoRoot "lib\innosetup") -Recurse -Filter "ISCC.exe" -ErrorAction SilentlyContinue |
|
$candidates += (Get-ChildItem -Path (Join-Path $chocoRoot "lib\innosetup") -Recurse -Filter "ISCC.exe" -ErrorAction SilentlyContinue |
|
||||||
Where-Object { $_.FullName -notmatch '\\chocolatey\\bin\\' } |
|
|
||||||
Select-Object -ExpandProperty FullName -First 10)
|
Select-Object -ExpandProperty FullName -First 10)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -210,26 +197,23 @@ jobs:
|
|||||||
|
|
||||||
"ISCC_PATH=$iscc" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
"ISCC_PATH=$iscc" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
||||||
|
|
||||||
- name: Patch ARM64 .iss for CI (disable missing idp.iss)
|
- name: Provide idp.iss stub for CI (unblocks preprocessing)
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
$ErrorActionPreference = "Stop"
|
$ErrorActionPreference = "Stop"
|
||||||
|
$dir = "win32\installer"
|
||||||
|
if (-not (Test-Path $dir)) { throw "Missing installer dir: $dir" }
|
||||||
|
|
||||||
$issIn = "win32\installer\zoitechat-arm64.iss"
|
$stubPath = Join-Path $dir "idp.iss"
|
||||||
if (-not (Test-Path $issIn)) {
|
|
||||||
throw "Missing: $issIn"
|
|
||||||
}
|
|
||||||
|
|
||||||
$projectDir = (Resolve-Path "win32\installer").Path
|
# Only create in CI; don't overwrite if you later commit the real plugin file.
|
||||||
$projectDirArg = ($projectDir.TrimEnd('\') + "\\")
|
if (-not (Test-Path $stubPath)) {
|
||||||
"PROJECTDIR=$projectDirArg" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
@"
|
||||||
|
; idp.iss CI stub (no-op).
|
||||||
|
; This exists only so '#include <idp.iss>' in the .iss can be resolved on GitHub runners.
|
||||||
|
; If you ship the real Inno Download Plugin, replace/remove this file.
|
||||||
|
|
||||||
$text = Get-Content $issIn -Raw
|
[Code]
|
||||||
$text = [regex]::Replace($text, '^\s*#include\s+<idp\.iss>\s*$', '; CI: idp.iss disabled for ARM64 builds', 'Multiline')
|
|
||||||
|
|
||||||
if ($text -notmatch '; CI: IDP STUBS') {
|
|
||||||
$stub = @"
|
|
||||||
; CI: IDP STUBS (no-op on ARM64 CI)
|
|
||||||
procedure idpDownloadAfter(PageID: Integer);
|
procedure idpDownloadAfter(PageID: Integer);
|
||||||
begin
|
begin
|
||||||
end;
|
end;
|
||||||
@@ -258,15 +242,13 @@ function idpDownloadFiles: Boolean;
|
|||||||
begin
|
begin
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
"@ | Set-Content -Path $stubPath -Encoding ASCII
|
||||||
|
|
||||||
"@
|
Write-Host "Wrote CI stub:" $stubPath
|
||||||
$text = [regex]::Replace($text, '(\[Code\]\s*\r?\n)', "`$1$stub", 'Singleline')
|
} else {
|
||||||
|
Write-Host "idp.iss already exists; leaving it alone."
|
||||||
}
|
}
|
||||||
|
|
||||||
$issOut = "win32\installer\zoitechat-arm64.ci.iss"
|
|
||||||
Set-Content -Path $issOut -Value $text -Encoding UTF8
|
|
||||||
Write-Host "Wrote patched CI script: $issOut"
|
|
||||||
|
|
||||||
- name: Build ARM64 installer
|
- name: Build ARM64 installer
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
run: |
|
run: |
|
||||||
@@ -277,34 +259,17 @@ end;
|
|||||||
throw "ISCC_PATH missing or invalid."
|
throw "ISCC_PATH missing or invalid."
|
||||||
}
|
}
|
||||||
|
|
||||||
$iss = "win32\installer\zoitechat-arm64.ci.iss"
|
if (-not (Test-Path "win32\installer\zoitechat-arm64.iss")) {
|
||||||
if (-not (Test-Path $iss)) {
|
throw "win32\installer\zoitechat-arm64.iss not found."
|
||||||
throw "Patched CI script missing: $iss"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (-not $env:APPVER) { throw "APPVER missing (Meson version export failed)." }
|
# Ensure '<idp.iss>' resolves from win32\installer
|
||||||
if (-not $env:PROJECTDIR) { throw "PROJECTDIR missing." }
|
& $iscc "/Iwin32\installer" "win32\installer\zoitechat-arm64.iss" | Out-Host
|
||||||
|
|
||||||
& $iscc "/DAPPARCH=arm64" "/DAPPVER=$env:APPVER" "/DPROJECTDIR=$env:PROJECTDIR" $iss | Out-Host
|
|
||||||
if ($LASTEXITCODE -ne 0) {
|
if ($LASTEXITCODE -ne 0) {
|
||||||
throw "ISCC failed with exit code $LASTEXITCODE"
|
throw "ISCC failed with exit code $LASTEXITCODE"
|
||||||
}
|
}
|
||||||
|
|
||||||
$exe = Get-ChildItem -Path "win32" -Recurse -Filter "*.exe" |
|
|
||||||
Where-Object { $_.Name -match 'Setup' -or $_.Name -match 'Installer' } |
|
|
||||||
Sort-Object LastWriteTime -Descending |
|
|
||||||
Select-Object -First 1
|
|
||||||
|
|
||||||
if (-not $exe) {
|
|
||||||
Write-Host "win32 tree (debug):"
|
|
||||||
Get-ChildItem -Path "win32" -Recurse -Depth 4 | Select-Object FullName | Out-Host
|
|
||||||
throw "Installer exe not found under win32/"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Installer built:" $exe.FullName
|
|
||||||
"INSTALLER_EXE=$($exe.FullName)" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
|
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: zoitechat-windows-arm64-installer
|
name: zoitechat-windows-arm64-installer
|
||||||
path: ${{ env.INSTALLER_EXE }}
|
path: win32\installer\Output\*.exe
|
||||||
|
|||||||
Reference in New Issue
Block a user