From 9bfd12ba3c39960e1b598bb460cd95adaa6381cf Mon Sep 17 00:00:00 2001 From: nerix Date: Thu, 16 Feb 2023 14:56:20 +0100 Subject: [PATCH 01/10] Fix builds from CI showing up as modified (#4384) This change also adds a new environment variable used while building: `CHATTERINO_REQUIRE_CLEAN_GIT` which, if set, will error out during your build's GIT stage. This is used in CI to ensure we don't accidentally introduce a change that would result in builds showing up as "modified" again. Co-authored-by: Rasmus Karlsson --- .github/workflows/build.yml | 4 +- .gitignore | 3 ++ CHANGELOG.md | 1 + cmake/GIT.cmake | 84 ++++++++++++++++++++----------------- 4 files changed, 52 insertions(+), 40 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8e2c143db..abba1d943 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -14,6 +14,7 @@ concurrency: env: C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }} + CHATTERINO_REQUIRE_CLEAN_GIT: On jobs: build: @@ -81,9 +82,8 @@ jobs: uses: jurplel/install-qt-action@v3.0.0 with: cache: true - cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }} + cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 version: ${{ matrix.qt-version }} - dir: "${{ github.workspace }}/qt/" # WINDOWS - name: Cache conan packages part 1 diff --git a/.gitignore b/.gitignore index c09b3bef9..9e5859235 100644 --- a/.gitignore +++ b/.gitignore @@ -118,3 +118,6 @@ qt6.natvis # Autogenerated resource file resources/resources_autogenerated.qrc + +# Leftovers from running `aqt install` +aqtinstall.log diff --git a/CHANGELOG.md b/CHANGELOG.md index f9ea71777..c2ff9eb43 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,6 +33,7 @@ - Bugfix: Fixed the split "Search" menu action not opening the correct search window. (#4305) - Bugfix: Fixed an issue on Windows when opening links in incognito mode that contained forward slashes in hash (#4307) - Bugfix: Fixed an issue where beta versions wouldn't update to stable versions correctly. (#4329) +- Bugfix: Fixed builds from GitHub showing up as modified. (#4384) - Bugfix: Avoided crash that could occur when receiving channel point reward information. (#4360) - Dev: Changed sound backend from Qt to miniaudio. (#4334) - Dev: Removed protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256) diff --git a/cmake/GIT.cmake b/cmake/GIT.cmake index b4f9fecbf..9469d9420 100644 --- a/cmake/GIT.cmake +++ b/cmake/GIT.cmake @@ -9,7 +9,7 @@ # If the git binary is found and the git work tree is intact, GIT_RELEASE is worked out using the `git describe` command # The value of GIT_RELEASE can be overriden by defining the GIT_RELEASE environment variable # GIT_MODIFIED -# If the git binary is found and the git work tree is intact, GIT_MODIFIED is worked out by checking if output of `git status --porcelain -z` command is empty +# If the git binary is found and the git work tree is intact, GIT_MODIFIED is worked out by checking if output of `git status --porcelain -z` command is empty # The value of GIT_MODIFIED cannot be overriden find_package(Git) @@ -19,67 +19,75 @@ set(GIT_COMMIT "GIT-REPOSITORY-NOT-FOUND") set(GIT_RELEASE "${PROJECT_VERSION}") set(GIT_MODIFIED 0) -if (DEFINED ENV{CHATTERINO_SKIP_GIT_GEN}) +if(DEFINED ENV{CHATTERINO_SKIP_GIT_GEN}) return() -endif () +endif() -if (GIT_EXECUTABLE) +if(GIT_EXECUTABLE) execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND - OUTPUT_QUIET - ERROR_QUIET + COMMAND ${GIT_EXECUTABLE} rev-parse --is-inside-work-tree + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + RESULT_VARIABLE GIT_REPOSITORY_NOT_FOUND + OUTPUT_QUIET + ERROR_QUIET ) - if (GIT_REPOSITORY_NOT_FOUND) + + if(GIT_REPOSITORY_NOT_FOUND) set(GIT_REPOSITORY_FOUND 0) - else () + else() set(GIT_REPOSITORY_FOUND 1) endif() - if (GIT_REPOSITORY_FOUND) + if(GIT_REPOSITORY_FOUND) execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_HASH - OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND ${GIT_EXECUTABLE} rev-parse --short HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_HASH + OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( - COMMAND ${GIT_EXECUTABLE} rev-parse HEAD - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_COMMIT - OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND ${GIT_EXECUTABLE} rev-parse HEAD + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_COMMIT + OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( - COMMAND ${GIT_EXECUTABLE} describe - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_RELEASE - OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND ${GIT_EXECUTABLE} describe + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_RELEASE + OUTPUT_STRIP_TRAILING_WHITESPACE ) execute_process( - COMMAND ${GIT_EXECUTABLE} status --porcelain -z - WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} - OUTPUT_VARIABLE GIT_MODIFIED_OUTPUT - OUTPUT_STRIP_TRAILING_WHITESPACE + COMMAND ${GIT_EXECUTABLE} status --porcelain -z + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + OUTPUT_VARIABLE GIT_MODIFIED_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE ) - endif (GIT_REPOSITORY_FOUND) -endif (GIT_EXECUTABLE) + endif(GIT_REPOSITORY_FOUND) +endif(GIT_EXECUTABLE) + +if(GIT_MODIFIED_OUTPUT) + if(DEFINED ENV{CHATTERINO_REQUIRE_CLEAN_GIT}) + message(STATUS "git status --porcelain -z\n${GIT_MODIFIED_OUTPUT}") + message(FATAL_ERROR "Git repository was expected to be clean, but modifications were found!") + endif() -if (GIT_MODIFIED_OUTPUT) set(GIT_MODIFIED 1) -endif () +endif() -if (DEFINED ENV{GIT_HASH}) +if(DEFINED ENV{GIT_HASH}) set(GIT_HASH "$ENV{GIT_HASH}") -endif () -if (DEFINED ENV{GIT_COMMIT}) +endif() + +if(DEFINED ENV{GIT_COMMIT}) set(GIT_COMMIT "$ENV{GIT_COMMIT}") -endif () -if (DEFINED ENV{GIT_RELEASE}) +endif() + +if(DEFINED ENV{GIT_RELEASE}) set(GIT_RELEASE "$ENV{GIT_RELEASE}") -endif () +endif() message(STATUS "Injected git values: ${GIT_COMMIT} (${GIT_RELEASE}) modified: ${GIT_MODIFIED}") From 28bdf440fd38a64fbe9dbbb2ea9967f93162f48f Mon Sep 17 00:00:00 2001 From: Felanbird <41973452+Felanbird@users.noreply.github.com> Date: Thu, 16 Feb 2023 11:08:09 -0500 Subject: [PATCH 02/10] Move #4361 changelog to `dev` section (#4385) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ff9eb43..2300e108d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,6 @@ - Minor: Added channel name to /mentions log entries. (#4371) - Minor: Added link to streamlink docs for easier user setup. (#4217) - Minor: Added support for HTTP and Socks5 proxies through environment variables. (#4321) -- Minor: Removed sending part of the multipart emoji workaround. (#4361) - Minor: Added crashpad to capture crashes on Windows locally. See PR for build/crash analysis instructions. (#4351) - Bugfix: Fixed User Card moderation actions not working after Twitch IRC chat command deprecation. (#4378) - Bugfix: Fixed crash that would occur when performing certain actions after removing all tabs. (#4271) @@ -36,6 +35,7 @@ - Bugfix: Fixed builds from GitHub showing up as modified. (#4384) - Bugfix: Avoided crash that could occur when receiving channel point reward information. (#4360) - Dev: Changed sound backend from Qt to miniaudio. (#4334) +- Dev: Removed sending part of the multipart emoji workaround. (#4361) - Dev: Removed protocol from QApplication's Organization Domain (so changed from `https://www.chatterino.com` to `chatterino.com`). (#4256) - Dev: Ignore `WM_SHOWWINDOW` hide events, causing fewer attempted rescales. (#4198) - Dev: Migrated to C++ 20 (#4252, #4257) From 6380fb5198fbde0a7c52fdeb3c25defe112303a9 Mon Sep 17 00:00:00 2001 From: pajlada Date: Thu, 16 Feb 2023 21:43:37 +0100 Subject: [PATCH 03/10] Fix mod, unmod, vip, unvip buttons in User Card (#4387) --- CHANGELOG.md | 1 + src/widgets/dialogs/UserInfoPopup.cpp | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2300e108d..67ad2e061 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ - Minor: Added support for HTTP and Socks5 proxies through environment variables. (#4321) - Minor: Added crashpad to capture crashes on Windows locally. See PR for build/crash analysis instructions. (#4351) - Bugfix: Fixed User Card moderation actions not working after Twitch IRC chat command deprecation. (#4378) +- Bugfix: Fixed User Card broadcaster actions (mod, unmod, vip, unvip) not working after Twitch IRC chat command deprecation. (#4387) - Bugfix: Fixed crash that would occur when performing certain actions after removing all tabs. (#4271) - Bugfix: Fixed highlight sounds not reloading on change properly. (#4194) - Bugfix: Fixed CTRL + C not working in reply thread popups. (#4209) diff --git a/src/widgets/dialogs/UserInfoPopup.cpp b/src/widgets/dialogs/UserInfoPopup.cpp index ed002225a..9c0541d63 100644 --- a/src/widgets/dialogs/UserInfoPopup.cpp +++ b/src/widgets/dialogs/UserInfoPopup.cpp @@ -419,16 +419,28 @@ UserInfoPopup::UserInfoPopup(bool closeAutomatically, QWidget *parent, }); QObject::connect(mod.getElement(), &Button::leftClicked, [this] { - this->underlyingChannel_->sendMessage("/mod " + this->userName_); + QString value = "/mod " + this->userName_; + value = getApp()->commands->execCommand( + value, this->underlyingChannel_, false); + this->underlyingChannel_->sendMessage(value); }); QObject::connect(unmod.getElement(), &Button::leftClicked, [this] { - this->underlyingChannel_->sendMessage("/unmod " + this->userName_); + QString value = "/unmod " + this->userName_; + value = getApp()->commands->execCommand( + value, this->underlyingChannel_, false); + this->underlyingChannel_->sendMessage(value); }); QObject::connect(vip.getElement(), &Button::leftClicked, [this] { - this->underlyingChannel_->sendMessage("/vip " + this->userName_); + QString value = "/vip " + this->userName_; + value = getApp()->commands->execCommand( + value, this->underlyingChannel_, false); + this->underlyingChannel_->sendMessage(value); }); QObject::connect(unvip.getElement(), &Button::leftClicked, [this] { - this->underlyingChannel_->sendMessage("/unvip " + this->userName_); + QString value = "/unvip " + this->userName_; + value = getApp()->commands->execCommand( + value, this->underlyingChannel_, false); + this->underlyingChannel_->sendMessage(value); }); // userstate From da97079877bed679a43fa50be12dad64385f262f Mon Sep 17 00:00:00 2001 From: Ilya Zlobintsev Date: Fri, 17 Feb 2023 22:01:47 +0200 Subject: [PATCH 04/10] Add flatpakref file to artifacts (#4388) The .flatpakref file format definition can be read about here https://man7.org/linux/man-pages/man5/flatpak-flatpakref.5.html or just `man flatpak-flatpakref` --- .CI/chatterino-nightly.flatpakref | 9 +++++++++ .github/workflows/build.yml | 5 +++++ CHANGELOG.md | 1 + 3 files changed, 15 insertions(+) create mode 100644 .CI/chatterino-nightly.flatpakref diff --git a/.CI/chatterino-nightly.flatpakref b/.CI/chatterino-nightly.flatpakref new file mode 100644 index 000000000..a1484546b --- /dev/null +++ b/.CI/chatterino-nightly.flatpakref @@ -0,0 +1,9 @@ +[Flatpak Ref] +Name=com.chatterino.chatterino +Branch=nightly +Title=com.chatterino.chatterino from flathub +IsRuntime=false +Url=https://dl.flathub.org/repo/ +SuggestRemoteName=flathub +GPGKey=mQINBFlD2sABEADsiUZUOYBg1UdDaWkEdJYkTSZD68214m8Q1fbrP5AptaUfCl8KYKFMNoAJRBXn9FbE6q6VBzghHXj/rS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MDucjm7v6iuCMVAmZdmxhg5I/X2+OM3vBsqPDdQpr2TPDLX3rCrSBiS0gOQ6DwN5N5QeTkxmY/7QO8bgLo/Wzu1iilH4vMKW6LBKCaRx5UEJxKpL4wkgITsYKneIt3NTHo5EOuaYk+y2+Dvt6EQFiuMsdbfUjs3seIHsghX/cbPJa4YUqZAL8C4OtVHaijwGo0ymt9MWvS9yNKMyT0JhN2/BdeOVWrHk7wXXJn/ZjpXilicXKPx4udCF76meE+6N2u/T+RYZ7fP1QMEtNZNmYDOfA6sViuPDfQSHLNbauJBo/n1sRYAsL5mcG22UDchJrlKvmK3EOADCQg+myrm8006LltubNB4wWNzHDJ0Ls2JGzQZCd/xGyVmUiidCBUrD537WdknOYE4FD7P0cHaM9brKJ/M8LkEH0zUlo73bY4XagbnCqve6PvQb5G2Z55qhWphd6f4B6DGed86zJEa/RhS +RuntimeRepo=https://dl.flathub.org/repo/flathub.flatpakrepo diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index abba1d943..eeb141f6f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -344,6 +344,11 @@ jobs: name: chatterino-osx-5.15.2.dmg path: release-artifacts/ + - name: Copy flatpakref + run: | + cp .CI/chatterino-nightly.flatpakref release-artifacts/ + shell: bash + - name: Create release uses: ncipollo/release-action@v1.12.0 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index 67ad2e061..207ecad89 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ - Minor: Added link to streamlink docs for easier user setup. (#4217) - Minor: Added support for HTTP and Socks5 proxies through environment variables. (#4321) - Minor: Added crashpad to capture crashes on Windows locally. See PR for build/crash analysis instructions. (#4351) +- Minor: Github releases now include flatpakref files for nightly builds - Bugfix: Fixed User Card moderation actions not working after Twitch IRC chat command deprecation. (#4378) - Bugfix: Fixed User Card broadcaster actions (mod, unmod, vip, unvip) not working after Twitch IRC chat command deprecation. (#4387) - Bugfix: Fixed crash that would occur when performing certain actions after removing all tabs. (#4271) From 2629e3baa7cf001cd94a7904d8a269f5cf899b26 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sat, 18 Feb 2023 13:02:12 +0100 Subject: [PATCH 05/10] Stop whispers from showing up in /mentions unless they match another highlight (#4389) --- CHANGELOG.md | 1 + src/providers/twitch/IrcMessageHandler.cpp | 2 +- tests/src/HighlightController.cpp | 51 ++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 207ecad89..bf9680028 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -149,6 +149,7 @@ - Bugfix: Fixed crash happening when QuickSwitcher is used with a popout window. (#4187) - Bugfix: Fixed low contrast of text in settings tooltips. (#4188) - Bugfix: Fixed being unable to see the usercard of VIPs who have Asian language display names. (#4174) +- Bugfix: Fixed whispers always being shown in the /mentions split. (#4389) - Bugfix: Fixed messages where Right-to-Left order is mixed in multiple lines. (#4173) - Bugfix: Fixed the wrong right-click menu showing in the chat input box. (#4177) - Bugfix: Fixed popup windows not appearing/minimizing correctly on the Windows taskbar. (#4181) diff --git a/src/providers/twitch/IrcMessageHandler.cpp b/src/providers/twitch/IrcMessageHandler.cpp index 1c04eac4e..43fa8d49c 100644 --- a/src/providers/twitch/IrcMessageHandler.cpp +++ b/src/providers/twitch/IrcMessageHandler.cpp @@ -810,7 +810,7 @@ void IrcMessageHandler::handleWhisperMessage(Communi::IrcMessage *message) getApp()->twitch->lastUserThatWhisperedMe.set(builder.userName); - if (_message->flags.has(MessageFlag::Highlighted)) + if (_message->flags.has(MessageFlag::ShowInMentions)) { getApp()->twitch->mentionsChannel->addMessage(_message); } diff --git a/tests/src/HighlightController.cpp b/tests/src/HighlightController.cpp index c712709d6..eecb9cc37 100644 --- a/tests/src/HighlightController.cpp +++ b/tests/src/HighlightController.cpp @@ -3,6 +3,7 @@ #include "Application.hpp" #include "BaseSettings.hpp" #include "controllers/accounts/AccountController.hpp" +#include "controllers/highlights/HighlightPhrase.hpp" #include "messages/MessageBuilder.hpp" // for MessageParseArgs #include "mocks/UserData.hpp" #include "providers/twitch/api/Helix.hpp" @@ -774,6 +775,56 @@ TEST_F(HighlightControllerTest, A) }, }, }, + { + // TEST CASE: Whispers that do not hit a highlight phrase should not be added to /mentions + { + // input + .args = + MessageParseArgs{ + .isReceivedWhisper = true, + }, + .senderName = "forsen", + .originalMessage = "Hello NymN!", + }, + { + // expected + .state = true, // state + .result = + { + false, // alert + false, // playsound + boost::none, // custom sound url + std::make_shared( + HighlightPhrase:: + FALLBACK_HIGHLIGHT_COLOR), // color + false, // showInMentions + }, + }, + }, + { + // TEST CASE: Whispers that do hit a highlight phrase should be added to /mentions + { + // input + .args = + MessageParseArgs{ + .isReceivedWhisper = true, + }, + .senderName = "forsen", + .originalMessage = "!testmanxd", + }, + { + // expected + .state = true, // state + .result = + { + true, // alert + true, // playsound + boost::none, // custom sound url + std::make_shared("#7f7f3f49"), // color + true, // showInMentions + }, + }, + }, }; for (const auto &[input, expected] : tests) From 5ed4a21d6af1445cfbeca7af72996e7cdcacf0e9 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 19 Feb 2023 12:14:54 +0100 Subject: [PATCH 06/10] Release v2.4.1 (#4390) --- CHANGELOG.md | 2 ++ CMakeLists.txt | 2 +- resources/com.chatterino.chatterino.appdata.xml | 2 +- src/common/Version.hpp | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bf9680028..ec801b222 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unversioned +## 2.4.1 + - Major: Added live emote updates for BTTV. (#4147) - Minor: Added setting to turn off rendering of reply context. (#4224) - Minor: Changed the highlight order to prioritize Message highlights over User highlights. (#4303) diff --git a/CMakeLists.txt b/CMakeLists.txt index 090206728..9dac811f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/sanitizers-cmake/cmake" ) -project(chatterino VERSION 2.4.0) +project(chatterino VERSION 2.4.1) option(BUILD_APP "Build Chatterino" ON) option(BUILD_TESTS "Build the tests for Chatterino" OFF) diff --git a/resources/com.chatterino.chatterino.appdata.xml b/resources/com.chatterino.chatterino.appdata.xml index 9ae44b947..fec7a8f46 100644 --- a/resources/com.chatterino.chatterino.appdata.xml +++ b/resources/com.chatterino.chatterino.appdata.xml @@ -32,6 +32,6 @@ chatterino - + diff --git a/src/common/Version.hpp b/src/common/Version.hpp index 222b656f7..55d8d167f 100644 --- a/src/common/Version.hpp +++ b/src/common/Version.hpp @@ -24,7 +24,7 @@ * - 2.4.0-alpha.2 * - 2.4.0-alpha **/ -#define CHATTERINO_VERSION "2.4.0" +#define CHATTERINO_VERSION "2.4.1" #if defined(Q_OS_WIN) # define CHATTERINO_OS "win" From d3499e814e3ecb303faf5610652b0965e2f3d047 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 19 Feb 2023 17:08:32 +0100 Subject: [PATCH 07/10] Fix the brew cask action (#4394) It previously tried to bump the version from 2.4.0 to v2.4.1 the action didn't strip the v, but it does now --- .github/workflows/homebrew.yml | 5 ++++- CHANGELOG.md | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/homebrew.yml b/.github/workflows/homebrew.yml index a0a5195ec..b455baaec 100644 --- a/.github/workflows/homebrew.yml +++ b/.github/workflows/homebrew.yml @@ -11,6 +11,7 @@ on: env: # This gets updated later on in the run by a bash script to strip the prefix C2_CASK_NAME: chatterino + # The full version of Chatterino (e.g. v2.4.1) C2_TAGGED_VERSION: ${{ github.ref_name }} HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} @@ -23,4 +24,6 @@ jobs: - name: Execute brew bump-cask-pr with version run: | echo "Running bump-cask-pr for cask '$C2_CASK_NAME' and version '$C2_TAGGED_VERSION'" - brew bump-cask-pr --version "$C2_TAGGED_VERSION" "$C2_CASK_NAME" + C2_TAGGED_VERSION_STRIPPED="${C2_TAGGED_VERSION:1}" + echo "Stripped version: '$C2_TAGGED_VERSION_STRIPPED'" + brew bump-cask-pr --version "$C2_TAGGED_VERSION_STRIPPED" "$C2_CASK_NAME" diff --git a/CHANGELOG.md b/CHANGELOG.md index ec801b222..4e59edce7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ## Unversioned +- Dev: Fix homebrew update action. (#4394) + ## 2.4.1 - Major: Added live emote updates for BTTV. (#4147) From c95a65c153d569186023dbdf26ed748cc9c29162 Mon Sep 17 00:00:00 2001 From: pajlada Date: Sun, 19 Feb 2023 20:19:18 +0100 Subject: [PATCH 08/10] Fix Qt6 building (#4393) --- .github/workflows/build.yml | 27 +++++++++++- CHANGELOG.md | 1 + CMakeLists.txt | 7 ++++ src/CMakeLists.txt | 8 ++++ src/PrecompiledHeader.hpp | 1 - src/common/LinkParser.cpp | 5 +++ .../commands/CommandController.cpp | 3 +- .../commands/CommandController.hpp | 2 +- src/controllers/sound/SoundController.cpp | 1 + .../BttvLiveUpdateSubscription.cpp | 1 + src/providers/irc/IrcServer.cpp | 3 +- src/providers/twitch/TwitchIrcServer.cpp | 2 +- src/providers/twitch/TwitchMessageBuilder.cpp | 16 ++++++-- src/util/Helpers.cpp | 6 +++ src/util/Helpers.hpp | 1 + src/widgets/Notebook.cpp | 8 ++-- src/widgets/dialogs/SettingsDialog.cpp | 1 + src/widgets/helper/ResizingTextEdit.cpp | 4 ++ src/widgets/helper/SettingsDialogTab.cpp | 2 +- src/widgets/settingspages/AboutPage.cpp | 5 +++ src/widgets/settingspages/ModerationPage.cpp | 41 ++++++++++--------- src/widgets/splits/SplitInput.cpp | 6 +-- 22 files changed, 114 insertions(+), 37 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eeb141f6f..733088705 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,6 +15,7 @@ concurrency: env: C2_ENABLE_LTO: ${{ github.ref == 'refs/heads/master' }} CHATTERINO_REQUIRE_CLEAN_GIT: On + C2_BUILD_WITH_QT6: Off jobs: build: @@ -39,6 +40,11 @@ jobs: qt-version: 5.15.2 pch: true force-lto: false + # Ubuntu 22.04, Qt 6.2.4 + - os: ubuntu-22.04 + qt-version: 6.2.4 + pch: false + force-lto: false # Test for disabling Precompiled Headers & enabling link-time optimization - os: ubuntu-22.04 qt-version: 5.15.2 @@ -73,18 +79,34 @@ jobs: echo "vs_version=2022" >> "$GITHUB_ENV" shell: bash + - name: Set BUILD_WITH_QT6 + if: startsWith(matrix.qt-version, '6.') + run: | + echo "C2_BUILD_WITH_QT6=ON" >> "$GITHUB_ENV" + shell: bash + - uses: actions/checkout@v3 with: submodules: recursive fetch-depth: 0 # allows for tags access - - name: Install Qt + - name: Install Qt5 + if: startsWith(matrix.qt-version, '5.') uses: jurplel/install-qt-action@v3.0.0 with: cache: true cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 version: ${{ matrix.qt-version }} + - name: Install Qt6 + if: startsWith(matrix.qt-version, '6.') + uses: jurplel/install-qt-action@v3.0.0 + with: + cache: true + cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 + modules: qt5compat + version: ${{ matrix.qt-version }} + # WINDOWS - name: Cache conan packages part 1 if: startsWith(matrix.os, 'windows') @@ -131,6 +153,7 @@ jobs: -DCMAKE_TOOLCHAIN_FILE="conan_toolchain.cmake" ` -DBUILD_WITH_CRASHPAD="$Env:C2_ENABLE_CRASHPAD" ` -DCHATTERINO_LTO="$Env:C2_ENABLE_LTO" ` + -DBUILD_WITH_QT6="$Env:C2_BUILD_WITH_QT6" ` .. set cl=/MP nmake /S /NOLOGO @@ -216,6 +239,7 @@ jobs: -DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \ -DCMAKE_EXPORT_COMPILE_COMMANDS=On \ -DCHATTERINO_LTO="$C2_ENABLE_LTO" \ + -DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \ .. make -j"$(nproc)" shell: bash @@ -284,6 +308,7 @@ jobs: -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl \ -DUSE_PRECOMPILED_HEADERS=${{ matrix.pch }} \ -DCHATTERINO_LTO="$C2_ENABLE_LTO" \ + -DBUILD_WITH_QT6="$C2_BUILD_WITH_QT6" \ .. make -j"$(sysctl -n hw.logicalcpu)" shell: bash diff --git a/CHANGELOG.md b/CHANGELOG.md index 4e59edce7..82be7d5a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unversioned +- Dev: Add capability to build Chatterino with Qt6. (#4393) - Dev: Fix homebrew update action. (#4394) ## 2.4.1 diff --git a/CMakeLists.txt b/CMakeLists.txt index 9dac811f4..68e07ca33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -58,6 +58,13 @@ find_package(Qt${MAJOR_QT_VERSION} REQUIRED Concurrent ) +if (BUILD_WITH_QT6) + find_package(Qt${MAJOR_QT_VERSION} REQUIRED + COMPONENTS + Core5Compat + ) +endif () + message(STATUS "Qt version: ${Qt${MAJOR_QT_VERSION}_VERSION}") if (WIN32) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 5b8ad1bb8..fd705c125 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -620,6 +620,14 @@ target_link_libraries(${LIBRARY_PROJECT} LRUCache MagicEnum ) + +if (BUILD_WITH_QT6) + target_link_libraries(${LIBRARY_PROJECT} + PUBLIC + Qt${MAJOR_QT_VERSION}::Core5Compat + ) +endif () + if (BUILD_WITH_QTKEYCHAIN) target_link_libraries(${LIBRARY_PROJECT} PUBLIC diff --git a/src/PrecompiledHeader.hpp b/src/PrecompiledHeader.hpp index 0f7ac7643..a4a453954 100644 --- a/src/PrecompiledHeader.hpp +++ b/src/PrecompiledHeader.hpp @@ -105,7 +105,6 @@ # include # include # include -# include # include # include # include diff --git a/src/common/LinkParser.cpp b/src/common/LinkParser.cpp index 1b8c3f14d..7e82359b9 100644 --- a/src/common/LinkParser.cpp +++ b/src/common/LinkParser.cpp @@ -16,7 +16,12 @@ namespace { QFile file(":/tlds.txt"); file.open(QFile::ReadOnly); QTextStream stream(&file); + +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Default encoding of QTextStream is already UTF-8, at least in Qt6 +#else stream.setCodec("UTF-8"); +#endif int safetyMax = 20000; QSet set; diff --git a/src/controllers/commands/CommandController.cpp b/src/controllers/commands/CommandController.cpp index 06feedd96..42fa76e4f 100644 --- a/src/controllers/commands/CommandController.cpp +++ b/src/controllers/commands/CommandController.cpp @@ -3191,7 +3191,8 @@ QString CommandController::execCommand(const QString &textNoEmoji, } } - auto maxSpaces = std::min(this->maxSpaces_, words.length() - 1); + // We have checks to ensure words cannot be empty, so this can never wrap around + auto maxSpaces = std::min(this->maxSpaces_, (qsizetype)words.length() - 1); for (int i = 0; i < maxSpaces; ++i) { commandName += ' ' + words[i + 1]; diff --git a/src/controllers/commands/CommandController.hpp b/src/controllers/commands/CommandController.hpp index fcae24249..3816fa71d 100644 --- a/src/controllers/commands/CommandController.hpp +++ b/src/controllers/commands/CommandController.hpp @@ -62,7 +62,7 @@ private: // User-created commands QMap userCommands_; - int maxSpaces_ = 0; + qsizetype maxSpaces_ = 0; std::shared_ptr sm_; // Because the setting manager is not initialized until the initialize diff --git a/src/controllers/sound/SoundController.cpp b/src/controllers/sound/SoundController.cpp index 22c71a90c..be9313ef7 100644 --- a/src/controllers/sound/SoundController.cpp +++ b/src/controllers/sound/SoundController.cpp @@ -7,6 +7,7 @@ #define MINIAUDIO_IMPLEMENTATION #include +#include #include #include diff --git a/src/providers/bttv/liveupdates/BttvLiveUpdateSubscription.cpp b/src/providers/bttv/liveupdates/BttvLiveUpdateSubscription.cpp index cce726357..12b27a349 100644 --- a/src/providers/bttv/liveupdates/BttvLiveUpdateSubscription.cpp +++ b/src/providers/bttv/liveupdates/BttvLiveUpdateSubscription.cpp @@ -1,5 +1,6 @@ #include "providers/bttv/liveupdates/BttvLiveUpdateSubscription.hpp" +#include #include namespace chatterino { diff --git a/src/providers/irc/IrcServer.cpp b/src/providers/irc/IrcServer.cpp index b79f635bc..5ae01c56b 100644 --- a/src/providers/irc/IrcServer.cpp +++ b/src/providers/irc/IrcServer.cpp @@ -94,7 +94,8 @@ void IrcServer::initializeConnectionSignals(IrcConnection *connection, QObject::connect(connection, &Communi::IrcConnection::nickNameRequired, this, [](const QString &reserved, QString *result) { - *result = reserved + (std::rand() % 100); + *result = QString("%1%2").arg( + reserved, QString::number(std::rand() % 100)); }); QObject::connect(connection, &Communi::IrcConnection::noticeMessageReceived, diff --git a/src/providers/twitch/TwitchIrcServer.cpp b/src/providers/twitch/TwitchIrcServer.cpp index c608f9e0b..f2b30aef3 100644 --- a/src/providers/twitch/TwitchIrcServer.cpp +++ b/src/providers/twitch/TwitchIrcServer.cpp @@ -325,7 +325,7 @@ std::shared_ptr TwitchIrcServer::getChannelOrEmptyByID( continue; if (twitchChannel->roomId() == channelId && - twitchChannel->getName().splitRef(":").size() < 3) + twitchChannel->getName().count(':') < 2) { return twitchChannel; } diff --git a/src/providers/twitch/TwitchMessageBuilder.cpp b/src/providers/twitch/TwitchMessageBuilder.cpp index 7987f34bd..c8c4da409 100644 --- a/src/providers/twitch/TwitchMessageBuilder.cpp +++ b/src/providers/twitch/TwitchMessageBuilder.cpp @@ -821,14 +821,14 @@ void TwitchMessageBuilder::runIgnoreReplaces( }; auto addReplEmotes = [&twitchEmotes](const IgnorePhrase &phrase, - const QStringRef &midrepl, + const auto &midrepl, int startIndex) mutable { if (!phrase.containsEmote()) { return; } - QVector words = midrepl.split(' '); + auto words = midrepl.split(' '); int pos = 0; for (const auto &word : words) { @@ -843,7 +843,7 @@ void TwitchMessageBuilder::runIgnoreReplaces( } twitchEmotes.push_back(TwitchEmoteOccurrence{ startIndex + pos, - startIndex + pos + emote.first.string.length(), + startIndex + pos + (int)emote.first.string.length(), emote.second, emote.first, }); @@ -904,8 +904,13 @@ void TwitchMessageBuilder::runIgnoreReplaces( shiftIndicesAfter(from + len, midsize - len); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + auto midExtendedRef = + QStringView{this->originalMessage_}.mid(pos1, pos2 - pos1); +#else auto midExtendedRef = this->originalMessage_.midRef(pos1, pos2 - pos1); +#endif for (auto &tup : vret) { @@ -969,8 +974,13 @@ void TwitchMessageBuilder::runIgnoreReplaces( shiftIndicesAfter(from + len, replacesize - len); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + auto midExtendedRef = + QStringView{this->originalMessage_}.mid(pos1, pos2 - pos1); +#else auto midExtendedRef = this->originalMessage_.midRef(pos1, pos2 - pos1); +#endif for (auto &tup : vret) { diff --git a/src/util/Helpers.cpp b/src/util/Helpers.cpp index a913d4fc0..d4d4c6173 100644 --- a/src/util/Helpers.cpp +++ b/src/util/Helpers.cpp @@ -174,6 +174,12 @@ QString localizeNumbers(unsigned int number) return locale.toString(number); } +QString localizeNumbers(qsizetype number) +{ + QLocale locale; + return locale.toString(number); +} + QString kFormatNumbers(const int &number) { return QString("%1K").arg(number / 1000); diff --git a/src/util/Helpers.hpp b/src/util/Helpers.hpp index f16590282..34a374d43 100644 --- a/src/util/Helpers.hpp +++ b/src/util/Helpers.hpp @@ -74,6 +74,7 @@ QString shortenString(const QString &str, unsigned maxWidth = 50); QString localizeNumbers(const int &number); QString localizeNumbers(unsigned int number); +QString localizeNumbers(qsizetype number); QString kFormatNumbers(const int &number); diff --git a/src/widgets/Notebook.cpp b/src/widgets/Notebook.cpp index e797dca05..1d7671f7c 100644 --- a/src/widgets/Notebook.cpp +++ b/src/widgets/Notebook.cpp @@ -641,8 +641,8 @@ void Notebook::performLayout(bool animated) bool isLastColumn = col == columnCount - 1; auto largestWidth = 0; int tabStart = col * tabsPerColumn; - int tabEnd = - std::min((col + 1) * tabsPerColumn, this->items_.size()); + int tabEnd = std::min((col + 1) * tabsPerColumn, + (int)this->items_.size()); for (int i = tabStart; i < tabEnd; i++) { @@ -743,8 +743,8 @@ void Notebook::performLayout(bool animated) bool isLastColumn = col == columnCount - 1; auto largestWidth = 0; int tabStart = col * tabsPerColumn; - int tabEnd = - std::min((col + 1) * tabsPerColumn, this->items_.size()); + int tabEnd = std::min((col + 1) * tabsPerColumn, + (int)this->items_.size()); for (int i = tabStart; i < tabEnd; i++) { diff --git a/src/widgets/dialogs/SettingsDialog.cpp b/src/widgets/dialogs/SettingsDialog.cpp index d30365540..ebc33774a 100644 --- a/src/widgets/dialogs/SettingsDialog.cpp +++ b/src/widgets/dialogs/SettingsDialog.cpp @@ -22,6 +22,7 @@ #include "widgets/settingspages/NotificationPage.hpp" #include +#include #include namespace chatterino { diff --git a/src/widgets/helper/ResizingTextEdit.cpp b/src/widgets/helper/ResizingTextEdit.cpp index 5b0dcd861..9494a6cf1 100644 --- a/src/widgets/helper/ResizingTextEdit.cpp +++ b/src/widgets/helper/ResizingTextEdit.cpp @@ -62,7 +62,11 @@ QString ResizingTextEdit::textUnderCursor(bool *hadSpace) const auto textUpToCursor = currentText.left(tc.selectionStart()); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + auto words = QStringView{textUpToCursor}.split(' '); +#else auto words = textUpToCursor.splitRef(' '); +#endif if (words.size() == 0) { return QString(); diff --git a/src/widgets/helper/SettingsDialogTab.cpp b/src/widgets/helper/SettingsDialogTab.cpp index ca8d7caa4..73014b990 100644 --- a/src/widgets/helper/SettingsDialogTab.cpp +++ b/src/widgets/helper/SettingsDialogTab.cpp @@ -54,7 +54,7 @@ void SettingsDialogTab::paintEvent(QPaintEvent *) QPainter painter(this); QStyleOption opt; - opt.init(this); + opt.initFrom(this); this->style()->drawPrimitive(QStyle::PE_Widget, &opt, &painter, this); diff --git a/src/widgets/settingspages/AboutPage.cpp b/src/widgets/settingspages/AboutPage.cpp index 773f5b8e9..712549e1c 100644 --- a/src/widgets/settingspages/AboutPage.cpp +++ b/src/widgets/settingspages/AboutPage.cpp @@ -8,6 +8,7 @@ #include "widgets/BasePopup.hpp" #include "widgets/helper/SignalLabel.hpp" +#include #include #include #include @@ -144,7 +145,11 @@ AboutPage::AboutPage() contributorsFile.open(QFile::ReadOnly); QTextStream stream(&contributorsFile); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // Default encoding of QTextStream is already UTF-8 +#else stream.setCodec("UTF-8"); +#endif QString line; diff --git a/src/widgets/settingspages/ModerationPage.cpp b/src/widgets/settingspages/ModerationPage.cpp index e306d2734..6dfd6f5f0 100644 --- a/src/widgets/settingspages/ModerationPage.cpp +++ b/src/widgets/settingspages/ModerationPage.cpp @@ -112,35 +112,36 @@ ModerationPage::ModerationPage() // Show how big (size-wise) the logs are auto logsPathSizeLabel = logs.emplace(); logsPathSizeLabel->setText(QtConcurrent::run([] { - return fetchLogDirectorySize(); - })); + return fetchLogDirectorySize(); + }).result()); // Select event - QObject::connect(selectDir.getElement(), &QPushButton::clicked, this, - [this, logsPathSizeLabel]() mutable { - auto dirName = - QFileDialog::getExistingDirectory(this); + QObject::connect( + selectDir.getElement(), &QPushButton::clicked, this, + [this, logsPathSizeLabel]() mutable { + auto dirName = QFileDialog::getExistingDirectory(this); - getSettings()->logPath = dirName; + getSettings()->logPath = dirName; - // Refresh: Show how big (size-wise) the logs are - logsPathSizeLabel->setText(QtConcurrent::run([] { - return fetchLogDirectorySize(); - })); - }); + // Refresh: Show how big (size-wise) the logs are + logsPathSizeLabel->setText(QtConcurrent::run([] { + return fetchLogDirectorySize(); + }).result()); + }); buttons->addSpacing(16); // Reset custom logpath - QObject::connect(resetDir.getElement(), &QPushButton::clicked, this, - [logsPathSizeLabel]() mutable { - getSettings()->logPath = ""; + QObject::connect( + resetDir.getElement(), &QPushButton::clicked, this, + [logsPathSizeLabel]() mutable { + getSettings()->logPath = ""; - // Refresh: Show how big (size-wise) the logs are - logsPathSizeLabel->setText(QtConcurrent::run([] { - return fetchLogDirectorySize(); - })); - }); + // Refresh: Show how big (size-wise) the logs are + logsPathSizeLabel->setText(QtConcurrent::run([] { + return fetchLogDirectorySize(); + }).result()); + }); QCheckBox *onlyLogListedChannels = this->createCheckBox("Only log channels listed below", diff --git a/src/widgets/splits/SplitInput.cpp b/src/widgets/splits/SplitInput.cpp index fa631fae9..252b308f9 100644 --- a/src/widgets/splits/SplitInput.cpp +++ b/src/widgets/splits/SplitInput.cpp @@ -699,7 +699,7 @@ void SplitInput::updateCompletionPopup() return; } - for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--) + for (int i = clamp(position, 0, (int)text.length() - 1); i >= 0; i--) { if (text[i] == ' ') { @@ -766,7 +766,7 @@ void SplitInput::showCompletionPopup(const QString &text, bool emoteCompletion) popup->updateUsers(text, this->split_->getChannel()); } - auto pos = this->mapToGlobal({0, 0}) - QPoint(0, popup->height()) + + auto pos = this->mapToGlobal(QPoint{0, 0}) - QPoint(0, popup->height()) + QPoint((this->width() - popup->width()) / 2, 0); popup->move(pos); @@ -789,7 +789,7 @@ void SplitInput::insertCompletionText(const QString &input_) const auto text = edit.toPlainText(); auto position = edit.textCursor().position() - 1; - for (int i = clamp(position, 0, text.length() - 1); i >= 0; i--) + for (int i = clamp(position, 0, (int)text.length() - 1); i >= 0; i--) { bool done = false; if (text[i] == ':') From c74b14a93ac54ad18c85106b7f9a8463ac1c6b7d Mon Sep 17 00:00:00 2001 From: nerix Date: Sun, 19 Feb 2023 23:20:41 +0100 Subject: [PATCH 09/10] Delete all but the last 5 crash dumps on startup (#4392) Co-authored-by: Rasmus Karlsson --- CHANGELOG.md | 1 + src/RunGui.cpp | 39 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 82be7d5a7..0b4d89d14 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## Unversioned +- Minor: Delete all but the last 5 crashdumps on application start. (#4392) - Dev: Add capability to build Chatterino with Qt6. (#4393) - Dev: Fix homebrew update action. (#4394) diff --git a/src/RunGui.cpp b/src/RunGui.cpp index fdf557e61..49c800a69 100644 --- a/src/RunGui.cpp +++ b/src/RunGui.cpp @@ -185,6 +185,38 @@ namespace { } qCDebug(chatterinoCache) << "Deleted" << deletedCount << "files"; } + + // We delete all but the five most recent crashdumps. This strategy may be + // improved in the future. + void clearCrashes(QDir dir) + { + // crashpad crashdumps are stored inside the Crashes/report directory + if (!dir.cd("reports")) + { + // no reports directory exists = no files to delete + return; + } + + dir.setNameFilters({"*.dmp"}); + + size_t deletedCount = 0; + // TODO: use std::views::drop once supported by all compilers + size_t filesToSkip = 5; + for (auto &&info : dir.entryInfoList(QDir::Files, QDir::Time)) + { + if (filesToSkip > 0) + { + filesToSkip--; + continue; + } + + if (QFile(info.absoluteFilePath()).remove()) + { + deletedCount++; + } + } + qCDebug(chatterinoApp) << "Deleted" << deletedCount << "crashdumps"; + } } // namespace void runGui(QApplication &a, Paths &paths, Settings &settings) @@ -215,10 +247,15 @@ void runGui(QApplication &a, Paths &paths, Settings &settings) }); // Clear the cache 1 minute after start. - QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory()] { + QTimer::singleShot(60 * 1000, [cachePath = paths.cacheDirectory(), + crashDirectory = paths.crashdumpDirectory] { QtConcurrent::run([cachePath]() { clearCache(cachePath); }); + + QtConcurrent::run([crashDirectory]() { + clearCrashes(crashDirectory); + }); }); chatterino::NetworkManager::init(); From 621b5d9163e36242eb65eb02646a633fc60ebf5b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Feb 2023 12:21:57 +0100 Subject: [PATCH 10/10] Bump jurplel/install-qt-action from 3.0.0 to 3.1.0 (#4395) Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++-- .github/workflows/test.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 733088705..f961b5aaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -92,7 +92,7 @@ jobs: - name: Install Qt5 if: startsWith(matrix.qt-version, '5.') - uses: jurplel/install-qt-action@v3.0.0 + uses: jurplel/install-qt-action@v3.1.0 with: cache: true cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 @@ -100,7 +100,7 @@ jobs: - name: Install Qt6 if: startsWith(matrix.qt-version, '6.') - uses: jurplel/install-qt-action@v3.0.0 + uses: jurplel/install-qt-action@v3.1.0 with: cache: true cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}-v2 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e1c9df85b..f0d7b6430 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -34,7 +34,7 @@ jobs: key: ${{ runner.os }}-QtCache-${{ matrix.qt-version }} - name: Install Qt - uses: jurplel/install-qt-action@v3.0.0 + uses: jurplel/install-qt-action@v3.1.0 with: cache: true cache-key-prefix: ${{ runner.os }}-QtCache-${{ matrix.qt-version }}