diff --git a/.github/workflows/test-android.yml b/.github/workflows/test-android.yml index 77bde40b..2afd90db 100644 --- a/.github/workflows/test-android.yml +++ b/.github/workflows/test-android.yml @@ -52,6 +52,22 @@ jobs: example-archives: ${{ matrix.qt.example-archives }} example-modules: ${{ matrix.qt.example-modules }} + - name: Test QT_HOST_PATH + if: ${{ startsWith(matrix.qt.version, '6.') }} + shell: pwsh + run: | + $qmakeHostPrefix = [string](Resolve-Path -Path (qmake -query QT_HOST_PREFIX)) + if ($env:QT_HOST_PATH -ne $qmakeHostPrefix) { + throw "QT_HOST_PATH should match qmake's QT_HOST_PREFIX." + } + if ($env:QT_HOST_PATH -eq $env:QT_ROOT_DIR) { + throw "QT_HOST_PATH and QT_ROOT_DIR should be different." + } + if ((Split-Path -Path $env:QT_HOST_PATH -Parent) -ne (Split-Path -Path $env:QT_ROOT_DIR -Parent)) { + throw "QT_HOST_PATH and QT_ROOT_DIR should have the same parent directory." + } + Write-Host "All tests passed!" + - name: Install Android NDK shell: bash # Links to NDK are at https://github.com/android/ndk/wiki/Unsupported-Downloads diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8b28d07f..cc5f8707 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -146,17 +146,14 @@ jobs: ls "${QT_ROOT_DIR}/bin/" | grep qmake - name: Switch macOS Xcode version with older Qt versions - if: ${{ matrix.qt.version && (startsWith(matrix.os, 'macos-13') || startsWith(matrix.os, 'macos-14')) }} + if: ${{ matrix.qt.version && startsWith(matrix.os, 'macos-13') }} shell: pwsh env: QT_VERSION: ${{ matrix.qt.version }} run: | - if ([version]$env:QT_VERSION -ge [version]"6.5.3") { - # GitHub macOS 13/14 runners use Xcode 15.0.x by default which has a known linker issue causing crashes if the artifact is run on macOS <= 12 - sudo xcode-select --switch /Applications/Xcode_15.2.app - } else { - # Keep older Qt versions on Xcode 14 due to concern over QTBUG-117484 - sudo xcode-select --switch /Applications/Xcode_14.3.1.app + if ([version]$env:QT_VERSION -lt [version]'6.5.3') { + # Workaround for QTBUG-117225 + sudo xcode-select --switch /Applications/Xcode_14.3.1.app } - name: Configure test project on windows diff --git a/action/src/main.ts b/action/src/main.ts index 4aac05d2..df2eaa5c 100644 --- a/action/src/main.ts +++ b/action/src/main.ts @@ -71,7 +71,7 @@ const flaggedList = (flag: string, listArgs: readonly string[]): string[] => { return listArgs.length ? [flag, ...listArgs] : []; }; -const locateQtArchDir = (installDir: string): string => { +const locateQtArchDir = (installDir: string): [string, boolean] => { // For 6.4.2/gcc, qmake is at 'installDir/6.4.2/gcc_64/bin/qmake'. // This makes a list of all the viable arch directories that contain a qmake file. const qtArchDirs = glob @@ -84,16 +84,18 @@ const locateQtArchDir = (installDir: string): string => { const requiresParallelDesktop = qtArchDirs.filter((archPath) => { const archDir = path.basename(archPath); const versionDir = path.basename(path.join(archPath, "..")); - return versionDir.match(/^6\.\d+\.\d+$/) && archDir.match(/^(android*|ios|wasm*|msvc*_arm64)$/); + return ( + versionDir.match(/^6\.\d+\.\d+$/) && archDir.match(/^(android.*|ios|wasm.*|msvc.*_arm64)$/) + ); }); if (requiresParallelDesktop.length) { // NOTE: if multiple mobile/wasm installations coexist, this may not select the desired directory - return requiresParallelDesktop[0]; + return [requiresParallelDesktop[0], true]; } else if (!qtArchDirs.length) { throw Error(`Failed to locate a Qt installation directory in ${installDir}`); } else { // NOTE: if multiple Qt installations exist, this may not select the desired directory - return qtArchDirs[0]; + return [qtArchDirs[0], false]; } }; @@ -455,7 +457,7 @@ const run = async (): Promise => { } // Set environment variables/outputs for binaries if (inputs.isInstallQtBinaries) { - const qtPath = locateQtArchDir(inputs.dir); + const [qtPath, requiresParallelDesktop] = locateQtArchDir(inputs.dir); // Set outputs core.setOutput("qtPath", qtPath); @@ -474,6 +476,15 @@ const run = async (): Promise => { core.exportVariable("QT_ROOT_DIR", qtPath); core.exportVariable("QT_PLUGIN_PATH", path.resolve(qtPath, "plugins")); core.exportVariable("QML2_IMPORT_PATH", path.resolve(qtPath, "qml")); + if (requiresParallelDesktop) { + const hostPrefix = await fs.promises + .readFile(path.join(qtPath, "bin", "target_qt.conf"), "utf8") + .then((data) => data.match(/^HostPrefix=(.*)$/m)?.[1].trim() ?? "") + .catch(() => ""); + if (hostPrefix) { + core.exportVariable("QT_HOST_PATH", path.resolve(qtPath, "bin", hostPrefix)); + } + } core.addPath(path.resolve(qtPath, "bin")); } }