Skip to content

Commit

Permalink
CI: Script cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
jdpurcell committed Dec 15, 2024
1 parent 40108f0 commit d5f4708
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 42 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ jobs:
uses: actions/checkout@v4

- name: Install Qt
uses: jurplel/install-qt-action@v4
uses: jdpurcell/install-qt-action@v4
with:
version: ${{ matrix.qtVersion }}
arch: ${{ matrix.qtArch }}
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
bash dist/scripts/linuxdeployqt.sh ${{ env.buildNumString }}
}
- name: 'Upload Artifact'
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: qView-JDP${{ env.buildNumString != '' && '-' || '' }}${{ env.buildNumString }}-${{ runner.os }}${{ matrix.osSuffix }}
Expand Down
4 changes: 2 additions & 2 deletions dist/scripts/build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ param (
$Prefix = "/usr"
)

$qtVersion = [version]((qmake --version -split '\n')[1] -split ' ')[3]
Write-Host "Detected Qt Version $qtVersion"
$qtVersion = [version](qmake -query QT_VERSION)
Write-Host "Detected Qt version $qtVersion"

if ($IsWindows) {
dist/scripts/vcvars.ps1
Expand Down
6 changes: 3 additions & 3 deletions dist/scripts/download-plugins.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# This script will download binary plugins from the kimageformats-binaries repository using Github's API.

$qtVersion = [version]((qmake --version -split '\n')[1] -split ' ')[3]
Write-Host "Detected Qt Version $qtVersion"
$qtVersion = [version](qmake -query QT_VERSION)
Write-Host "Detected Qt version $qtVersion"

$osName =
$IsWindows ? 'Windows' :
Expand Down Expand Up @@ -67,7 +67,7 @@ if ($pluginNames -contains 'KImageFormats') {
$kfMajorVer = $qtVersion -ge [version]'6.5.0' ? 6 : 5
if ($IsWindows) {
mv KImageFormats/KImageFormats/output/kimg_*.dll "$out_imf/"
CopyFrameworkDlls "KF$($kfMajorVer)Archive.dll" @("zlib1.dll")
CopyFrameworkDlls "KF${kfMajorVer}Archive.dll" @("zlib1.dll")
CopyFrameworkDlls "avif.dll" @("dav1d.dll", "jpeg62.dll", "libyuv.dll")
CopyFrameworkDlls "heif.dll" @("libde265.dll")
CopyFrameworkDlls "raw.dll" @("lcms2.dll", "zlib1.dll")
Expand Down
2 changes: 1 addition & 1 deletion dist/scripts/innomake.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ if (-not $suffix) {
New-Item -Path "dist\win\qView-Win$suffix" -ItemType Directory -ea 0
copy -R bin\* "dist\win\qView-Win$suffix"
iscc dist\win\qView$suffix.iss
copy dist\win\Output\* bin\
copy dist\win\Output\* bin\
12 changes: 5 additions & 7 deletions dist/scripts/macdeploy.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
#!/usr/bin/bash

if [[ -n "$1" ]]; then
VERSION=$0
else
VERSION=$(LC_ALL=C sed -n -e '/^VERSION/p' qView.pro)
VERSION=${VERSION: -3}
if [[ -z "$1" ]]; then
RELEASE_VER=$(LC_ALL=C sed -n -e '/^VERSION/p' qView.pro)
RELEASE_VER=${RELEASE_VER: -3}
fi

if [[ -n "$APPLE_DEVID_APP_CERT_DATA" ]]; then
Expand Down Expand Up @@ -61,9 +59,9 @@ if [[ -n "$1" ]]; then
hdiutil convert "qView.sparsebundle" -format ULFO -o "$DMG_FILENAME"
rm -r qView.sparsebundle
else
DMG_FILENAME=qView-JDP-$VERSION.dmg
DMG_FILENAME=qView-JDP-$RELEASE_VER.dmg
brew install create-dmg
create-dmg --volname "qView-JDP $VERSION" --filesystem APFS --format ULFO --window-size 660 400 --icon-size 160 --icon "qView.app" 180 170 --hide-extension qView.app --app-drop-link 480 170 "$DMG_FILENAME" "qView.app"
create-dmg --volname "qView-JDP $RELEASE_VER" --filesystem APFS --format ULFO --window-size 660 400 --icon-size 160 --icon "qView.app" 180 170 --hide-extension qView.app --app-drop-link 480 170 "$DMG_FILENAME" "qView.app"
fi
if [[ "$APPLE_NOTARIZE_REQUESTED" == "true" ]]; then
codesign --sign "$CODESIGN_CERT_NAME" --timestamp --identifier "$APP_IDENTIFIER.dmg" "$DMG_FILENAME"
Expand Down
17 changes: 7 additions & 10 deletions dist/scripts/vcvars.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,19 @@ if ([RuntimeInformation]::OSArchitecture -ne [Architecture]::X64) {
throw 'Unsupported host architecture.'
}

$arch =
$argArch =
$env:buildArch -eq 'X64' ? 'x64' :
$env:buildArch -eq 'X86' ? 'x64_x86' :
$env:buildArch -eq 'Arm64' ? 'x64_arm64' :
$null
if (-not $arch) {
if (-not $argArch) {
throw 'Unsupported build architecture.'
}

$path = Resolve-Path "${env:ProgramFiles}\Microsoft Visual Studio\*\*\VC\Auxiliary\Build" | Select-Object -ExpandProperty Path

cmd.exe /c "call `"$path\vcvarsall.bat`" $arch && set > %temp%\vcvars.txt"

$vsDir = vswhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
$exclusions = @('VCPKG_ROOT')
Get-Content "$env:temp\vcvars.txt" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$" -and $matches[1] -notin $exclusions) {
[Environment]::SetEnvironmentVariable($matches[1], $matches[2])
cmd /c "`"$(Join-Path $vsDir 'VC\Auxiliary\Build\vcvarsall.bat')`" $argArch > null && set" | ForEach-Object {
$name, $value = $_ -Split '=', 2
if ($name -notin $exclusions) {
[Environment]::SetEnvironmentVariable($name, $value)
}
}
28 changes: 11 additions & 17 deletions dist/scripts/windeployqt.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,8 @@ param (
$NightlyVersion = ""
)

$qtVersion = [version]((qmake --version -split '\n')[1] -split ' ')[3]
Write-Host "Detected Qt Version $qtVersion"

if ($env:buildArch -eq 'Arm64') {
$env:QT_HOST_PATH = [System.IO.Path]::GetFullPath("$env:QT_ROOT_DIR\..\$((Split-Path -Path $env:QT_ROOT_DIR -Leaf) -replace '_arm64', '_64')")
}
$qtVersion = [version](qmake -query QT_VERSION)
Write-Host "Detected Qt version $qtVersion"

# Ship OpenSSL for older Qt versions. Starting 6.8, windeployqt doesn't deploy the OpenSSL backend
# by default; although it's easy to opt in, the Schannel backend seems solid enough at this point.
Expand All @@ -29,21 +25,19 @@ if ($qtVersion -lt [version]'6.8' -and $env:buildArch -ne 'Arm64') {

# Copy to output dir
if ($env:buildArch -eq 'X86') {
copy "openssl\$($openSslSubfolder)x86\bin\libssl-$openSslFilenameVersion.dll" bin
copy "openssl\$($openSslSubfolder)x86\bin\libcrypto-$openSslFilenameVersion.dll" bin
copy "openssl\${openSslSubfolder}x86\bin\libssl-$openSslFilenameVersion.dll" bin
copy "openssl\${openSslSubfolder}x86\bin\libcrypto-$openSslFilenameVersion.dll" bin
} else {
copy "openssl\$($openSslSubfolder)x64\bin\libssl-$openSslFilenameVersion-x64.dll" bin
copy "openssl\$($openSslSubfolder)x64\bin\libcrypto-$openSslFilenameVersion-x64.dll" bin
copy "openssl\${openSslSubfolder}x64\bin\libssl-$openSslFilenameVersion-x64.dll" bin
copy "openssl\${openSslSubfolder}x64\bin\libcrypto-$openSslFilenameVersion-x64.dll" bin
}
}

if ($env:buildArch -eq 'Arm64') {
# Run windeployqt in cross-compilation mode
& "$env:QT_HOST_PATH\bin\windeployqt" "--qmake=$env:QT_ROOT_DIR\bin\qmake.bat" --no-compiler-runtime bin\qView.exe
} else {
# Run windeployqt which should be in path
windeployqt --no-compiler-runtime bin\qView.exe
}
# Run windeployqt
$isCrossCompile = $env:buildArch -eq 'Arm64'
$winDeployQt = $isCrossCompile ? "$env:QT_HOST_PATH\bin\windeployqt" : "windeployqt"
$argQtPaths = $isCrossCompile ? "--qtpaths=$env:QT_ROOT_DIR\bin\qtpaths.bat" : $null
& $winDeployQt $argQtPaths --no-compiler-runtime "bin\qView.exe"

if ($qtVersion -ge [version]'6.8.1') {
# Copy font so windows11 style can work on Windows 10
Expand Down

0 comments on commit d5f4708

Please sign in to comment.