Skip to content

Commit

Permalink
Merge branch 'master' into v4
Browse files Browse the repository at this point in the history
  • Loading branch information
jurplel committed Nov 7, 2024
2 parents f03f055 + 5d50465 commit 023187d
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 42 deletions.
51 changes: 35 additions & 16 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ jobs:
uses: ./
with:
tools-only: true
tools: tools_ifw tools_qtcreator,qt.tools.qtcreator
tools: tools_ifw tools_qtcreator,qt.tools.qtcreator tools_cmake tools_ninja tools_conan
add-tools-to-path: ${{ matrix.qt.add-tools-to-path }}
cache: ${{ matrix.cache == 'cached' }}

Expand All @@ -220,26 +220,45 @@ jobs:
shell: bash
run: |
echo "Path: ${PATH}"
# Check if QtIFW is installed
which archivegen
archivegen --version
# Check if QtCreator is installed: QtCreator includes the CLI program 'qbs' on all 3 platforms
which qbs
qbs --version
set -x
# tools_ifw: use `archivegen` to test that Tools/QtInstallerFramework/4.7/bin is added to path
# tools_qtcreator: use `qbs` to test that Tools/QtCreator/bin or "Qt Creator.app/Contents/MacOS/" is added to path
# tools_cmake: test that Tools/CMake/bin or Tools/CMake/CMake.app/Contents/bin is added to path
# tools_ninja: test that Tools/Ninja is added to path
# tools_conan: test that Tools/Conan is added to path
for tool_name in archivegen qbs cmake ninja conan; do
which "${tool_name}"
"${tool_name}" --version
done
- name: Test that installed tools are not in the path
if: ${{ matrix.qt.tools-only-build && !matrix.qt.add-tools-to-path }}
shell: bash
run: |
echo "Path: ${PATH}"
set -x
# Check that QtIFW has been installed
ls ../Qt/Tools/QtInstallerFramework/*/bin/ | grep archivegen
# Check that QtIFW is not in the path
! which archivegen
! archivegen --version
# Check that qbs (from QtCreator) is not in the path
! which qbs
! qbs --version
# Check that QtCreator has been installed
[[ -e "../Qt/Tools/QtCreator/bin/qbs" || -e "../Qt/Qt Creator.app/Contents/MacOS/qbs" ]]
# Check that CMake has been installed
[[ -e "../Qt/Tools/CMake/bin/cmake" || -e "../Qt/Tools/CMake/CMake.app/Contents/bin/cmake" ]]
# Check that Ninja has been installed
[[ -e "../Qt/Tools/Ninja/ninja" ]]
# Check that Conan has been installed
[[ -e "../Qt/Tools/Conan/conan" ]]
# tools_ifw: use `archivegen` to test that Tools/QtInstallerFramework/4.7/bin is not added to path
# tools_qtcreator: use `qbs` to test that Tools/QtCreator/bin or "Qt Creator.app/Contents/MacOS/" is not added to path
# tools_cmake: test that Tools/CMake/bin or Tools/CMake/CMake.app/Contents/bin is not added to path
# tools_ninja: test that Tools/Ninja is not added to path
# tools_conan: test that Tools/Conan is not added to path
for tool_name in archivegen qbs cmake ninja conan; do
! which "${tool_name}"
! "${tool_name}" --version
done
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ Windows w/ Qt >= 5.6 && Qt < 5.9: `win64_msvc2015_64`

Windows w/ Qt >= 5.9 && Qt < 5.15: `win64_msvc2017_64`

Windows w/ Qt >= 5.15: `win64_msvc2019_64`
Windows w/ Qt >= 5.15 && Qt < 6.8: `win64_msvc2019_64`

Windows w/ Qt >= 6.8: `win64_msvc2022_64`

Android: `android_armv7`

Expand Down Expand Up @@ -260,7 +262,7 @@ Example value: `--external 7z`

```yml
- name: Install Qt
uses: jurplel/install-qt-action@v3
uses: jurplel/install-qt-action@v4
with:
version: '5.15.2'
host: 'windows'
Expand Down
28 changes: 14 additions & 14 deletions action/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

40 changes: 30 additions & 10 deletions action/src/main.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import * as crypto from "crypto";
import * as fs from "fs";
import * as os from "os";
import * as path from "path";
import * as process from "process";
Expand All @@ -25,10 +26,32 @@ const setOrAppendEnvVar = (name: string, value: string): void => {
core.exportVariable(name, newValue);
};

const toolsPaths = (installDir: string): string[] =>
["Tools/**/bin", "*.app/Contents/MacOS", "*.app/**/bin"].flatMap((p: string): string[] =>
glob.sync(`${installDir}/${p}`)
);
const dirExists = (dir: string): boolean => {
try {
return fs.statSync(dir).isDirectory();
} catch (err) {
return false;
}
};

// Names of directories for tools (tools_conan & tools_ninja) that include binaries in the
// base directory instead of a bin directory (ie 'Tools/Conan', not 'Tools/Conan/bin')
const binlessToolDirectories = ["Conan", "Ninja"];

const toolsPaths = (installDir: string): string[] => {
const binlessPaths: string[] = binlessToolDirectories
.map((dir) => `${installDir}/Tools/${dir}`)
.filter((dir) => dirExists(dir));
return [
"Tools/**/bin",
"*.app/Contents/MacOS",
"*.app/**/bin",
"Tools/*/*.app/Contents/MacOS",
"Tools/*/*.app/**/bin",
]
.flatMap((p: string): string[] => glob.sync(`${installDir}/${p}`))
.concat(binlessPaths);
};

const pythonCommand = (command: string, args: readonly string[]): string => {
const python = process.platform === "win32" ? "python" : "python3";
Expand Down Expand Up @@ -163,7 +186,9 @@ class Inputs {
this.arch = "android_armv7";
}
} else if (this.host === "windows") {
if (compareVersions(this.version, ">=", "5.15.0")) {
if (compareVersions(this.version, ">=", "6.7.3")) {
this.arch = "win64_msvc2022_64";
} else if (compareVersions(this.version, ">=", "5.15.0")) {
this.arch = "win64_msvc2019_64";
} else if (compareVersions(this.version, "<", "5.6.0")) {
this.arch = "win64_msvc2013_64";
Expand Down Expand Up @@ -344,11 +369,6 @@ const run = async (): Promise<void> => {

// Install Qt and tools if not cached
if (!internalCacheHit) {
// 7-zip is required, and not included on macOS
if (process.platform === "darwin") {
await exec("brew install p7zip");
}

// Install dependencies via pip
await execPython("pip install", ["setuptools", "wheel", `"py7zr${inputs.py7zrVersion}"`]);

Expand Down

0 comments on commit 023187d

Please sign in to comment.