From 07392d493cf7b1a0cb0e0f11838986935a4d2379 Mon Sep 17 00:00:00 2001 From: DioEgizio <83089242+DioEgizio@users.noreply.github.com> Date: Wed, 9 Nov 2022 19:52:00 +0100 Subject: [PATCH 1/5] fix: disable building snaps on release the snap infra should already be able to deal with it, i think Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3225cf1e..6104109d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -510,10 +510,10 @@ jobs: echo "VERSION=$ver_short" >> $GITHUB_ENV - name: Package Snap (Linux) id: snapcraft - if: runner.os == 'Linux' && matrix.qt_ver != 5 + if: runner.os == 'Linux' && inputs.build_type == 'Debug' uses: snapcore/action-build@v1 - name: Upload Snap (Linux) - if: runner.os == 'Linux' && matrix.qt_ver != 5 + if: runner.os == 'Linux' && inputs.build_type == 'Debug' uses: actions/upload-artifact@v3 with: name: prismlauncher_${{ env.VERSION }}_amd64.snap From 841c2e9166e01a8ecff61c96a05b3bdef64fe969 Mon Sep 17 00:00:00 2001 From: DioEgizio <83089242+DioEgizio@users.noreply.github.com> Date: Wed, 9 Nov 2022 19:56:38 +0100 Subject: [PATCH 2/5] fix: disable caching Qt on release it's good practice to not cache on release builds Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com> --- .github/workflows/build.yml | 7 +++++-- .github/workflows/trigger_builds.yml | 1 + .github/workflows/trigger_release.yml | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6104109d..f5d98f90 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,6 +7,10 @@ on: description: Type of build (Debug, Release, RelWithDebInfo, MinSizeRel) type: string default: Debug + is_qt_cached: + description: Enable Qt caching or not + type: string + default: true secrets: SPARKLE_ED25519_KEY: description: Private key for signing Sparkle updates @@ -200,8 +204,7 @@ jobs: arch: ${{ matrix.qt_arch }} modules: ${{ matrix.qt_modules }} tools: ${{ matrix.qt_tools }} - cache: true - cache-key-prefix: ${{ matrix.qt_host }}-${{ matrix.qt_version }}-"${{ matrix.qt_modules }}"-qt_cache + cache: ${{ inputs.is_qt_cached }} - name: Prepare AppImage (Linux) if: runner.os == 'Linux' && matrix.qt_ver != 5 diff --git a/.github/workflows/trigger_builds.yml b/.github/workflows/trigger_builds.yml index 8adaa5e5..44751fbc 100644 --- a/.github/workflows/trigger_builds.yml +++ b/.github/workflows/trigger_builds.yml @@ -30,5 +30,6 @@ jobs: uses: ./.github/workflows/build.yml with: build_type: Debug + is_qt_cached: true secrets: SPARKLE_ED25519_KEY: ${{ secrets.SPARKLE_ED25519_KEY }} diff --git a/.github/workflows/trigger_release.yml b/.github/workflows/trigger_release.yml index d415b2b1..8baa9693 100644 --- a/.github/workflows/trigger_release.yml +++ b/.github/workflows/trigger_release.yml @@ -12,6 +12,7 @@ jobs: uses: ./.github/workflows/build.yml with: build_type: Release + is_qt_cached: false secrets: SPARKLE_ED25519_KEY: ${{ secrets.SPARKLE_ED25519_KEY }} From dcfc15a0a16c3b0d64086621cec8ef8ffc722832 Mon Sep 17 00:00:00 2001 From: DioEgizio <83089242+DioEgizio@users.noreply.github.com> Date: Wed, 9 Nov 2022 20:10:37 +0100 Subject: [PATCH 3/5] feat+fix: move codeql to its own workflow i think it's better practice, it should slightly improve linux qt6 build times and i noticed ccache? is messing up with it because alerts get randomly fixed Signed-off-by: DioEgizio <83089242+DioEgizio@users.noreply.github.com> --- .github/workflows/build.yml | 16 ---------------- .github/workflows/codeql.yml | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 16 deletions(-) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f5d98f90..61fd9b4c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -106,14 +106,6 @@ jobs: with: submodules: 'true' - - name: Initialize CodeQL - if: runner.os == 'Linux' && matrix.qt_ver == 6 - uses: github/codeql-action/init@v2 - with: - config-file: ./.github/codeql/codeql-config.yml - queries: security-and-quality - languages: cpp, java - - name: 'Setup MSYS2' if: runner.os == 'Windows' && matrix.msystem != '' uses: msys2/setup-msys2@v2 @@ -295,14 +287,6 @@ jobs: run: | ctest -E "^example64|example$" --test-dir build --output-on-failure -C ${{ inputs.build_type }} - ## - # CODE SCAN - ## - - - name: Perform CodeQL Analysis - if: runner.os == 'Linux' && matrix.qt_ver == 6 - uses: github/codeql-action/analyze@v2 - ## # PACKAGE BUILDS ## diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..0cd1f6e4 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,35 @@ +name: "CodeQL Code Scanning" + +on: [ push, pull_request, workflow_dispatch ] + +jobs: + CodeQL: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: 'true' + + - name: Initialize CodeQL + uses: github/codeql-action/init@v2 + with: + config-file: ./.github/codeql/codeql-config.yml + queries: security-and-quality + languages: cpp, java + + - name: Install Dependencies + run: + sudo apt-get -y update + + sudo apt-get -y install ninja-build extra-cmake-modules scdoc qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5 + + - name: Configure and Build + run: | + cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -DLauncher_QT_VERSION_MAJOR=5 -G Ninja + + cmake --build build + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v2 From 0a04c3a2a77bda4e60d04f651c7ab5006ee02449 Mon Sep 17 00:00:00 2001 From: txtsd Date: Sun, 13 Nov 2022 19:08:37 +0530 Subject: [PATCH 4/5] fix: Fix the error that CodeQL caught Signed-off-by: txtsd --- launcher/minecraft/mod/tasks/LocalModParseTask.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp index a694e7b2..774f6114 100644 --- a/launcher/minecraft/mod/tasks/LocalModParseTask.cpp +++ b/launcher/minecraft/mod/tasks/LocalModParseTask.cpp @@ -121,7 +121,7 @@ ModDetails ReadMCModTOML(QByteArray contents) return {}; } auto modsTable = tomlModsTable0->as_table(); - if (!tomlModsTable0) { + if (!modsTable) { qWarning() << "Corrupted mods.toml? [[mods]] was not a table!"; return {}; } From 5be947291285fc8ed10852b54a647ecd338d645d Mon Sep 17 00:00:00 2001 From: Sefa Eyeoglu Date: Mon, 14 Nov 2022 21:20:38 +0100 Subject: [PATCH 5/5] fix: fix potentially uninitialized variable Signed-off-by: Sefa Eyeoglu --- launcher/ui/pages/modplatform/ModPage.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launcher/ui/pages/modplatform/ModPage.cpp b/launcher/ui/pages/modplatform/ModPage.cpp index 234f9f36..677bc4d6 100644 --- a/launcher/ui/pages/modplatform/ModPage.cpp +++ b/launcher/ui/pages/modplatform/ModPage.cpp @@ -262,7 +262,7 @@ void ModPage::openUrl(const QUrl& url) const QString address = url.host() + url.path(); QRegularExpressionMatch match; - const char* page; + QString page; match = modrinth.match(address); if (match.hasMatch()) @@ -276,7 +276,7 @@ void ModPage::openUrl(const QUrl& url) page = "curseforge"; } - if (match.hasMatch()) { + if (!page.isNull()) { const QString slug = match.captured(1); // ensure the user isn't opening the same mod