From 617514cf9da4d444c285ebb27ff1c7fd034a484f Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Fri, 20 May 2022 22:24:41 +0200 Subject: Adapt update-api target to matrix-doc split --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b704b3b9..9b9383db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -179,11 +179,11 @@ jobs: if: matrix.update-api working-directory: ${{ runner.workspace }} run: | - git clone https://github.com/matrix-org/matrix-doc.git + git clone https://github.com/quotient-im/matrix-spec.git git clone --recursive https://github.com/KitsuneRal/gtad.git cmake -S gtad -B build/gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF cmake --build build/gtad - echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=${{ runner.workspace }}/matrix-doc \ + echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_SPEC_PATH=${{ runner.workspace }}/matrix-spec \ -DGTAD_PATH=${{ runner.workspace }}/build/gtad/gtad" \ >>$GITHUB_ENV echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with API files regeneration" >>$GITHUB_ENV -- cgit v1.2.3 From 4e127d5f74c56b1e366de3e8afb7f07700a566b4 Mon Sep 17 00:00:00 2001 From: Tobias Fella Date: Sat, 21 May 2022 16:29:00 +0200 Subject: Use branch of matrix-spec --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9b9383db..bea9f436 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,6 +180,9 @@ jobs: working-directory: ${{ runner.workspace }} run: | git clone https://github.com/quotient-im/matrix-spec.git + pushd matrix-spec + git checkout fixcompilation + popd git clone --recursive https://github.com/KitsuneRal/gtad.git cmake -S gtad -B build/gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF cmake --build build/gtad -- cgit v1.2.3 From 6e27a49fbbc58a7310753f882fe372ddb0f63e33 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 30 May 2022 17:41:41 +0200 Subject: CI: Build with QtKeychain 0.13.2 QtKeychain master suffers from https://github.com/frankosterfeld/qtkeychain/issues/213. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b704b3b9..c690745f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -171,7 +171,7 @@ jobs: - name: Build and install QtKeychain run: | cd .. - git clone https://github.com/frankosterfeld/qtkeychain.git + git clone -b v0.13.2 https://github.com/frankosterfeld/qtkeychain.git cmake -S qtkeychain -B qtkeychain/build $CMAKE_ARGS cmake --build qtkeychain/build --target install -- cgit v1.2.3 From 3c6ca3c89d7b1a972d50ec4eb0b42ab350771f72 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 31 May 2022 17:36:17 +0200 Subject: Update gtad.yml to match v3 API definitions Also: use quotient-im/matrix-spec main branch again, now that it has adjusted definitions; drop un(der)used partials --- .github/workflows/ci.yml | 3 --- gtad/gtad.yaml | 17 +++++------------ 2 files changed, 5 insertions(+), 15 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bea9f436..9b9383db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -180,9 +180,6 @@ jobs: working-directory: ${{ runner.workspace }} run: | git clone https://github.com/quotient-im/matrix-spec.git - pushd matrix-spec - git checkout fixcompilation - popd git clone --recursive https://github.com/KitsuneRal/gtad.git cmake -S gtad -B build/gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF cmake --build build/gtad diff --git a/gtad/gtad.yaml b/gtad/gtad.yaml index 03c23886..e8d4ba35 100644 --- a/gtad/gtad.yaml +++ b/gtad/gtad.yaml @@ -85,9 +85,8 @@ analyzer: imports: '"events/eventloader.h"' +on: - /state_event.yaml$/: StateEventPtr - - /room_event.yaml$/: RoomEventPtr - - /event.yaml$/: EventPtr - - /m\.room\.member/: void # Skip resolving; see EventsArray<> below + - /(room|client)_event.yaml$/: RoomEventPtr + - /event(_without_room_id)?.yaml$/: EventPtr - +set: # This renderer actually applies to all $ref things _importRenderer: '"{{#segments}}{{_}}{{#_join}}/{{/_join}}{{/segments}}.h"' @@ -115,12 +114,9 @@ analyzer: - /^Notification|Result$/: type: "std::vector<{{1}}>" imports: '"events/eventloader.h"' - - /m\.room\.member/: # Only used in an array (see also above) - type: "EventsArray" - imports: '"events/roommemberevent.h"' - /state_event.yaml$/: StateEvents - - /room_event.yaml$/: RoomEvents - - /event.yaml$/: Events + - /(room|client)_event.yaml$/: RoomEvents + - /event(_without_room_id)?.yaml$/: Events - //: "QVector<{{1}}>" - map: # `additionalProperties` in OpenAPI - RoomState: @@ -164,11 +160,8 @@ mustache: qualifiedMaybeOmittableType: "{{>openOmittable}}{{dataType.qualifiedName}}{{>closeOmittable}}" - ref: "{{#avoidCopy}}&{{/avoidCopy}}{{#moveOnly}}&&{{/moveOnly}}" maybeCrefType: - "{{#avoidCopy}}const {{/avoidCopy}}{{>maybeOmittableType}}{{>ref}}" - qualifiedMaybeCrefType: - "{{#avoidCopy}}const {{/avoidCopy}}{{>qualifiedMaybeOmittableType}}{{>ref}}" + "{{#avoidCopy}}const {{/avoidCopy}}{{>maybeOmittableType}}{{#avoidCopy}}&{{/avoidCopy}}" maybeCrefJsonObject: "{{^propertyMap}}const QJsonObject&{{/propertyMap}}\ -- cgit v1.2.3 From a2ba9119c6b20d227f75e9a3427df06b4923ee89 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 6 Jun 2022 14:01:39 +0200 Subject: CI: use GTAD submodule Also: make all cloning for update-api shallow, for optimisation. --- .github/workflows/ci.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dac67b3b..9c777cbc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,14 +175,13 @@ jobs: cmake -S qtkeychain -B qtkeychain/build $CMAKE_ARGS cmake --build qtkeychain/build --target install - - name: Pull CS API and build GTAD + - name: get CS API definitions; clone and build GTAD if: matrix.update-api - working-directory: ${{ runner.workspace }} run: | - git clone https://github.com/quotient-im/matrix-spec.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - cmake -S gtad -B build/gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - cmake --build build/gtad + git clone --depth=1 https://github.com/quotient-im/matrix-spec.git ../matrix-spec + git submodule update --init --recursive --depth=1 + cmake -S gtad/gtad -B ../build/gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + cmake --build ../build/gtad echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_SPEC_PATH=${{ runner.workspace }}/matrix-spec \ -DGTAD_PATH=${{ runner.workspace }}/build/gtad/gtad" \ >>$GITHUB_ENV -- cgit v1.2.3 From 9e594bd1d49dc0e1fdb8b74cef11fe3bfa3fdc1e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 12 Jun 2022 10:32:40 +0200 Subject: CI: No more allow failure of update-api jobs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c777cbc..3422b5b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ concurrency: ci-${{ github.ref }} jobs: CI: runs-on: ${{ matrix.os }} - continue-on-error: ${{ matrix.update-api != '' }} # the current upstream API definitions are expected to fail the test + continue-on-error: false strategy: fail-fast: false max-parallel: 1 -- cgit v1.2.3 From 7d4b46e6daf656a1e97426cb1f2f8c99c68c4dda Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 12 Jun 2022 14:16:12 +0200 Subject: Reduce the number of CI jobs It takes well over an hour to build the whole lineup for now; while the single right fix for that is making quotest capable of running in parallel, a few GCC jobs can be safely dropped for now (and we'll see if they should be brought back when parallel quotest unleashes the CI). --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9c777cbc..99fe7b7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: max-parallel: 1 matrix: os: [ ubuntu-20.04, macos-10.15 ] - compiler: [ GCC, Clang ] + compiler: [ Clang ] # GCC builds are added individually below qt-version: [ '5.12.12' ] # Not using binary values here, to make the job captions more readable e2ee: [ '', e2ee ] @@ -29,8 +29,6 @@ jobs: platform: [ '' ] qt-arch: [ '' ] exclude: - - os: macos-10.15 - compiler: GCC - os: windows-2019 e2ee: e2ee # Not supported by the current CI script - os: macos-10.15 @@ -41,6 +39,11 @@ jobs: qt-version: '5.12.12' e2ee: e2ee sonar: sonar + - os: ubuntu-20.04 + compiler: GCC + qt-version: '5.12.12' + e2ee: e2ee + update-api: update-api - os: windows-2019 compiler: MSVC platform: x64 -- cgit v1.2.3 From a4f0071395939a93bcb3afd72085415a25216701 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 14 Jun 2022 10:28:51 +0200 Subject: CI: bump used versions for GitHub Actions Also, use MSVC 2019 on Windows. --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 172c027f..212273bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -48,12 +48,12 @@ jobs: compiler: MSVC platform: x64 qt-version: '5.12.12' - qt-arch: win64_msvc2017_64 + qt-arch: win64_msvc2019_64 - os: windows-2019 compiler: MSVC platform: x64 qt-version: '5.12.12' - qt-arch: win64_msvc2017_64 + qt-arch: win64_msvc2019_64 update-api: update-api env: @@ -72,7 +72,7 @@ jobs: key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache - name: Install Qt - uses: jurplel/install-qt-action@v2.11.1 + uses: jurplel/install-qt-action@v2.14.0 with: version: ${{ matrix.qt-version }} arch: ${{ matrix.qt-arch }} @@ -192,7 +192,7 @@ jobs: - name: Initialize CodeQL tools if: env.CODEQL_ANALYSIS - uses: github/codeql-action/init@v1 + uses: github/codeql-action/init@v2 with: languages: cpp # If you wish to specify custom queries, you can do so here or in a config file. @@ -235,7 +235,7 @@ jobs: - name: Perform CodeQL analysis if: env.CODEQL_ANALYSIS - uses: github/codeql-action/analyze@v1 + uses: github/codeql-action/analyze@v2 - name: Run sonar-scanner if: matrix.sonar != '' -- cgit v1.2.3 From b55c110ecbca5ad41ac9ccb5647836709ac8f4a8 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 14 Jun 2022 11:40:34 +0200 Subject: CI: Switch to Qt 5.15 and introduce Qt 6 options Qt 6 builds are allowed to fail for now. --- .github/workflows/ci.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 212273bd..d46cfb6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,14 +14,14 @@ concurrency: ci-${{ github.ref }} jobs: CI: runs-on: ${{ matrix.os }} - continue-on-error: false + continue-on-error: ${{ matrix.qt-version != '5.15.2' }} # Qt 6 will fail for now strategy: fail-fast: false max-parallel: 1 matrix: os: [ ubuntu-20.04, macos-10.15 ] compiler: [ Clang ] # GCC builds are added individually below - qt-version: [ '5.12.12' ] + qt-version: [ '5.15.2', '6.3.1' ] # Not using binary values here, to make the job captions more readable e2ee: [ '', e2ee ] update-api: [ '', update-api ] @@ -29,6 +29,8 @@ jobs: platform: [ '' ] qt-arch: [ '' ] exclude: + - qt-version: '6.3.1' + update-api: update-api - os: windows-2019 e2ee: e2ee # Not supported by the current CI script - os: macos-10.15 @@ -36,23 +38,23 @@ jobs: include: - os: ubuntu-latest compiler: GCC - qt-version: '5.12.12' + qt-version: '5.15.2' e2ee: e2ee sonar: sonar - os: ubuntu-20.04 compiler: GCC - qt-version: '5.12.12' + qt-version: '5.15.2' e2ee: e2ee update-api: update-api - os: windows-2019 compiler: MSVC platform: x64 - qt-version: '5.12.12' + qt-version: '5.15.2' qt-arch: win64_msvc2019_64 - os: windows-2019 compiler: MSVC platform: x64 - qt-version: '5.12.12' + qt-version: '5.15.2' qt-arch: win64_msvc2019_64 update-api: update-api -- cgit v1.2.3 From da5156f5e2da08123549b554d9eafcf366fa4e11 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 14 Jun 2022 18:13:39 +0200 Subject: Rearrange CI jobs to spend time more efficiently - CodeQL analysis was executed on every job that ran Clang, humping the total execution time by 10+ minutes alone. Now it only runs on a single job. - libolm is no more compiled but installed from the repo, along with libssl-dev; and both are installed in the same transaction as ninja and valgrind, shaving out one apt transaction - One more Windows job has been added to test building with Qt 6.3.1 on that OS. - Qt version is pushed earlier in the job matrix, as it becomes more significant than the compiler for a given platform. --- .github/workflows/ci.yml | 144 +++++++++++++++++++++++------------------------ 1 file changed, 71 insertions(+), 73 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d46cfb6c..ab581238 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,43 +20,59 @@ jobs: max-parallel: 1 matrix: os: [ ubuntu-20.04, macos-10.15 ] - compiler: [ Clang ] # GCC builds are added individually below qt-version: [ '5.15.2', '6.3.1' ] + compiler: [ LLVM ] # Not using binary values here, to make the job captions more readable e2ee: [ '', e2ee ] update-api: [ '', update-api ] - sonar: [ '' ] + static-analysis: [ '' ] platform: [ '' ] qt-arch: [ '' ] exclude: - qt-version: '6.3.1' - update-api: update-api - - os: windows-2019 - e2ee: e2ee # Not supported by the current CI script + update-api: update-api # Generated code is not specific to Qt version + - os: ubuntu-20.04 + e2ee: e2ee # Will be re-added with static analysis below + # TODO: Enable E2EE on Windows and macOS - os: macos-10.15 - e2ee: e2ee # Missing OpenSSL + e2ee: e2ee include: + - os: windows-2019 + qt-version: '5.15.2' + compiler: MSVC + platform: x64 + qt-arch: win64_msvc2019_64 + - os: ubuntu-20.04 + qt-version: '5.15.2' + compiler: LLVM + e2ee: e2ee + static-analysis: codeql - os: ubuntu-latest - compiler: GCC qt-version: '5.15.2' + compiler: GCC e2ee: e2ee - sonar: sonar + static-analysis: sonar - os: ubuntu-20.04 - compiler: GCC qt-version: '5.15.2' + compiler: GCC e2ee: e2ee update-api: update-api + - os: ubuntu-20.04 + qt-version: '5.15.2' + compiler: LLVM + update-api: update-api - os: windows-2019 + qt-version: '6.3.1' compiler: MSVC + # e2ee: e2ee # TODO platform: x64 - qt-version: '5.15.2' qt-arch: win64_msvc2019_64 - os: windows-2019 + qt-version: '5.15.2' compiler: MSVC + update-api: update-api platform: x64 - qt-version: '5.15.2' qt-arch: win64_msvc2019_64 - update-api: update-api env: SONAR_SERVER_URL: 'https://sonarcloud.io' @@ -66,44 +82,14 @@ jobs: with: fetch-depth: 0 - - name: Cache Qt - id: cache-qt - uses: actions/cache@v2 - with: - path: ${{ runner.workspace }}/Qt - key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache - - - name: Install Qt - uses: jurplel/install-qt-action@v2.14.0 - with: - version: ${{ matrix.qt-version }} - arch: ${{ matrix.qt-arch }} - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - - name: Install Ninja (macOS/Windows) - 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 -qq install ninja-build valgrind - echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=$GITHUB_WORKSPACE/quotest/.valgrind.supp" >>$GITHUB_ENV - - name: Setup build environment run: | - if [ "${{ matrix.compiler }}" == "GCC" ]; then - CXX_VERSION_POSTFIX='-10' - echo "CC=gcc$CXX_VERSION_POSTFIX" >>$GITHUB_ENV - echo "CXX=g++$CXX_VERSION_POSTFIX" >>$GITHUB_ENV - elif [[ '${{ matrix.compiler }}' == 'Clang' ]]; then - if [[ '${{ runner.os }}' == 'Linux' ]]; then - CXX_VERSION_POSTFIX='-11' - # Do CodeQL analysis on one of Linux branches - echo "CODEQL_ANALYSIS=true" >>$GITHUB_ENV - fi - echo "CC=clang$CXX_VERSION_POSTFIX" >>$GITHUB_ENV - echo "CXX=clang++$CXX_VERSION_POSTFIX" >>$GITHUB_ENV + if [ '${{ matrix.compiler }}' == 'GCC' ]; then + echo "CC=gcc-10" >>$GITHUB_ENV + echo "CXX=g++-10" >>$GITHUB_ENV + elif [[ '${{ runner.os }}' != 'Windows' ]]; then + echo "CC=clang" >>$GITHUB_ENV + echo "CXX=clang++" >>$GITHUB_ENV fi if grep -q 'refs/tags' <<<'${{ github.ref }}'; then VERSION="$(git describe --tags)" @@ -112,20 +98,18 @@ jobs: else VERSION="$(git describe --all --contains)-ci${{ github.run_number }}-$(git rev-parse --short HEAD)" fi - echo "QUOTEST_ORIGIN=$VERSION @ ${{ runner.os }}/${{ matrix.compiler }}" >>$GITHUB_ENV - # Build libQuotient as a shared library across platforms but also - # check the static configuration somewhere + echo "QUOTEST_ORIGIN=$VERSION @ ${{ runner.os }}/Qt-${{ matrix.qt-version }}/${{ matrix.compiler }}" >>$GITHUB_ENV + CMAKE_ARGS="-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ -DBUILD_SHARED_LIBS=${{ runner.os == 'Linux' }} \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DCMAKE_PREFIX_PATH=~/.local \ -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" - if [ -n "${{ matrix.sonar }}" ]; then + if [ '${{ matrix.static-analysis }}' == 'sonar' ]; then mkdir -p $HOME/.sonar CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=--coverage" - echo "COV=gcov$CXX_VERSION_POSTFIX" >>$GITHUB_ENV fi echo "CMAKE_ARGS=$CMAKE_ARGS" >>$GITHUB_ENV @@ -139,14 +123,42 @@ jobs: cmake -E make_directory ${{ runner.workspace }}/build echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV - - name: Setup MSVC environment + - name: Cache Qt + id: cache-qt + uses: actions/cache@v2 + with: + path: ${{ runner.workspace }}/Qt + key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache + + - name: Install Qt + uses: jurplel/install-qt-action@v2.14.0 + with: + version: ${{ matrix.qt-version }} + arch: ${{ matrix.qt-arch }} + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + - name: Install Ninja (macOS/Windows) + if: ${{ !startsWith(matrix.os, 'ubuntu') }} + uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Install dependencies (Linux) + if: startsWith(matrix.os, 'ubuntu') + run: | + if [ -n "${{ matrix.e2ee }}" ]; then + EXTRA_DEPS="libssl-dev libolm-dev" + echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with E2EE" >>$GITHUB_ENV + fi + sudo apt-get -qq install ninja-build valgrind $EXTRA_DEPS + echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=$GITHUB_WORKSPACE/quotest/.valgrind.supp" >>$GITHUB_ENV + + - name: Setup MSVC uses: ilammy/msvc-dev-cmd@v1 if: matrix.compiler == 'MSVC' with: arch: ${{ matrix.platform }} - name: Download and set up Sonar Cloud tools - if: matrix.sonar != '' + if: matrix.static-analysis == 'sonar' env: SONAR_SCANNER_VERSION: 4.6.2.2472 run: | @@ -159,20 +171,6 @@ jobs: unzip -o sonar-scanner-cli*.zip popd - - name: Install OpenSSL - if: ${{ contains(matrix.os, 'ubuntu') && matrix.e2ee }} - run: | - sudo apt-get install libssl-dev - - - name: Build and install olm - if: matrix.e2ee - working-directory: ${{ runner.workspace }} - run: | - git clone https://gitlab.matrix.org/matrix-org/olm.git - cmake -S olm -B build/olm $CMAKE_ARGS - cmake --build build/olm --target install - echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with E2EE" >>$GITHUB_ENV - - name: Build and install QtKeychain run: | cd .. @@ -193,7 +191,7 @@ jobs: echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with API files regeneration" >>$GITHUB_ENV - name: Initialize CodeQL tools - if: env.CODEQL_ANALYSIS + if: matrix.static-analysis == 'codeql' uses: github/codeql-action/init@v2 with: languages: cpp @@ -236,18 +234,18 @@ jobs: timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually - name: Perform CodeQL analysis - if: env.CODEQL_ANALYSIS + if: matrix.static-analysis == 'codeql' uses: github/codeql-action/analyze@v2 - name: Run sonar-scanner - if: matrix.sonar != '' + if: matrix.static-analysis == 'sonar' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | mkdir .coverage && pushd .coverage find $BUILD_PATH -name '*.gcda' -print0 \ - | xargs -0 $COV -s $GITHUB_WORKSPACE -pr + | xargs -0 gcov -s $GITHUB_WORKSPACE -pr # Coverage of the test source code is not tracked, as it is always 100% # (if not, some tests failed and broke the build at an earlier stage) rm -f quotest* autotests* -- cgit v1.2.3 From 2504e6e5f216e34fc9aabfda0c462b1b37620a5e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 17 Jun 2022 10:40:49 +0200 Subject: Further fix building with Qt 6 Also: build with Qt 6 first, so that it fails sooner. --- .github/workflows/ci.yml | 5 +++-- lib/accountregistry.h | 25 +++++++++++++------------ lib/avatar.cpp | 8 ++++---- lib/connection.cpp | 4 ++-- lib/room.cpp | 4 ++-- 5 files changed, 24 insertions(+), 22 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab581238..f03af94b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,7 +20,7 @@ jobs: max-parallel: 1 matrix: os: [ ubuntu-20.04, macos-10.15 ] - qt-version: [ '5.15.2', '6.3.1' ] + qt-version: [ '6.3.1', '5.15.2' ] compiler: [ LLVM ] # Not using binary values here, to make the job captions more readable e2ee: [ '', e2ee ] @@ -105,7 +105,8 @@ jobs: -DBUILD_SHARED_LIBS=${{ runner.os == 'Linux' }} \ -DCMAKE_INSTALL_PREFIX=~/.local \ -DCMAKE_PREFIX_PATH=~/.local \ - -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON \ + -DBUILD_WITH_QT6=${{ startsWith(matrix.qt-version, '6') }}" if [ '${{ matrix.static-analysis }}' == 'sonar' ]; then mkdir -p $HOME/.sonar diff --git a/lib/accountregistry.h b/lib/accountregistry.h index 38cfe6c6..9560688e 100644 --- a/lib/accountregistry.h +++ b/lib/accountregistry.h @@ -31,8 +31,9 @@ class QUOTIENT_API AccountRegistry : public QAbstractListModel, /// Can be used to inform the user or to show a login screen if size() == 0 and no accounts are loaded Q_PROPERTY(QStringList accountsLoading READ accountsLoading NOTIFY accountsLoadingChanged) public: - using const_iterator = QVector::const_iterator; - using const_reference = QVector::const_reference; + using vector_t = QVector; + using const_iterator = vector_t::const_iterator; + using const_reference = vector_t::const_reference; enum EventRoles { AccountRole = Qt::UserRole + 1, @@ -42,24 +43,24 @@ public: [[deprecated("Use Accounts variable instead")]] // static AccountRegistry& instance(); - // Expose most of QVector's const-API but only provide add() and drop() + // Expose most of vector_t's const-API but only provide add() and drop() // for changing it. In theory other changing operations could be supported // too; but then boilerplate begin/end*() calls has to be tucked into each // and this class gives no guarantees on the order of entries, so why care. - const QVector& accounts() const { return *this; } + const vector_t& accounts() const { return *this; } void add(Connection* a); void drop(Connection* a); - const_iterator begin() const { return QVector::begin(); } - const_iterator end() const { return QVector::end(); } - const_reference front() const { return QVector::front(); } - const_reference back() const { return QVector::back(); } + const_iterator begin() const { return vector_t::begin(); } + const_iterator end() const { return vector_t::end(); } + const_reference front() const { return vector_t::front(); } + const_reference back() const { return vector_t::back(); } bool isLoggedIn(const QString& userId) const; Connection* get(const QString& userId); - using QVector::isEmpty, QVector::empty; - using QVector::size, QVector::count, QVector::capacity; - using QVector::cbegin, QVector::cend, QVector::contains; + using vector_t::isEmpty, vector_t::empty; + using vector_t::size, vector_t::count, vector_t::capacity; + using vector_t::cbegin, vector_t::cend, vector_t::contains; // QAbstractItemModel interface implementation @@ -88,4 +89,4 @@ private: inline QUOTIENT_API AccountRegistry Accounts {}; inline AccountRegistry& AccountRegistry::instance() { return Accounts; } -} +} // namespace Quotient diff --git a/lib/avatar.cpp b/lib/avatar.cpp index 9304a3de..13de99bf 100644 --- a/lib/avatar.cpp +++ b/lib/avatar.cpp @@ -39,7 +39,7 @@ public: // The below are related to image caching, hence mutable mutable QImage _originalImage; - mutable std::vector> _scaledImages; + mutable std::vector> _scaledImages; mutable QSize _requestedSize; mutable enum { Unknown, Cache, Network, Banned } _imageSource = Unknown; mutable QPointer _thumbnailRequest = nullptr; @@ -124,9 +124,9 @@ QImage Avatar::Private::get(Connection* connection, QSize size, }); } - for (const auto& p : _scaledImages) - if (p.first == size) - return p.second; + for (const auto& [scaledSize, scaledImage] : _scaledImages) + if (scaledSize == size) + return scaledImage; auto result = _originalImage.isNull() ? QImage() : _originalImage.scaled(size, Qt::KeepAspectRatio, diff --git a/lib/connection.cpp b/lib/connection.cpp index 3e44513b..c390cc05 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -92,7 +92,7 @@ public: // state is Invited. The spec mandates to keep Invited room state // separately; specifically, we should keep objects for Invite and // Leave state of the same room if the two happen to co-exist. - QHash, Room*> roomMap; + QHash, Room*> roomMap; /// Mapping from serverparts to alias/room id mappings, /// as of the last sync QHash roomAliasMap; @@ -1707,7 +1707,7 @@ Room* Connection::provideRoom(const QString& id, Omittable joinState) Q_ASSERT_X(!id.isEmpty(), __FUNCTION__, "Empty room id"); // If joinState is empty, all joinState == comparisons below are false. - const auto roomKey = qMakePair(id, joinState == JoinState::Invite); + const std::pair roomKey { id, joinState == JoinState::Invite }; auto* room = d->roomMap.value(roomKey, nullptr); if (room) { // Leave is a special case because in transition (5a) (see the .h file) diff --git a/lib/room.cpp b/lib/room.cpp index 284d19df..f692c354 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -118,7 +118,7 @@ public: // A map from evtId to a map of relation type to a vector of event // pointers. Not using QMultiHash, because we want to quickly return // a number of relations for a given event without enumerating them. - QHash, RelatedEvents> relations; + QHash, RelatedEvents> relations; QString displayname; Avatar avatar; QHash notifications; @@ -2687,7 +2687,7 @@ bool Room::Private::processRedaction(const RedactionEvent& redaction) } if (const auto* reaction = eventCast(oldEvent)) { const auto& targetEvtId = reaction->relation().eventId; - const QPair lookupKey { targetEvtId, EventRelation::AnnotationType }; + const std::pair lookupKey { targetEvtId, EventRelation::AnnotationType }; if (relations.contains(lookupKey)) { relations[lookupKey].removeOne(reaction); emit q->updatedEvent(targetEvtId); -- cgit v1.2.3 From 42f2d07fcb9f31b4e280a025472a6e810f36fb23 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 18 Jun 2022 22:51:01 +0200 Subject: CI: switch to macos-11 image --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f03af94b..c71ce6c3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false max-parallel: 1 matrix: - os: [ ubuntu-20.04, macos-10.15 ] + os: [ ubuntu-20.04, macos-11 ] qt-version: [ '6.3.1', '5.15.2' ] compiler: [ LLVM ] # Not using binary values here, to make the job captions more readable -- cgit v1.2.3 From 19e0251f02d547028583c2ebe9207885ff087dc4 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 19 Jun 2022 23:13:14 +0200 Subject: CI: fix macos-10.15 leftover --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c71ce6c3..d619385f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: - os: ubuntu-20.04 e2ee: e2ee # Will be re-added with static analysis below # TODO: Enable E2EE on Windows and macOS - - os: macos-10.15 + - os: macos-11 e2ee: e2ee include: - os: windows-2019 -- cgit v1.2.3 From 955e1314ebfd83d6f44d88547159e6492035681e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 8 Jul 2022 09:28:58 +0200 Subject: CI: use GCC 11 and (therefore) ubuntu-22.04 GCC 10 ICE's[1] in qt_connection_util.h code; and ubuntu-20.04 doesn't have GCC 11. Also: patch a Qt 5.15 header when compiling with GCC because a combination of Qt 5.15 and GCC 11 in turn triggers QTBUG-91909/90568... Which in turn required moving Qt setup before the build environment setup. Life's fun. [1] Internal Compiler Error --- .github/workflows/ci.yml | 41 +++++++++++++++++++++++------------------ README.md | 41 ++++++++++++++++++++++++++++++++--------- lib/qt_connection_util.h | 5 +++-- 3 files changed, 58 insertions(+), 29 deletions(-) (limited to '.github/workflows/ci.yml') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d619385f..f84356b0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -47,12 +47,12 @@ jobs: compiler: LLVM e2ee: e2ee static-analysis: codeql - - os: ubuntu-latest + - os: ubuntu-22.04 qt-version: '5.15.2' compiler: GCC e2ee: e2ee static-analysis: sonar - - os: ubuntu-20.04 + - os: ubuntu-22.04 qt-version: '5.15.2' compiler: GCC e2ee: e2ee @@ -82,11 +82,30 @@ jobs: with: fetch-depth: 0 + - name: Cache Qt + id: cache-qt + uses: actions/cache@v2 + with: + path: ${{ runner.workspace }}/Qt + key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache + + - name: Install Qt + uses: jurplel/install-qt-action@v2.14.0 + with: + version: ${{ matrix.qt-version }} + arch: ${{ matrix.qt-arch }} + cached: ${{ steps.cache-qt.outputs.cache-hit }} + - name: Setup build environment run: | if [ '${{ matrix.compiler }}' == 'GCC' ]; then - echo "CC=gcc-10" >>$GITHUB_ENV - echo "CXX=g++-10" >>$GITHUB_ENV + echo "CC=gcc" >>$GITHUB_ENV + echo "CXX=g++" >>$GITHUB_ENV + if [ '${{ startsWith(matrix.qt-version, '5') }}' == 'true' ]; then + # Patch Qt to avoid GCC tumbling over QTBUG-90568/QTBUG-91909 + sed -i 's/ThreadEngineStarter(ThreadEngine \*_threadEngine)/ThreadEngineStarter(ThreadEngine \*_threadEngine)/' \ + $Qt5_DIR/include/QtConcurrent/qtconcurrentthreadengine.h + fi elif [[ '${{ runner.os }}' != 'Windows' ]]; then echo "CC=clang" >>$GITHUB_ENV echo "CXX=clang++" >>$GITHUB_ENV @@ -124,20 +143,6 @@ jobs: cmake -E make_directory ${{ runner.workspace }}/build echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV - - name: Cache Qt - id: cache-qt - uses: actions/cache@v2 - with: - path: ${{ runner.workspace }}/Qt - key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache - - - name: Install Qt - uses: jurplel/install-qt-action@v2.14.0 - with: - version: ${{ matrix.qt-version }} - arch: ${{ matrix.qt-arch }} - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - name: Install Ninja (macOS/Windows) if: ${{ !startsWith(matrix.os, 'ubuntu') }} uses: seanmiddleditch/gha-setup-ninja@v3 diff --git a/README.md b/README.md index e0f4596c..8be38b5c 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ your application, as described below. - CMake 3.16 or newer (from your package management system or [the official website](https://cmake.org/download/)) - A C++ toolchain with that supports at least some subset of C++20: - - GCC 10 (Windows, Linux, macOS), Clang 11 (Linux), Apple Clang 12 (macOS) + - GCC 11 (Windows, Linux, macOS), Clang 11 (Linux), Apple Clang 12 (macOS) and Visual Studio 2019 (Windows) are the oldest officially supported. - Any build system that works with CMake should be fine: GNU Make and ninja on any platform, NMake and jom on Windows are known to work. @@ -165,14 +165,37 @@ by setting `Quotient_INSTALL_TESTS` to `OFF`. #### Building fails -If `cmake` fails with... -``` -CMake Warning at CMakeLists.txt:11 (find_package): - By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project - has asked CMake to find a package configuration file provided by - "Qt5Widgets", but CMake did not find one. -``` -...then you need to set the right `-DCMAKE_PREFIX_PATH` variable, see above. +- If `cmake` fails with + ``` + CMake Warning at CMakeLists.txt:11 (find_package): + By not providing "FindQt5Widgets.cmake" in CMAKE_MODULE_PATH this project + has asked CMake to find a package configuration file provided by + "Qt5Widgets", but CMake did not find one. + ``` + then you need to set the right `-DCMAKE_PREFIX_PATH` variable, see above. + +- If you use GCC and get an "unknown declarator" compilation error in the file +`qtconcurrentthreadengine.h` - unfortunately, it is an actual error in Qt 5.15 +sources, see https://bugreports.qt.io/browse/QTBUG-90568 (or +https://bugreports.qt.io/browse/QTBUG-91909). The Qt company did not make +an open source release with the fix, therefore: + + - if you're on Linux - try to use Qt from your package management system, as + most likely this bug is already fixed in the packages + - if you're on Windows, or if you have to use Qt (5.15) from download.qt.io + for any other reason, you should apply the fix to Qt sources: locate + the file (the GCC error message tells exactly where it is), find the line + with the (strange-looking) `ThreadEngineStarter` constructor definition: + ```cplusplus + ThreadEngineStarter(ThreadEngine \*_threadEngine) + ``` + and remove the template specialisation from the constructor name so that it + looks like + ```cplusplus + ThreadEngineStarter(ThreadEngine \*_threadEngine) + ``` + This will fix your build (and any other build involving QtConcurrent from + this installation of Qt - the fix is not specific to Quotient in any way). #### Logging configuration diff --git a/lib/qt_connection_util.h b/lib/qt_connection_util.h index edcdc572..90bc3f9b 100644 --- a/lib/qt_connection_util.h +++ b/lib/qt_connection_util.h @@ -91,8 +91,9 @@ inline auto connectSingleShot(auto* sender, auto signal, ContextT* context, (context->*slot)(args...); }; # endif - return _impl::connect<_impl::SingleShot>(sender, signal, context, - std::move(boundSlot), connType); + return _impl::connect<_impl::SingleShot>( + sender, signal, context, + std::forward(boundSlot), connType); } else { return _impl::connect<_impl::SingleShot>(sender, signal, context, slot, connType); -- cgit v1.2.3