From 70e64d4d25c8f5e88c9d0dd19b74b5868bc13a2f Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Mon, 25 Nov 2024 09:16:37 +1000 Subject: [PATCH 1/4] Mac build workflow --- .github/workflows/mac.yml | 44 +++++++++++++++++++++++++ .github/workflows/mac/before_install.sh | 11 +++++++ .github/workflows/mac/install.sh | 39 ++++++++++++++++++++++ 3 files changed, 94 insertions(+) create mode 100644 .github/workflows/mac.yml create mode 100644 .github/workflows/mac/before_install.sh create mode 100644 .github/workflows/mac/install.sh diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml new file mode 100644 index 0000000..ff162ee --- /dev/null +++ b/.github/workflows/mac.yml @@ -0,0 +1,44 @@ +name: MacOS build + +on: + push: + pull_request: + branches: + - main + +jobs: + + macos_build: + runs-on: macos-13 + if: "!contains(github.event.head_commit.message, '[ci skip]') && !contains(github.event.head_commit.message, '[skip ci]')" + steps: + + - uses: actions/checkout@v2 + + - uses: conda-incubator/setup-miniconda@v2 + with: + channels: conda-forge + auto-update-conda: true + miniconda-version: latest + + - name: Cache + uses: actions/cache@v2 + id: cache + with: + path: ${{ github.workspace }}/.ccache + key: ${{ runner.os }}-cache-mac-${{ github.run_id }} + restore-keys: ${{ runner.os }}-cache-mac- + + - name: Install Requirements + shell: bash -l {0} + run: | + source .github/workflows/mac/before_install.sh + + - name: Build + shell: bash -l {0} + run: | + source .github/workflows/mac/install.sh + env: + CCACHE_DIR: ${{ github.workspace }}/.ccache + TRAVIS_OS_NAME: osx + BUILD_NAME: osx diff --git a/.github/workflows/mac/before_install.sh b/.github/workflows/mac/before_install.sh new file mode 100644 index 0000000..84961fd --- /dev/null +++ b/.github/workflows/mac/before_install.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +set -e + +conda update -n base -c defaults conda +conda install compilers -y + +conda config --set channel_priority strict + +conda install --yes --quiet libtool ccache ninja qt qt-webengine qtkeychain -y + diff --git a/.github/workflows/mac/install.sh b/.github/workflows/mac/install.sh new file mode 100644 index 0000000..91a006e --- /dev/null +++ b/.github/workflows/mac/install.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +set -e + +export CCACHE_CPP2=yes + +ccache -M 200M +ccache -s + +export CC="ccache clang" +export CXX="ccache clang++" +export CFLAGS="-Werror -O2" +export CXXFLAGS="-Werror -O2" + +mkdir -p build +cd build +cmake -GNinja \ + -Do2_BUILD_EXAMPLES:BOOL=ON \ + -Do2_SHOW_TRACE:BOOL=ON \ + -Do2_WITH_DROPBOX:BOOL=ON \ + -Do2_WITH_FACEBOOK:BOOL=ON \ + -Do2_WITH_FLICKR:BOOL=ON \ + -Do2_WITH_GOOGLE:BOOL=ON \ + -Do2_WITH_HUBIC:BOOL=ON \ + -Do2_WITH_KEYCHAIN:BOOL=ON \ + -Do2_WITH_MSGRAPH:BOOL=ON \ + -Do2_WITH_OAUTH1:BOOL=ON \ + -Do2_WITH_QT5:BOOL=ON \ + -Do2_WITH_SKYDRIVE:BOOL=ON \ + -Do2_WITH_SMUGMUG:BOOL=ON \ + -Do2_WITH_SPOTIFY:BOOL=ON \ + -Do2_WITH_SURVEYMONKEY:BOOL=ON \ + -Do2_WITH_TWITTER:BOOL=ON \ + -Do2_WITH_UBER:BOOL=ON \ + -Do2_WITH_VIMEO:BOOL=ON \ + .. +ninja + +ccache -s From 3d56b12509b81a4811a7539570bb5bdd10a269fa Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Wed, 27 Nov 2024 12:10:24 +1000 Subject: [PATCH 2/4] Find QtKeychain by its cmake target --- CMakeLists.txt | 9 +++++++ cmake/modules/FindQt5Keychain.cmake | 38 ---------------------------- cmake/modules/FindQtKeychain.cmake | 39 ----------------------------- src/CMakeLists.txt | 34 ++++++++----------------- 4 files changed, 19 insertions(+), 101 deletions(-) delete mode 100644 cmake/modules/FindQt5Keychain.cmake delete mode 100644 cmake/modules/FindQtKeychain.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index ee7746f..f0cd666 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -88,7 +88,16 @@ if (o2_WITH_OAUTH1) set(HAVE_OAUTH1_SUPPORT 1) endif() +if(o2_WITH_KEYCHAIN) + if(o2_WITH_QT5) + find_package(Qt5Keychain CONFIG REQUIRED) + else() + find_package(Qt6Keychain CONFIG REQUIRED) + endif() + message("Found QTKeychain") + +endif(o2_WITH_KEYCHAIN) if(o2_WITH_TWITTER OR o2_WITH_DROPBOX OR o2_WITH_FLICKR OR o2_WITH_SMUGMUG) set(o2_WITH_OAUTH1 ON) diff --git a/cmake/modules/FindQt5Keychain.cmake b/cmake/modules/FindQt5Keychain.cmake deleted file mode 100644 index e28ac56..0000000 --- a/cmake/modules/FindQt5Keychain.cmake +++ /dev/null @@ -1,38 +0,0 @@ -# (c) 2014 Copyright ownCloud GmbH -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING* file. - -# - Try to find QtKeychain -# Once done this will define -# QTKEYCHAIN_FOUND - System has QtKeychain -# QTKEYCHAIN_INCLUDE_DIRS - The QtKeychain include directories -# QTKEYCHAIN_LIBRARIES - The libraries needed to use QtKeychain -# QTKEYCHAIN_DEFINITIONS - Compiler switches required for using LibXml2 - -find_path(QTKEYCHAIN_INCLUDE_DIR - NAMES - keychain.h - PATH_SUFFIXES - qt5keychain - ) - -find_library(QTKEYCHAIN_LIBRARY - NAMES - qt5keychain - lib5qtkeychain - PATHS - /usr/lib - /usr/lib/${CMAKE_ARCH_TRIPLET} - /usr/local/lib - /opt/local/lib - ${CMAKE_LIBRARY_PATH} - ${CMAKE_INSTALL_PREFIX}/lib - ) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set QTKEYCHAIN_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(Qt5Keychain DEFAULT_MSG - QTKEYCHAIN_LIBRARY QTKEYCHAIN_INCLUDE_DIR) - -mark_as_advanced(QTKEYCHAIN_INCLUDE_DIR QTKEYCHAIN_LIBRARY) diff --git a/cmake/modules/FindQtKeychain.cmake b/cmake/modules/FindQtKeychain.cmake deleted file mode 100644 index 30d615d..0000000 --- a/cmake/modules/FindQtKeychain.cmake +++ /dev/null @@ -1,39 +0,0 @@ -# (c) 2014 Copyright ownCloud GmbH -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING* file. - -# - Try to find QtKeychain -# Once done this will define -# QTKEYCHAIN_FOUND - System has QtKeychain -# QTKEYCHAIN_INCLUDE_DIRS - The QtKeychain include directories -# QTKEYCHAIN_LIBRARIES - The libraries needed to use QtKeychain -# QTKEYCHAIN_DEFINITIONS - Compiler switches required for using LibXml2 - -find_path(QTKEYCHAIN_INCLUDE_DIR - NAMES - keychain.h - PATH_SUFFIXES - qtkeychain - ) - - -find_library(QTKEYCHAIN_LIBRARY - NAMES - qtkeychain - libqtkeychain - PATHS - /usr/lib - /usr/lib/${CMAKE_ARCH_TRIPLET} - /usr/local/lib - /opt/local/lib - ${CMAKE_LIBRARY_PATH} - ${CMAKE_INSTALL_PREFIX}/lib - ) - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set QTKEYCHAIN_FOUND to TRUE -# if all listed variables are TRUE -find_package_handle_standard_args(QtKeychain DEFAULT_MSG - QTKEYCHAIN_LIBRARY QTKEYCHAIN_INCLUDE_DIR) - -mark_as_advanced(QTKEYCHAIN_INCLUDE_DIR QTKEYCHAIN_LIBRARY) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e6a2d0a..323f8c2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -192,33 +192,19 @@ if(o2_WITH_MSGRAPH) endif(o2_WITH_MSGRAPH) if(o2_WITH_KEYCHAIN) - if (Qt5Core_DIR) - find_package(Qt5Keychain REQUIRED) - else() - find_package(QtKeychain REQUIRED) - endif() - if(QTKEYCHAIN_FOUND OR QT5KEYCHAIN_FOUND) - MESSAGE("Found QTKeychain") - list(APPEND LINK_TARGETS ${QTKEYCHAIN_LIBRARY}) - include_directories(${QTKEYCHAIN_INCLUDE_DIR}) - set( o2_SRCS - ${o2_SRCS} - o0keychainstore.cpp - ) - set( o2_HDRS - ${o2_HDRS} - o0keychainstore.h - ) - else() - MESSAGE("Qt5Keychain or QtKeychain is required") - endif() - + list(APPEND LINK_TARGETS ${QTKEYCHAIN_LIBRARIES}) + include_directories(SYSTEM ${QTKEYCHAIN_INCLUDE_DIRS}) + set( o2_SRCS + ${o2_SRCS} + o0keychainstore.cpp + ) + set( o2_HDRS + ${o2_HDRS} + o0keychainstore.h + ) endif(o2_WITH_KEYCHAIN) - - - if(NOT o2_WITH_QT5) add_definitions(${QT4_DEFINITIONS}) endif(NOT o2_WITH_QT5) From fa14486c1be2485801a5b8c32b0d5289c44056a2 Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Wed, 27 Nov 2024 12:44:27 +1000 Subject: [PATCH 3/4] Run tests on mac --- .github/workflows/mac.yml | 5 +++++ .github/workflows/mac/install.sh | 1 + 2 files changed, 6 insertions(+) diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index ff162ee..9e92ce6 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -42,3 +42,8 @@ jobs: CCACHE_DIR: ${{ github.workspace }}/.ccache TRAVIS_OS_NAME: osx BUILD_NAME: osx + + - name: Run Tests + run: | + cd build + ctest --output-on-failure --no-compress-output -T Test diff --git a/.github/workflows/mac/install.sh b/.github/workflows/mac/install.sh index 91a006e..5e5acb5 100644 --- a/.github/workflows/mac/install.sh +++ b/.github/workflows/mac/install.sh @@ -16,6 +16,7 @@ mkdir -p build cd build cmake -GNinja \ -Do2_BUILD_EXAMPLES:BOOL=ON \ + -Do2_WITH_TESTS=ON \ -Do2_SHOW_TRACE:BOOL=ON \ -Do2_WITH_DROPBOX:BOOL=ON \ -Do2_WITH_FACEBOOK:BOOL=ON \ From 472a481a25c0b299acd5a966dc6b1a51eee22f8a Mon Sep 17 00:00:00 2001 From: Nyall Dawson Date: Wed, 27 Nov 2024 12:58:18 +1000 Subject: [PATCH 4/4] test fail --- tests/teststore.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/teststore.cpp b/tests/teststore.cpp index d76ca64..ea3ad10 100644 --- a/tests/teststore.cpp +++ b/tests/teststore.cpp @@ -17,7 +17,7 @@ private slots: QString testKey = "testKey"; QString testValue = "testValue"; store->setValue(testKey, testValue); - QCOMPARE(store->value(testKey), testValue); + QCOMPARE(store->value(testKey), "testValuexx"); } void testGroupKey() {