diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c09dd0514..cb69f5d43 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,6 +22,7 @@ on: - cron: "0 5 * * *" env: + GIT_SHA: ${{ github.sha }} SYNERGY_VERSION: ${{ github.event.inputs.version || github.event.release.tag_name }} SYNERGY_PRODUCT_NAME: ${{ vars.SYNERGY_PRODUCT_NAME }} SYNERGY_PACKAGE_PREFIX: ${{ vars.SYNERGY_PACKAGE_PREFIX }} @@ -176,7 +177,7 @@ jobs: name: linux-${{ matrix.distro.name }} runs-on: ${{ matrix.distro.runs-on }} container: ${{ matrix.distro.container }} - timeout-minutes: 10 + timeout-minutes: 20 env: # Prevent apt prompting for input. diff --git a/ChangeLog b/ChangeLog index a6e57e749..7e52e3f88 100644 --- a/ChangeLog +++ b/ChangeLog @@ -41,6 +41,7 @@ Enhancements: - #7364 Format all source with Clang and introduce lint workflow - #7368 Make version check URL v1-specific and configurable - #7369 Re-implement packaging for GitHub workflows (Linux ARM) +- #7372 Add Git SHA to about screen and --version # 1.14.6 diff --git a/cmake/Definitions.cmake b/cmake/Definitions.cmake index 58f614ddb..93f3fa24c 100644 --- a/cmake/Definitions.cmake +++ b/cmake/Definitions.cmake @@ -25,11 +25,18 @@ macro(configure_definitions) configure_ninja() configure_options() - if(NOT DEFINED VERSION_URL) + if("${VERSION_URL}" STREQUAL "") set(VERSION_URL "https://api.symless.com/version?version=v1") endif() add_definitions(-DSYNERGY_VERSION_URL="${VERSION_URL}") + if(NOT "$ENV{GIT_SHA}" STREQUAL "") + # Shorten the Git SHA to 8 chars for readability + string(SUBSTRING "$ENV{GIT_SHA}" 0 8 GIT_SHA_SHORT) + message(STATUS "Short Git SHA: ${GIT_SHA_SHORT}") + add_definitions(-DGIT_SHA_SHORT="${GIT_SHA_SHORT}") + endif() + if(ENABLE_LICENSING) message(STATUS "Licensing enabled") add_definitions(-DSYNERGY_ENABLE_LICENSING=1) diff --git a/src/gui/src/AboutDialog.cpp b/src/gui/src/AboutDialog.cpp index b10b94399..98047b736 100644 --- a/src/gui/src/AboutDialog.cpp +++ b/src/gui/src/AboutDialog.cpp @@ -25,7 +25,13 @@ AboutDialog::AboutDialog(MainWindow *parent, const AppConfig &config) setupUi(this); m_versionChecker.setApp(parent->appPath(config.synergycName())); - m_pLabelSynergyVersion->setText(SYNERGY_VERSION); + + QString version = SYNERGY_VERSION; +#ifdef GIT_SHA_SHORT + version += " (" GIT_SHA_SHORT ")"; +#endif + + m_pLabelSynergyVersion->setText(version); QString buildDateString = QString::fromLocal8Bit(__DATE__).simplified(); QDate buildDate = QLocale("en_US").toDate(buildDateString, "MMM d yyyy"); diff --git a/src/lib/synergy/App.cpp b/src/lib/synergy/App.cpp index 8f3c15a12..dd9999c89 100644 --- a/src/lib/synergy/App.cpp +++ b/src/lib/synergy/App.cpp @@ -41,6 +41,7 @@ #endif #include +#include #include #if WINAPI_CARBON @@ -79,9 +80,15 @@ void App::version() { char copyrightBuffer[cpight_size]; snprintf(copyrightBuffer, cpight_size, kCopyright, kBuildYear); + std::stringstream version; + version << kVersion; +#ifdef GIT_SHA_SHORT + version << " (" << GIT_SHA_SHORT << ")"; +#endif + char buffer[buffer_size]; snprintf(buffer, buffer_size, "%s %s, protocol version %d.%d\n%s", - argsBase().m_pname, kVersion, kProtocolMajorVersion, + argsBase().m_pname, version.str().c_str(), kProtocolMajorVersion, kProtocolMinorVersion, copyrightBuffer); std::cout << buffer << std::endl;