aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml62
-rw-r--r--CMakeLists.txt79
-rw-r--r--autotests/callcandidateseventtest.cpp18
-rw-r--r--autotests/callcandidateseventtest.h13
-rw-r--r--quotest/CMakeLists.txt8
5 files changed, 93 insertions, 87 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d121e432..fd6f489e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -45,25 +45,36 @@ jobs:
version: '5.9.9'
cached: ${{ steps.cache-qt.outputs.cache-hit }}
- - name: Install Valgrind
- if: contains(matrix.os, 'ubuntu')
+ - name: Install Ninja (macOS)
+ if: ${{ !startsWith(matrix.os, 'ubuntu') }}
+ uses: seanmiddleditch/gha-setup-ninja@v3
+
+ - name: Install Ninja and Valgrind (Linux)
+ if: startsWith(matrix.os, 'ubuntu')
run: |
- sudo apt-get install valgrind
- echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=tests/.valgrind.supp" >>$GITHUB_ENV
+ sudo apt-get -qq install ninja-build valgrind
+ echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=quotest/.valgrind.supp" >>$GITHUB_ENV
- name: Setup build environment
run: |
if [ "${{ matrix.compiler }}" == "GCC" ]; then
- if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-8'; fi
- echo "CC=gcc$VERSION_POSTFIX" >>$GITHUB_ENV
- echo "CXX=g++$VERSION_POSTFIX" >>$GITHUB_ENV
+ if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-8'; fi
+ echo "CC=gcc$VERSION_POSTFIX" >>$GITHUB_ENV
+ echo "CXX=g++$VERSION_POSTFIX" >>$GITHUB_ENV
+ else
+ echo "CC=clang" >>$GITHUB_ENV
+ echo "CXX=clang++" >>$GITHUB_ENV
+ fi
+ if grep -q 'refs/tags' <<<'${{ github.ref }}'; then
+ VERSION="$(git describe --tags)"
+ elif [ '${{ github.ref }}' == 'refs/heads/master' ]; then
+ VERSION="ci${{ github.run_number }}-$(git rev-parse --short HEAD)"
else
- echo "CC=clang" >>$GITHUB_ENV
- echo "CXX=clang++" >>$GITHUB_ENV
+ VERSION="$(git describe --all --contains)-ci${{ github.run_number }}-$(git rev-parse --short HEAD)"
fi
- echo "QUOTEST_ORIGIN=${{ runner.os }}/${{ matrix.compiler }}" >>$GITHUB_ENV
- echo "DESTDIR=${{ runner.workspace }}" >>$GITHUB_ENV
- echo "CMAKE_ARGS=-DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=${{ runner.workspace }}/usr" >>$GITHUB_ENV
+ echo "QUOTEST_ORIGIN=$VERSION @ ${{ runner.os }}/${{ matrix.compiler }}" >>$GITHUB_ENV
+ echo "CMAKE_ARGS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=false \
+ -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local" >>$GITHUB_ENV
cmake -E make_directory ${{ runner.workspace }}/build
- name: Build and install olm
@@ -71,10 +82,8 @@ jobs:
run: |
cd ${{ runner.workspace }}
git clone https://gitlab.matrix.org/matrix-org/olm.git
- pushd olm
- cmake . -B build $CMAKE_ARGS
- cmake --build build --target install
- popd
+ cmake -S olm -B olm/build $CMAKE_ARGS
+ cmake --build olm/build --target install
echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with E2EE" >>$GITHUB_ENV
- name: Pull CS API and build GTAD
@@ -83,11 +92,11 @@ jobs:
cd ${{ runner.workspace }}
git clone https://github.com/matrix-org/matrix-doc.git
git clone --recursive https://github.com/KitsuneRal/gtad.git
- pushd gtad
- cmake . $CMAKE_ARGS
- cmake --build .
- popd
- echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=${{ runner.workspace }}/matrix-doc -DGTAD_PATH=${{ runner.workspace }}/gtad/gtad" >>$GITHUB_ENV
+ cmake -S gtad -B gtad $CMAKE_ARGS
+ cmake --build gtad
+ echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=${{ runner.workspace }}/matrix-doc \
+ -DGTAD_PATH=${{ runner.workspace }}/gtad/gtad" \
+ >>$GITHUB_ENV
echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN and API files regeneration" >>$GITHUB_ENV
- name: Configure libQuotient
@@ -98,17 +107,14 @@ jobs:
run: cmake --build build --target update-api
- name: Build and install libQuotient
- run: cmake --build build --target install
-
- - name: Build tests
run: |
- cmake -S quotest -Bbuild-quotest $CMAKE_ARGS
- cmake --build build-quotest --target all
-
+ cmake --build build --target install
+ ls ~/.local/bin/quotest
+
- name: Run tests
env:
TEST_USER: ${{ secrets.TEST_USER }}
TEST_PWD: ${{ secrets.TEST_PWD }}
run: |
- [[ -z "$TEST_USER" ]] || $VALGRIND build-quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN"
+ [[ -z "$TEST_USER" ]] || $VALGRIND build/quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN"
timeout-minutes: 5 # quotest is supposed to finish within 3 minutes, actually
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bc3a559..39b1b03a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,10 +10,7 @@ message(STATUS)
message(STATUS "Configuring ${PROJECT_NAME} ${PROJECT_VERSION} ==>")
include(FeatureSummary)
-
-option(${PROJECT_NAME}_INSTALL_TESTS "install quotest (former qmc-example) application" ON)
-add_feature_info(InstallQuotest ${PROJECT_NAME}_INSTALL_TESTS
- "the library functional test suite")
+include(CTest)
# https://github.com/quotient-im/libQuotient/issues/369
option(${PROJECT_NAME}_ENABLE_E2EE "end-to-end encryption (E2EE) support" OFF)
@@ -114,36 +111,6 @@ if (${PROJECT_NAME}_ENABLE_E2EE)
endif ()
endif ()
-if (GTAD_PATH)
- get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" REALPATH)
-endif ()
-if (MATRIX_DOC_PATH)
- get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH)
-endif ()
-if (ABS_GTAD_PATH AND ABS_API_DEF_PATH)
- message( STATUS "Using GTAD at ${ABS_GTAD_PATH}" )
- message( STATUS "Using API files at ${ABS_API_DEF_PATH}" )
- set(API_GENERATION_ENABLED 1)
- if (NOT CLANG_FORMAT)
- set(CLANG_FORMAT clang-format)
- endif()
- get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM)
- if (ABS_CLANG_FORMAT)
- set(API_FORMATTING_ENABLED 1)
- message( STATUS "clang-format is at ${ABS_CLANG_FORMAT}")
- else ()
- message( STATUS "${CLANG_FORMAT} is NOT FOUND; API files won't be reformatted")
- endif ()
-endif()
-add_feature_info(EnableApiCodeGeneration "${API_GENERATION_ENABLED}"
- "build target update-api")
-add_feature_info(EnableApiFormatting "${API_FORMATTING_ENABLED}"
- "formatting of generated API files with clang-format")
-
-message(STATUS)
-feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
- FATAL_ON_MISSING_REQUIRED_PACKAGES)
-
# Set up source files
set(lib_SRCS
lib/networkaccessmanager.cpp
@@ -191,12 +158,34 @@ set(lib_SRCS
lib/jobs/downloadfilejob.cpp
)
+# Configure API files generation
+
set(CSAPI_DIR csapi)
set(FULL_CSAPI_DIR lib/${CSAPI_DIR})
set(ASAPI_DEF_DIR application-service/definitions)
set(ISAPI_DEF_DIR identity/definitions)
-if (MATRIX_DOC_PATH AND GTAD_PATH)
+if (GTAD_PATH)
+ get_filename_component(ABS_GTAD_PATH "${GTAD_PATH}" REALPATH)
+endif ()
+if (MATRIX_DOC_PATH)
+ get_filename_component(ABS_API_DEF_PATH "${MATRIX_DOC_PATH}/api" REALPATH)
+endif ()
+if (ABS_GTAD_PATH AND ABS_API_DEF_PATH)
+ message( STATUS "Using GTAD at ${ABS_GTAD_PATH}" )
+ message( STATUS "Using API files at ${ABS_API_DEF_PATH}" )
+ set(API_GENERATION_ENABLED 1)
+ if (NOT CLANG_FORMAT)
+ set(CLANG_FORMAT clang-format)
+ endif()
+ get_filename_component(ABS_CLANG_FORMAT "${CLANG_FORMAT}" PROGRAM)
+ if (ABS_CLANG_FORMAT)
+ set(API_FORMATTING_ENABLED 1)
+ message( STATUS "clang-format is at ${ABS_CLANG_FORMAT}")
+ else ()
+ message( STATUS "${CLANG_FORMAT} is NOT FOUND; API files won't be reformatted")
+ endif ()
+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.12.0")
# We use globbing with CONFIGURE_DEPENDS to produce two file lists:
# one of all API files for clang-format and another of just .cpp
@@ -249,6 +238,10 @@ if (MATRIX_DOC_PATH AND GTAD_PATH)
endif()
endif()
endif()
+add_feature_info(EnableApiCodeGeneration "${API_GENERATION_ENABLED}"
+ "build target update-api")
+add_feature_info(EnableApiFormatting "${API_FORMATTING_ENABLED}"
+ "formatting of generated API files with clang-format")
# Make no mistake: CMake cannot run gtad first and then populate the list of
# resulting api_SRCS files. In other words, placing the below statement after
@@ -288,15 +281,17 @@ if (${PROJECT_NAME}_ENABLE_E2EE)
endif()
target_link_libraries(${PROJECT_NAME} Qt5::Core Qt5::Network Qt5::Gui Qt5::Multimedia)
+configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX)
+
+# Configure testing
+
if (BUILD_TESTING)
enable_testing()
add_subdirectory(quotest)
add_subdirectory(autotests)
endif()
-configure_file(${PROJECT_NAME}.pc.in ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc @ONLY NEWLINE_STYLE UNIX)
-
-# Installation
+# Configure installation
install(TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
@@ -337,13 +332,13 @@ if (WIN32)
install(FILES mime/packages/freedesktop.org.xml DESTINATION mime/packages)
endif (WIN32)
-if (${PROJECT_NAME}_INSTALL_TESTS)
- install(TARGETS ${TEST_BINARY} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
-endif ()
-
if (UNIX AND NOT APPLE)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
endif()
+message(STATUS)
+feature_summary(WHAT ENABLED_FEATURES DISABLED_FEATURES
+ FATAL_ON_MISSING_REQUIRED_PACKAGES)
+
message(STATUS "<== End of libQuotient configuration")
diff --git a/autotests/callcandidateseventtest.cpp b/autotests/callcandidateseventtest.cpp
index f103e4d3..1a69cb66 100644
--- a/autotests/callcandidateseventtest.cpp
+++ b/autotests/callcandidateseventtest.cpp
@@ -3,7 +3,16 @@
// SPDX-License-Identifier: LGPL-2.1-or-later
#include "events/callcandidatesevent.h"
-#include "callcandidateseventtest.h"
+
+#include <QtTest/QtTest>
+
+class TestCallCandidatesEvent : public QObject
+{
+ Q_OBJECT
+
+private Q_SLOTS:
+ void fromJson();
+};
void TestCallCandidatesEvent::fromJson()
{
@@ -34,13 +43,14 @@ void TestCallCandidatesEvent::fromJson()
Quotient::CallCandidatesEvent callCandidatesEvent(object);
QCOMPARE(callCandidatesEvent.version(), 0);
- QCOMPARE(callCandidatesEvent.callId(), "12345");
+ QCOMPARE(callCandidatesEvent.callId(), QStringLiteral("12345"));
QCOMPARE(callCandidatesEvent.candidates().count(), 1);
const QJsonObject &candidate = callCandidatesEvent.candidates().at(0).toObject();
- QCOMPARE(candidate.value("sdpMid").toString(), "audio");
+ QCOMPARE(candidate.value("sdpMid").toString(), QStringLiteral("audio"));
QCOMPARE(candidate.value("sdpMLineIndex").toInt(), 0);
- QCOMPARE(candidate.value("candidate").toString(), "candidate:863018703 1 udp 2122260223 10.9.64.156 43670 typ host generation 0");
+ QCOMPARE(candidate.value("candidate").toString(),
+ QStringLiteral("candidate:863018703 1 udp 2122260223 10.9.64.156 43670 typ host generation 0"));
}
QTEST_MAIN(TestCallCandidatesEvent)
diff --git a/autotests/callcandidateseventtest.h b/autotests/callcandidateseventtest.h
deleted file mode 100644
index b81c9c9b..00000000
--- a/autotests/callcandidateseventtest.h
+++ /dev/null
@@ -1,13 +0,0 @@
-// SPDX-FileCopyrightText: 2020 Carl Schwan <carlschwan@kde.org>
-//
-// SPDX-License-Identifier: LGPL-2.1-or-later
-
-#include <QtTest/QtTest>
-
-class TestCallCandidatesEvent : public QObject
-{
- Q_OBJECT
-
-private Q_SLOTS:
- void fromJson();
-};
diff --git a/quotest/CMakeLists.txt b/quotest/CMakeLists.txt
index d17e8620..29c53fae 100644
--- a/quotest/CMakeLists.txt
+++ b/quotest/CMakeLists.txt
@@ -6,3 +6,11 @@ set(quotest_SRCS quotest.cpp)
add_executable(quotest ${quotest_SRCS})
target_link_libraries(quotest PRIVATE Qt5::Core Qt5::Test ${PROJECT_NAME})
+
+option(${PROJECT_NAME}_INSTALL_TESTS "install quotest (former qmc-example) application" ON)
+add_feature_info(InstallQuotest ${PROJECT_NAME}_INSTALL_TESTS
+ "the library functional test suite")
+
+if (${PROJECT_NAME}_INSTALL_TESTS)
+ install(TARGETS quotest RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
+endif ()