fix(updater): build atrifact fix on linux ci + add qt-ver to artifact name
Signed-off-by: Rachel Powers <508861+Ryex@users.noreply.github.com>
This commit is contained in:
parent
6476023cf7
commit
cd527c44a4
6
.github/workflows/build.yml
vendored
6
.github/workflows/build.yml
vendored
@ -283,12 +283,12 @@ jobs:
|
|||||||
if: runner.os == 'Windows' && matrix.msystem != ''
|
if: runner.os == 'Windows' && matrix.msystem != ''
|
||||||
shell: msys2 {0}
|
shell: msys2 {0}
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=6 -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -DLauncher_BUILD_ARTIFACT=${{ matrix.name }} -G Ninja
|
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=6 -DCMAKE_OBJDUMP=/mingw64/bin/objdump.exe -DLauncher_BUILD_ARTIFACT=${{ matrix.name }}-Qt${{ matrix.qt_ver }} -G Ninja
|
||||||
|
|
||||||
- name: Configure CMake (Windows MSVC)
|
- name: Configure CMake (Windows MSVC)
|
||||||
if: runner.os == 'Windows' && matrix.msystem == ''
|
if: runner.os == 'Windows' && matrix.msystem == ''
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" -A${{ matrix.architecture}} -DLauncher_FORCE_BUNDLED_LIBS=ON -DLauncher_BUILD_ARTIFACT=${{ matrix.name }}
|
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=${{ matrix.name }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" -A${{ matrix.architecture}} -DLauncher_FORCE_BUNDLED_LIBS=ON -DLauncher_BUILD_ARTIFACT=${{ matrix.name }}-Qt${{ matrix.qt_ver }}
|
||||||
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio (I coudn't figure out the compiler prefix)
|
# https://github.com/ccache/ccache/wiki/MS-Visual-Studio (I coudn't figure out the compiler prefix)
|
||||||
if ("${{ env.CCACHE_VAR }}")
|
if ("${{ env.CCACHE_VAR }}")
|
||||||
{
|
{
|
||||||
@ -303,7 +303,7 @@ jobs:
|
|||||||
- name: Configure CMake (Linux)
|
- name: Configure CMake (Linux)
|
||||||
if: runner.os == 'Linux'
|
if: runner.os == 'Linux'
|
||||||
run: |
|
run: |
|
||||||
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=Linux -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=${{ matrix.name }} -G Ninja
|
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DENABLE_LTO=ON -DLauncher_BUILD_PLATFORM=Linux -DCMAKE_C_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DCMAKE_CXX_COMPILER_LAUNCHER=${{ env.CCACHE_VAR }} -DLauncher_QT_VERSION_MAJOR=${{ matrix.qt_ver }} -DLauncher_BUILD_ARTIFACT=Linux-Qt${{ matrix.qt_ver }} -G Ninja
|
||||||
|
|
||||||
##
|
##
|
||||||
# BUILD
|
# BUILD
|
||||||
|
@ -184,27 +184,31 @@ QString StringUtils::getRandomAlphaNumeric()
|
|||||||
return QUuid::createUuid().toString(QUuid::Id128);
|
return QUuid::createUuid().toString(QUuid::Id128);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QString, QString> StringUtils::splitFirst(const QString& s, const QString& sep, Qt::CaseSensitivity cs) {
|
QPair<QString, QString> StringUtils::splitFirst(const QString& s, const QString& sep, Qt::CaseSensitivity cs)
|
||||||
|
{
|
||||||
QString left, right;
|
QString left, right;
|
||||||
auto index = s.indexOf(sep, 0, cs);
|
auto index = s.indexOf(sep, 0, cs);
|
||||||
left = s.mid(0, index);
|
left = s.mid(0, index);
|
||||||
right = s.mid(index + 1);
|
right = s.mid(index + sep.length());
|
||||||
return qMakePair(left, right);
|
return qMakePair(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QString, QString> StringUtils::splitFirst(const QString& s, QChar sep, Qt::CaseSensitivity cs) {
|
QPair<QString, QString> StringUtils::splitFirst(const QString& s, QChar sep, Qt::CaseSensitivity cs)
|
||||||
|
{
|
||||||
QString left, right;
|
QString left, right;
|
||||||
auto index = s.indexOf(sep, 0, cs);
|
auto index = s.indexOf(sep, 0, cs);
|
||||||
left = s.mid(0, index);
|
left = s.mid(0, index);
|
||||||
right = s.mid(index + 1);
|
right = s.mid(left.length() + 1);
|
||||||
return qMakePair(left, right);
|
return qMakePair(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPair<QString, QString> StringUtils::splitFirst(const QString& s, const QRegularExpression& re) {
|
QPair<QString, QString> StringUtils::splitFirst(const QString& s, const QRegularExpression& re)
|
||||||
|
{
|
||||||
QString left, right;
|
QString left, right;
|
||||||
auto index = s.indexOf(re);
|
QRegularExpressionMatch match;
|
||||||
|
auto index = s.indexOf(re, 0, &match);
|
||||||
left = s.mid(0, index);
|
left = s.mid(0, index);
|
||||||
right = s.mid(index + 1);
|
auto end = match.hasMatch() ? left.length() + match.capturedLength() : left.length() + 1;
|
||||||
|
right = s.mid(end);
|
||||||
return qMakePair(left, right);
|
return qMakePair(left, right);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,23 +784,41 @@ QList<GitHubReleaseAsset> PrismUpdaterApp::validReleaseArtifacts(const GitHubRel
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto asset_name = asset.name.toLower();
|
auto asset_name = asset.name.toLower();
|
||||||
auto platform = BuildConfig.BUILD_ARTIFACT.toLower();
|
auto [platform, platform_qt_ver] = StringUtils::splitFirst(BuildConfig.BUILD_ARTIFACT.toLower(), "-qt");
|
||||||
auto system_is_arm = QSysInfo::buildCpuArchitecture().contains("arm64");
|
auto system_is_arm = QSysInfo::buildCpuArchitecture().contains("arm64");
|
||||||
auto asset_is_arm = asset_name.contains("arm64");
|
auto asset_is_arm = asset_name.contains("arm64");
|
||||||
auto asset_is_archive = asset_name.endsWith(".zip") || asset_name.endsWith(".tar.gz");
|
auto asset_is_archive = asset_name.endsWith(".zip") || asset_name.endsWith(".tar.gz");
|
||||||
|
|
||||||
bool for_platform = !platform.isEmpty() && asset_name.contains(platform);
|
bool for_platform = !platform.isEmpty() && asset_name.contains(platform);
|
||||||
|
if (!for_platform) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because platforms do not match";
|
||||||
|
}
|
||||||
bool for_portable = asset_name.contains("portable");
|
bool for_portable = asset_name.contains("portable");
|
||||||
if (for_platform && asset_name.contains("legacy") && !platform.contains("legacy"))
|
if (for_platform && asset_name.contains("legacy") && !platform.contains("legacy")) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because platforms do not match";
|
||||||
for_platform = false;
|
for_platform = false;
|
||||||
if (for_platform && ((asset_is_arm && !system_is_arm) || (!asset_is_arm && system_is_arm)))
|
}
|
||||||
|
if (for_platform && ((asset_is_arm && !system_is_arm) || (!asset_is_arm && system_is_arm))) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because architecture does not match";
|
||||||
for_platform = false;
|
for_platform = false;
|
||||||
if (for_platform && platform.contains("windows") && !m_isPortable && asset_is_archive)
|
}
|
||||||
|
if (for_platform && platform.contains("windows") && !m_isPortable && asset_is_archive) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because it is not an installer";
|
||||||
for_platform = false;
|
for_platform = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto qt_pattern = QRegularExpression("-qt(\\d+)");
|
||||||
|
auto qt_match = qt_pattern.match(asset_name);
|
||||||
|
if (for_platform && qt_match.hasMatch()) {
|
||||||
|
if (platform_qt_ver.isEmpty() || platform_qt_ver.toInt() != qt_match.captured(1).toInt()) {
|
||||||
|
qDebug() << "Rejecting" << asset.name << "because it is not for the correct qt version" << platform_qt_ver.toInt() << "vs"
|
||||||
|
<< qt_match.captured(1).toInt();
|
||||||
|
for_platform = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (((m_isPortable && for_portable) || (!m_isPortable && !for_portable)) && for_platform) {
|
if (((m_isPortable && for_portable) || (!m_isPortable && !for_portable)) && for_platform) {
|
||||||
qDebug() << "Rejecting" << asset.name << "|"
|
qDebug() << "Accepting" << asset.name;
|
||||||
<< "For Platform:" << (for_platform ? "Yes" : "No") << "For Portable:" << (for_portable ? "Yes" : "No");
|
|
||||||
valid.append(asset);
|
valid.append(asset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -866,8 +884,7 @@ QFileInfo PrismUpdaterApp::downloadAsset(const GitHubReleaseAsset& asset)
|
|||||||
auto progress_dialog = ProgressDialog();
|
auto progress_dialog = ProgressDialog();
|
||||||
progress_dialog.adjustSize();
|
progress_dialog.adjustSize();
|
||||||
|
|
||||||
if (progress_dialog.execWithTask(download.get()) == QDialog::Rejected)
|
progress_dialog.execWithTask(download.get());
|
||||||
showFatalErrorMessage(tr("Download Aborted"), tr("Download of %1 aborted by user").arg(file_url.toString()));
|
|
||||||
|
|
||||||
qDebug() << "download complete";
|
qDebug() << "download complete";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user