From f4255f83bf5f4bfe03dc7518a89b378d3238c940 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 12 Jun 2021 23:24:19 +0200 Subject: CI: Use Qt 5.12, as required from now --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 24681460..00e17f42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -42,7 +42,7 @@ jobs: - name: Install Qt uses: jurplel/install-qt-action@v2.11.1 with: - version: '5.9.9' + version: '5.12.10' cached: ${{ steps.cache-qt.outputs.cache-hit }} - name: Install Ninja (macOS) -- cgit v1.2.3 From ab269f183fdc6f611559d69475543089088b4712 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 13 Jun 2021 09:41:28 +0200 Subject: CI: version Qt cache --- .github/workflows/ci.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 00e17f42..ed251bc3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,7 @@ jobs: matrix: os: [ubuntu-18.04, macos-10.15] compiler: [ GCC, Clang ] + qt-version: [ '5.12.10' ] # Not using binary values here, to make the job captions more readable e2ee: [ '', 'E2EE' ] update-api: [ '', 'update-api' ] @@ -37,12 +38,12 @@ jobs: uses: actions/cache@v2 with: path: ${{ runner.workspace }}/Qt - key: ${{ runner.os }}-QtCache + key: ${{ runner.os }}-Qt${{ matrix.qt-version }}-cache - name: Install Qt uses: jurplel/install-qt-action@v2.11.1 with: - version: '5.12.10' + version: ${{ matrix.qt-version }} cached: ${{ steps.cache-qt.outputs.cache-hit }} - name: Install Ninja (macOS) -- cgit v1.2.3 From 466fe1a43389ac1d7408d32eee3e85e8b074b4bd Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 23 Jun 2021 20:16:04 +0200 Subject: Step to Ubuntu 20.04; drop (old) E2EE code building --- .github/workflows/ci.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ed251bc3..20100e5f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,17 +16,15 @@ jobs: fail-fast: false max-parallel: 1 matrix: - os: [ubuntu-18.04, macos-10.15] + os: [ubuntu-20.04, macos-10.15] compiler: [ GCC, Clang ] qt-version: [ '5.12.10' ] # Not using binary values here, to make the job captions more readable - e2ee: [ '', 'E2EE' ] + e2ee: [ '' ] update-api: [ '', 'update-api' ] exclude: - os: macos-10.15 compiler: GCC - - e2ee: '' # Somewhat reduce the number of combinations to check - update-api: 'update-api' steps: - uses: actions/checkout@v2 -- cgit v1.2.3 From 6be4436494506f2fa5dbbdc633577e059a422bfe Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 24 Aug 2021 14:04:49 +0200 Subject: Add Windows, CodeQL Windows and CodeQL snippets picked from Quaternion --- .github/workflows/ci.yml | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 20100e5f..87bb5149 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,13 +18,21 @@ jobs: matrix: os: [ubuntu-20.04, macos-10.15] compiler: [ GCC, Clang ] + platform: [ '' ] qt-version: [ '5.12.10' ] + qt-arch: [ '' ] # Not using binary values here, to make the job captions more readable e2ee: [ '' ] update-api: [ '', 'update-api' ] exclude: - os: macos-10.15 compiler: GCC + include: + - os: windows-2019 + compiler: MSVC + platform: x64 + qt-version: '5.12.10' + qt-arch: win64_msvc2017_64 steps: - uses: actions/checkout@v2 @@ -36,15 +44,16 @@ jobs: uses: actions/cache@v2 with: path: ${{ runner.workspace }}/Qt - key: ${{ runner.os }}-Qt${{ matrix.qt-version }}-cache + key: ${{ runner.os }}${{ matrix.platform }}-Qt${{ matrix.qt-version }}-cache - name: Install Qt uses: jurplel/install-qt-action@v2.11.1 with: version: ${{ matrix.qt-version }} + arch: ${{ matrix.qt-arch }} cached: ${{ steps.cache-qt.outputs.cache-hit }} - - name: Install Ninja (macOS) + - name: Install Ninja (macOS/Windows) if: ${{ !startsWith(matrix.os, 'ubuntu') }} uses: seanmiddleditch/gha-setup-ninja@v3 @@ -60,9 +69,13 @@ jobs: if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-9'; fi echo "CC=gcc$VERSION_POSTFIX" >>$GITHUB_ENV echo "CXX=g++$VERSION_POSTFIX" >>$GITHUB_ENV - else + elif [[ '${{ matrix.compiler }}' == 'Clang' ]]; then echo "CC=clang" >>$GITHUB_ENV echo "CXX=clang++" >>$GITHUB_ENV + if [[ '${{ runner.os }}' == 'Linux' ]]; then + # Do CodeQL analysis on one of Linux branches + echo "CODEQL_ANALYSIS=true" >>$GITHUB_ENV + fi fi if grep -q 'refs/tags' <<<'${{ github.ref }}'; then VERSION="$(git describe --tags)" @@ -76,6 +89,12 @@ jobs: -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local" >>$GITHUB_ENV cmake -E make_directory ${{ runner.workspace }}/build + - name: Setup MSVC environment + uses: ilammy/msvc-dev-cmd@v1 + if: matrix.compiler == 'MSVC' + with: + arch: ${{ matrix.platform }} + - name: Build and install olm if: matrix.e2ee run: | @@ -97,6 +116,16 @@ jobs: -DGTAD_PATH=${{ runner.workspace }}/gtad/gtad" \ >>$GITHUB_ENV echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN and API files regeneration" >>$GITHUB_ENV + + - name: Initialize CodeQL tools + if: env.CODEQL_ANALYSIS + uses: github/codeql-action/init@v1 + with: + languages: cpp + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Configure libQuotient run: cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} @@ -117,3 +146,7 @@ jobs: run: | [[ -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 + + - name: Perform CodeQL analysis + if: env.CODEQL_ANALYSIS + uses: github/codeql-action/analyze@v1 -- cgit v1.2.3 From 66795dbc90e5013eb5ddf941f7e462053a3d5229 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 24 Aug 2021 19:29:27 +0200 Subject: Fix bin path differences between POSIX and Windows --- .github/workflows/ci.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87bb5149..9d985fca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -128,7 +128,14 @@ jobs: # queries: ./path/to/local/query, your-org/your-repo/queries@main - name: Configure libQuotient - run: cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} + run: | + if [[ '${{ runner.os }}' == 'Windows' ]]; then + BIN_DIR=. + else + BIN_DIR=bin + fi + echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV + cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} - name: Regenerate API code if: matrix.update-api @@ -137,7 +144,7 @@ jobs: - name: Build and install libQuotient run: | cmake --build build --target install - ls ~/.local/bin/quotest + ls ~/.local/$BIN_DIR/quotest - name: Run tests env: -- cgit v1.2.3 From e150cdaf11800220f2cac0b6b348ebf8583514b0 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 1 Sep 2021 14:10:28 +0200 Subject: Add update-api on Windows pipeline --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d985fca..c90037ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,12 @@ jobs: platform: x64 qt-version: '5.12.10' qt-arch: win64_msvc2017_64 + - os: windows-2019 + compiler: MSVC + platform: x64 + qt-version: '5.12.10' + qt-arch: win64_msvc2017_64 + update-api: update-api steps: - uses: actions/checkout@v2 -- cgit v1.2.3 From 339db5a0e3e458f12beeec57116514e88f8ab354 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 1 Sep 2021 15:34:31 +0200 Subject: Change GTAD/matrix-doc paths `${{ runner.workspace }}` is, unfortunately, not portable to Windows. --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c90037ea..670153eb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -104,7 +104,7 @@ jobs: - name: Build and install olm if: matrix.e2ee run: | - cd ${{ runner.workspace }} + cd .. git clone https://gitlab.matrix.org/matrix-org/olm.git cmake -S olm -B olm/build $CMAKE_ARGS cmake --build olm/build --target install @@ -113,13 +113,13 @@ jobs: - name: Pull CS API and build GTAD if: matrix.update-api run: | - cd ${{ runner.workspace }} + cd .. git clone https://github.com/matrix-org/matrix-doc.git git clone --recursive https://github.com/KitsuneRal/gtad.git - cmake -S gtad -B gtad $CMAKE_ARGS + cmake -S gtad -B gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF cmake --build gtad - echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=${{ runner.workspace }}/matrix-doc \ - -DGTAD_PATH=${{ runner.workspace }}/gtad/gtad" \ + echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=$GITHUB_WORKSPACE/../matrix-doc \ + -DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \ >>$GITHUB_ENV echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN and API files regeneration" >>$GITHUB_ENV -- cgit v1.2.3 From ee678fac0ee09c6262c7a39b2b1072660e6db9ca Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Thu, 2 Sep 2021 22:18:14 +0200 Subject: CI experiment: requires GCC 10 and Clang 11 --- .github/workflows/ci.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 670153eb..47e31d55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,16 +72,17 @@ jobs: - name: Setup build environment run: | if [ "${{ matrix.compiler }}" == "GCC" ]; then - if [ -n "${{ matrix.update-api }}" ]; then VERSION_POSTFIX='-9'; fi - echo "CC=gcc$VERSION_POSTFIX" >>$GITHUB_ENV - echo "CXX=g++$VERSION_POSTFIX" >>$GITHUB_ENV + 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 - echo "CC=clang" >>$GITHUB_ENV - echo "CXX=clang++" >>$GITHUB_ENV 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 fi if grep -q 'refs/tags' <<<'${{ github.ref }}'; then VERSION="$(git describe --tags)" -- cgit v1.2.3 From 71b7f05e42f93c3da590b6f7f55658a81b607c0e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 19 Nov 2021 17:17:30 +0100 Subject: Add continue-on-error for regenerated API files The current upstream API definitions are expected to fail the test. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47e31d55..f22ea6d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -122,7 +122,7 @@ jobs: echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=$GITHUB_WORKSPACE/../matrix-doc \ -DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \ >>$GITHUB_ENV - echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN and API files regeneration" >>$GITHUB_ENV + echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with API files regeneration" >>$GITHUB_ENV - name: Initialize CodeQL tools if: env.CODEQL_ANALYSIS @@ -154,6 +154,7 @@ jobs: ls ~/.local/$BIN_DIR/quotest - name: Run tests + continue-on-error: ${{ matrix.update-api != '' }} # the current upstream API definitions are expected to fail the test env: TEST_USER: ${{ secrets.TEST_USER }} TEST_PWD: ${{ secrets.TEST_PWD }} -- cgit v1.2.3 From 02fa42b8ac5694485c7f6dedc62a873e97da2d35 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 19 Nov 2021 18:57:36 +0100 Subject: continue-on-error on the job level Continue on the step level marks the whole job as successful which is not really accurate. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f22ea6d2..269e487c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,6 +12,7 @@ defaults: jobs: CI: runs-on: ${{ matrix.os }} + continue-on-error: ${{ matrix.update-api != '' }} # the current upstream API definitions are expected to fail the test strategy: fail-fast: false max-parallel: 1 @@ -154,7 +155,6 @@ jobs: ls ~/.local/$BIN_DIR/quotest - name: Run tests - continue-on-error: ${{ matrix.update-api != '' }} # the current upstream API definitions are expected to fail the test env: TEST_USER: ${{ secrets.TEST_USER }} TEST_PWD: ${{ secrets.TEST_PWD }} -- cgit v1.2.3 From e16ed41a6a28a43919126a85f7a802c5b2e091b6 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 21 Nov 2021 15:29:57 +0100 Subject: CI: Nicer and more detailed logging for quotest --- .github/workflows/ci.yml | 2 ++ 1 file changed, 2 insertions(+) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 269e487c..dd862a0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -158,6 +158,8 @@ jobs: env: TEST_USER: ${{ secrets.TEST_USER }} TEST_PWD: ${{ secrets.TEST_PWD }} + QT_LOGGING_RULES: 'quotient.main.debug=true;quotient.jobs.debug=true' + QT_MESSAGE_PATTERN: '%{time h:mm:ss.zzz}|%{category}|%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}|%{message}' run: | [[ -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 -- cgit v1.2.3 From a2cc707107464fd98fc8a33afde3ed29f8cd9526 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sun, 21 Nov 2021 21:48:54 +0100 Subject: CI: Restrict workflow concurrency; tighten job timeout --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 269e487c..1b6d9e52 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,8 @@ defaults: run: shell: bash +concurrency: ci-${{ github.ref }} + jobs: CI: runs-on: ${{ matrix.os }} @@ -160,7 +162,7 @@ jobs: TEST_PWD: ${{ secrets.TEST_PWD }} run: | [[ -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 + timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually - name: Perform CodeQL analysis if: env.CODEQL_ANALYSIS -- cgit v1.2.3 From c476df5a306383c164b974234c1574f76abb98b8 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 27 Nov 2021 18:43:57 +0100 Subject: Add issue templates --- .github/ISSUE_TEMPLATE/bug_report.md | 29 +++++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/change-request.md | 20 ++++++++++++++++++++ 2 files changed, 49 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug_report.md create mode 100644 .github/ISSUE_TEMPLATE/change-request.md (limited to '.github') diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md new file mode 100644 index 00000000..637cb4b3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -0,0 +1,29 @@ +--- +name: Bug report +about: Create a report to help us improve +title: '' +labels: bug +assignees: '' + +--- + +**Describe the bug** + + +**To Reproduce** +Steps to reproduce the behaviour, and the description of the actual result: +1. +2. +3. + +**Expected behavior** + + +**Is it environment-specific?** + + - OS: [e.g. Windows 11] + - Version of the library [e.g. 0.6.10] + - Linkage: static, dynamic, any + +**Additional context** + diff --git a/.github/ISSUE_TEMPLATE/change-request.md b/.github/ISSUE_TEMPLATE/change-request.md new file mode 100644 index 00000000..09deeaa6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/change-request.md @@ -0,0 +1,20 @@ +--- +name: Change request +about: Suggest an idea or improvement for this project +title: '' +labels: enhancement +assignees: '' + +--- + +**Is your request related to a problem?** + + +**Describe the suggested change/improvement you'd like** + + +**Describe alternatives you've considered** + + +**Additional context** + -- cgit v1.2.3 From 0a46049ef26270933ecf6fea7395b03e6aee783e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Sat, 27 Nov 2021 10:17:51 +0100 Subject: Add SonarCloud analysis to CI --- .github/workflows/ci.yml | 3 +- .github/workflows/sonar.yml | 113 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 115 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sonar.yml (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 714473b0..47e55421 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,6 +46,7 @@ jobs: steps: - uses: actions/checkout@v2 with: + fetch-depth: 0 submodules: ${{ matrix.e2ee != '' }} - name: Cache Qt @@ -126,7 +127,7 @@ jobs: -DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \ >>$GITHUB_ENV echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with API files regeneration" >>$GITHUB_ENV - + - name: Initialize CodeQL tools if: env.CODEQL_ANALYSIS uses: github/codeql-action/init@v1 diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml new file mode 100644 index 00000000..76db59c9 --- /dev/null +++ b/.github/workflows/sonar.yml @@ -0,0 +1,113 @@ +name: Sonar + +on: + push: + pull_request: + types: [opened, reopened] + +defaults: + run: + shell: bash + +jobs: + SonarCloud: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + qt-version: [ '5.12.10' ] + e2ee: [ '', 'e2ee' ] + update-api: [ '', 'update-api' ] + + env: + SONAR_SCANNER_VERSION: 4.6.2.2472 + SONAR_SERVER_URL: "https://sonarcloud.io" + BUILD_WRAPPER_OUT_DIR: build/sonar + + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + submodules: ${{ matrix.e2ee != '' }} + + - name: Cache Qt + id: cache-qt + uses: actions/cache@v2 + with: + path: ${{ runner.workspace }}/Qt + key: ${{ runner.os }}-Qt${{ matrix.qt-version }}-cache + + - name: Install Qt + uses: jurplel/install-qt-action@v2.11.1 + with: + version: ${{ matrix.qt-version }} +# arch: ${{ matrix.qt-arch }} # Only Windows needs that + cached: ${{ steps.cache-qt.outputs.cache-hit }} + + - name: Install Ninja + uses: seanmiddleditch/gha-setup-ninja@v3 + + - name: Setup build environment + run: | + echo "CC=gcc-10" >>$GITHUB_ENV + echo "CXX=g++-10" >>$GITHUB_ENV + mkdir -p $HOME/.sonar + 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 + if: matrix.e2ee + run: | + cd .. + git clone https://gitlab.matrix.org/matrix-org/olm.git + cmake -S olm -B olm/build $CMAKE_ARGS + cmake --build olm/build --target install + + - name: Pull CS API and build GTAD + if: matrix.update-api + run: | + cd .. + git clone https://github.com/quotient-im/matrix-doc.git + git clone --recursive https://github.com/KitsuneRal/gtad.git + cmake -S gtad -B gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF + cmake --build gtad + echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=$GITHUB_WORKSPACE/../matrix-doc \ + -DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \ + >>$GITHUB_ENV + + - name: Download and set up Sonar Cloud tools + run: | + pushd $HOME/.sonar + curl -sSLo build-wrapper.zip $SONAR_SERVER_URL/static/cpp/build-wrapper-linux-x86.zip + unzip -o build-wrapper.zip + echo "BUILD_WRAPPER=$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux* --out-dir $BUILD_WRAPPER_OUT_DIR" >>$GITHUB_ENV + curl -sSLo sonar-scanner.zip \ + https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip + unzip -o sonar-scanner.zip + popd + + - name: Configure libQuotient + run: | + if [[ '${{ runner.os }}' == 'Windows' ]]; then + BIN_DIR=. + else + BIN_DIR=bin + fi + echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV + cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} + + - name: Regenerate API code + if: matrix.update-api + run: cmake --build build --target update-api + + - name: Build libQuotient + run: | + $BUILD_WRAPPER cmake --build build --target all + + - name: Run sonar-scanner + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + $HOME/.sonar/sonar-scanner*/bin/sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" -- cgit v1.2.3 From 9ddb72611f5575ccd5d3b68734a9d40d8ef2befc Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Mon, 6 Dec 2021 07:17:17 +0100 Subject: Add execution of autotests to CI --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47e55421..ec6b671c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -154,7 +154,7 @@ jobs: - name: Build and install libQuotient run: | - cmake --build build --target install + cmake --build build --target all install ls ~/.local/$BIN_DIR/quotest - name: Run tests @@ -164,6 +164,8 @@ jobs: QT_LOGGING_RULES: 'quotient.main.debug=true;quotient.jobs.debug=true' QT_MESSAGE_PATTERN: '%{time h:mm:ss.zzz}|%{category}|%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}|%{message}' run: | + cd build + ctest --output-on-failure [[ -z "$TEST_USER" ]] || $VALGRIND build/quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually -- cgit v1.2.3 From 449456c2c86f56e9294294e03436d3aa0ff089f5 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 7 Dec 2021 09:43:00 +0100 Subject: Fix quotest invocation; use working-directory --- .github/workflows/ci.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ec6b671c..9eefa43f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: 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=quotest/.valgrind.supp" >>$GITHUB_ENV + echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=${{ runner.workspace }}/quotest/.valgrind.supp" >>$GITHUB_ENV - name: Setup build environment run: | @@ -108,8 +108,8 @@ jobs: - name: Build and install olm if: matrix.e2ee + working-directory: '..' run: | - cd .. git clone https://gitlab.matrix.org/matrix-org/olm.git cmake -S olm -B olm/build $CMAKE_ARGS cmake --build olm/build --target install @@ -117,8 +117,8 @@ jobs: - name: Pull CS API and build GTAD if: matrix.update-api + working-directory: '..' run: | - cd .. git clone https://github.com/matrix-org/matrix-doc.git git clone --recursive https://github.com/KitsuneRal/gtad.git cmake -S gtad -B gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF @@ -163,10 +163,10 @@ jobs: TEST_PWD: ${{ secrets.TEST_PWD }} QT_LOGGING_RULES: 'quotient.main.debug=true;quotient.jobs.debug=true' QT_MESSAGE_PATTERN: '%{time h:mm:ss.zzz}|%{category}|%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}|%{message}' + working-directory: build run: | - cd build ctest --output-on-failure - [[ -z "$TEST_USER" ]] || $VALGRIND build/quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" + [[ -z "$TEST_USER" ]] || $VALGRIND quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually - name: Perform CodeQL analysis -- cgit v1.2.3 From cb7c57953024a23fc7c20db75f3a15f81bb62bd3 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 7 Dec 2021 14:43:27 +0100 Subject: Fix valgrind invocation failure It turned out that, confusingly, ${{ runner.workspace }} refers to the directory above $GITHUB_WORKSPACE, which is why the previous commit ended up with valgrind not finding its suppressions. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9eefa43f..6fdb337a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -71,7 +71,7 @@ jobs: 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=${{ runner.workspace }}/quotest/.valgrind.supp" >>$GITHUB_ENV + echo "VALGRIND=valgrind --tool=memcheck --leak-check=yes --gen-suppressions=all --suppressions=$GITHUB_WORKSPACE/quotest/.valgrind.supp" >>$GITHUB_ENV - name: Setup build environment run: | -- cgit v1.2.3 From 0128b8a296b1be7e7702ec525539614d47dd7471 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 7 Dec 2021 14:43:39 +0100 Subject: CI: Put all build directories to ${{ runner.workspace }}/build --- .github/workflows/ci.yml | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6fdb337a..2e023230 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -99,6 +99,7 @@ jobs: 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 + echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV - name: Setup MSVC environment uses: ilammy/msvc-dev-cmd@v1 @@ -108,23 +109,23 @@ jobs: - name: Build and install olm if: matrix.e2ee - working-directory: '..' + working-directory: ${{ runner.workspace }} run: | git clone https://gitlab.matrix.org/matrix-org/olm.git - cmake -S olm -B olm/build $CMAKE_ARGS - cmake --build olm/build --target install + cmake -S olm -B build/olm $CMAKE_ARGS + cmake --build build/olm --target install echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with E2EE" >>$GITHUB_ENV - name: Pull CS API and build GTAD if: matrix.update-api - working-directory: '..' + working-directory: ${{ runner.workspace }} run: | git clone https://github.com/matrix-org/matrix-doc.git git clone --recursive https://github.com/KitsuneRal/gtad.git - cmake -S gtad -B gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - cmake --build gtad - echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=$GITHUB_WORKSPACE/../matrix-doc \ - -DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \ + 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 \ + -DGTAD_PATH=${{ runner.workspace }}/build/gtad/gtad" \ >>$GITHUB_ENV echo "QUOTEST_ORIGIN=$QUOTEST_ORIGIN with API files regeneration" >>$GITHUB_ENV @@ -146,15 +147,15 @@ jobs: BIN_DIR=bin fi echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV - cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} + cmake -S $GITHUB_WORKSPACE -B $BUILD_PATH $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} - name: Regenerate API code if: matrix.update-api - run: cmake --build build --target update-api + run: cmake --build ../build/libQuotient --target update-api - name: Build and install libQuotient run: | - cmake --build build --target all install + cmake --build $BUILD_PATH --target all install ls ~/.local/$BIN_DIR/quotest - name: Run tests @@ -163,9 +164,9 @@ jobs: TEST_PWD: ${{ secrets.TEST_PWD }} QT_LOGGING_RULES: 'quotient.main.debug=true;quotient.jobs.debug=true' QT_MESSAGE_PATTERN: '%{time h:mm:ss.zzz}|%{category}|%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}|%{message}' - working-directory: build + working-directory: ../build/libQuotient run: | - ctest --output-on-failure + ctest --test-dir $BUILD_PATH --output-on-failure [[ -z "$TEST_USER" ]] || $VALGRIND quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually -- cgit v1.2.3 From bd728a91f69382a052d07582788fcecec8b0f35e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Tue, 7 Dec 2021 19:00:04 +0100 Subject: Test installed quotest This covers Quotient_INSTALL_TESTS setting. --- .github/workflows/ci.yml | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e023230..9d286da6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -98,8 +98,16 @@ jobs: 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 + + if [[ '${{ runner.os }}' != 'Windows' ]]; then + BIN_DIR=/bin + fi + echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV + echo "~/.local$BIN_DIR" >>$GITHUB_PATH + cmake -E make_directory ${{ runner.workspace }}/build echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV + echo "LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH" >>$GITHUB_ENV - name: Setup MSVC environment uses: ilammy/msvc-dev-cmd@v1 @@ -141,13 +149,8 @@ jobs: - name: Configure libQuotient run: | - if [[ '${{ runner.os }}' == 'Windows' ]]; then - BIN_DIR=. - else - BIN_DIR=bin - fi - echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV - cmake -S $GITHUB_WORKSPACE -B $BUILD_PATH $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} + cmake -S $GITHUB_WORKSPACE -B $BUILD_PATH $CMAKE_ARGS \ + -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} -DQuotient_INSTALL_TESTS=ON - name: Regenerate API code if: matrix.update-api @@ -164,10 +167,10 @@ jobs: TEST_PWD: ${{ secrets.TEST_PWD }} QT_LOGGING_RULES: 'quotient.main.debug=true;quotient.jobs.debug=true' QT_MESSAGE_PATTERN: '%{time h:mm:ss.zzz}|%{category}|%{if-debug}D%{endif}%{if-info}I%{endif}%{if-warning}W%{endif}%{if-critical}C%{endif}%{if-fatal}F%{endif}|%{message}' - working-directory: ../build/libQuotient run: | ctest --test-dir $BUILD_PATH --output-on-failure - [[ -z "$TEST_USER" ]] || $VALGRIND quotest/quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" + [[ -z "$TEST_USER" ]] || \ + $VALGRIND quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually - name: Perform CodeQL analysis -- cgit v1.2.3 From c585227b3724666e3cf7aab3ab53d6f5930e7218 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Thu, 9 Dec 2021 21:07:52 +0100 Subject: Fix CI failure on macOS CMAKE_INSTALL_RPATH_USE_LINK_PATH is more universal than setting LD_LIBRARY_PATH Also: drop an extra slash in the path to installed quotest. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d286da6..c78a5981 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -97,7 +97,8 @@ jobs: fi 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 + -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local\ + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" >>$GITHUB_ENV if [[ '${{ runner.os }}' != 'Windows' ]]; then BIN_DIR=/bin @@ -107,7 +108,6 @@ jobs: cmake -E make_directory ${{ runner.workspace }}/build echo "BUILD_PATH=${{ runner.workspace }}/build/libQuotient" >>$GITHUB_ENV - echo "LD_LIBRARY_PATH=$Qt5_DIR/lib:$LD_LIBRARY_PATH" >>$GITHUB_ENV - name: Setup MSVC environment uses: ilammy/msvc-dev-cmd@v1 @@ -159,7 +159,7 @@ jobs: - name: Build and install libQuotient run: | cmake --build $BUILD_PATH --target all install - ls ~/.local/$BIN_DIR/quotest + ls ~/.local$BIN_DIR/quotest - name: Run tests env: -- cgit v1.2.3 From 42eaf3671c656088f8d038f83973f0931ad7051c Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 02:33:39 +0100 Subject: Sonar: leave just one job There's not much value in analysing the code without E2EE and with E2EE because E2EE is additive; and there's no plan to look close into the generated API code apart from what already ends up being committed. --- .github/workflows/sonar.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index 76db59c9..ae96aebc 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -16,8 +16,8 @@ jobs: fail-fast: false matrix: qt-version: [ '5.12.10' ] - e2ee: [ '', 'e2ee' ] - update-api: [ '', 'update-api' ] + e2ee: [ 'e2ee' ] + update-api: [ '' ] env: SONAR_SCANNER_VERSION: 4.6.2.2472 -- cgit v1.2.3 From a08348007dd0a73a40b7b1d755b3affc963b5b80 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Wed, 22 Dec 2021 17:31:37 +0100 Subject: Sonar: add coverage analysis --- .github/workflows/sonar.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to '.github') diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index ae96aebc..c8ddca66 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -53,7 +53,8 @@ jobs: echo "CXX=g++-10" >>$GITHUB_ENV mkdir -p $HOME/.sonar echo "CMAKE_ARGS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=false \ - -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local" >>$GITHUB_ENV + -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local" \ + -DCMAKE_CXX_FLAGS=--coverage >>$GITHUB_ENV cmake -E make_directory ${{ runner.workspace }}/build - name: Build and install olm @@ -110,4 +111,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | - $HOME/.sonar/sonar-scanner*/bin/sonar-scanner --define sonar.host.url="${{ env.SONAR_SERVER_URL }}" --define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" + $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ + -Dsonar.host.url="${{ env.SONAR_SERVER_URL }}" \ + -Dsonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ + -Dsonar.cfamily.gcov.reportsPath=build/coverage -- cgit v1.2.3 From 0cbbae133d61ccb1fbb41a40660a70c65f65235f Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Thu, 23 Dec 2021 11:43:01 +0100 Subject: Merge Sonar invocation back to ci.yml For coverage analysis to work, a test run is needed, making the overlap between ci.yaml and sonar.yml quite significant again. Note: 'update-api' option is temporarily dropped from the matrix to speed up the check. If things run fine, 'update-api' will come back. --- .github/workflows/ci.yml | 59 +++++++++++++++++++--- .github/workflows/sonar.yml | 117 -------------------------------------------- 2 files changed, 51 insertions(+), 125 deletions(-) delete mode 100644 .github/workflows/sonar.yml (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c78a5981..01a4468f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,16 +21,21 @@ jobs: matrix: os: [ubuntu-20.04, macos-10.15] compiler: [ GCC, Clang ] - platform: [ '' ] qt-version: [ '5.12.10' ] - qt-arch: [ '' ] # Not using binary values here, to make the job captions more readable e2ee: [ '' ] - update-api: [ '', 'update-api' ] + update-api: [ '' ] #, 'update-api' ] + sonar: [ '' ] + platform: [ '' ] + qt-arch: [ '' ] exclude: - os: macos-10.15 compiler: GCC include: + - os: ubuntu-latest + compiler: GCC + qt-version: '5.12.10' + sonar: 'sonar' - os: windows-2019 compiler: MSVC platform: x64 @@ -43,6 +48,9 @@ jobs: qt-arch: win64_msvc2017_64 update-api: update-api + env: + SONAR_SERVER_URL: 'https://sonarcloud.io' + steps: - uses: actions/checkout@v2 with: @@ -96,9 +104,18 @@ jobs: 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 - echo "CMAKE_ARGS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=false \ - -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local\ - -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" >>$GITHUB_ENV + + CMAKE_ARGS="-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo \ + -DBUILD_SHARED_LIBS=false \ + -DCMAKE_INSTALL_PREFIX=~/.local \ + -DCMAKE_PREFIX_PATH=~/.local \ + -DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON" + + if [ -n "${{ matrix.sonar }}" ]; then + mkdir -p $HOME/.sonar + CMAKE_ARGS="$CMAKE_ARGS -DCMAKE_CXX_FLAGS=--coverage" + fi + echo "CMAKE_ARGS=$CMAKE_ARGS" >>$GITHUB_ENV if [[ '${{ runner.os }}' != 'Windows' ]]; then BIN_DIR=/bin @@ -115,6 +132,20 @@ jobs: with: arch: ${{ matrix.platform }} + - name: Download and set up Sonar Cloud tools + if: matrix.sonar != '' + env: + SONAR_SCANNER_VERSION: 4.6.2.2472 + run: | + pushd $HOME/.sonar + curl -sSL --remote-name-all \ + $SONAR_SERVER_URL/static/cpp/build-wrapper-linux-x86.zip \ + https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip + unzip -o build-wrapper*.zip + echo "BUILD_WRAPPER=$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux* --out-dir $BUILD_PATH/sonar" >>$GITHUB_ENV + unzip -o sonar-scanner-cli*.zip + popd + - name: Build and install olm if: matrix.e2ee working-directory: ${{ runner.workspace }} @@ -158,7 +189,8 @@ jobs: - name: Build and install libQuotient run: | - cmake --build $BUILD_PATH --target all install + $BUILD_WRAPPER cmake --build $BUILD_PATH --target all + cmake --build $BUILD_PATH --target install ls ~/.local$BIN_DIR/quotest - name: Run tests @@ -172,7 +204,18 @@ jobs: [[ -z "$TEST_USER" ]] || \ $VALGRIND quotest "$TEST_USER" "$TEST_PWD" quotest-gha '#quotest:matrix.org' "$QUOTEST_ORIGIN" timeout-minutes: 4 # quotest is supposed to finish within 3 minutes, actually - + - name: Perform CodeQL analysis if: env.CODEQL_ANALYSIS uses: github/codeql-action/analyze@v1 + + - name: Run sonar-scanner + if: matrix.sonar != '' + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ + -Dsonar.host.url="$SONAR_SERVER_URL" \ + -Dsonar.cfamily.build-wrapper-output="$BUILD_PATH/sonar" \ + -Dsonar.cfamily.gcov.reportsPath="$BUILD_PATH/coverage" diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml deleted file mode 100644 index c8ddca66..00000000 --- a/.github/workflows/sonar.yml +++ /dev/null @@ -1,117 +0,0 @@ -name: Sonar - -on: - push: - pull_request: - types: [opened, reopened] - -defaults: - run: - shell: bash - -jobs: - SonarCloud: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - qt-version: [ '5.12.10' ] - e2ee: [ 'e2ee' ] - update-api: [ '' ] - - env: - SONAR_SCANNER_VERSION: 4.6.2.2472 - SONAR_SERVER_URL: "https://sonarcloud.io" - BUILD_WRAPPER_OUT_DIR: build/sonar - - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: ${{ matrix.e2ee != '' }} - - - name: Cache Qt - id: cache-qt - uses: actions/cache@v2 - with: - path: ${{ runner.workspace }}/Qt - key: ${{ runner.os }}-Qt${{ matrix.qt-version }}-cache - - - name: Install Qt - uses: jurplel/install-qt-action@v2.11.1 - with: - version: ${{ matrix.qt-version }} -# arch: ${{ matrix.qt-arch }} # Only Windows needs that - cached: ${{ steps.cache-qt.outputs.cache-hit }} - - - name: Install Ninja - uses: seanmiddleditch/gha-setup-ninja@v3 - - - name: Setup build environment - run: | - echo "CC=gcc-10" >>$GITHUB_ENV - echo "CXX=g++-10" >>$GITHUB_ENV - mkdir -p $HOME/.sonar - echo "CMAKE_ARGS=-G Ninja -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=false \ - -DCMAKE_INSTALL_PREFIX=~/.local -DCMAKE_PREFIX_PATH=~/.local" \ - -DCMAKE_CXX_FLAGS=--coverage >>$GITHUB_ENV - cmake -E make_directory ${{ runner.workspace }}/build - - - name: Build and install olm - if: matrix.e2ee - run: | - cd .. - git clone https://gitlab.matrix.org/matrix-org/olm.git - cmake -S olm -B olm/build $CMAKE_ARGS - cmake --build olm/build --target install - - - name: Pull CS API and build GTAD - if: matrix.update-api - run: | - cd .. - git clone https://github.com/quotient-im/matrix-doc.git - git clone --recursive https://github.com/KitsuneRal/gtad.git - cmake -S gtad -B gtad $CMAKE_ARGS -DBUILD_SHARED_LIBS=OFF - cmake --build gtad - echo "CMAKE_ARGS=$CMAKE_ARGS -DMATRIX_DOC_PATH=$GITHUB_WORKSPACE/../matrix-doc \ - -DGTAD_PATH=$GITHUB_WORKSPACE/../gtad/gtad" \ - >>$GITHUB_ENV - - - name: Download and set up Sonar Cloud tools - run: | - pushd $HOME/.sonar - curl -sSLo build-wrapper.zip $SONAR_SERVER_URL/static/cpp/build-wrapper-linux-x86.zip - unzip -o build-wrapper.zip - echo "BUILD_WRAPPER=$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux* --out-dir $BUILD_WRAPPER_OUT_DIR" >>$GITHUB_ENV - curl -sSLo sonar-scanner.zip \ - https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip - unzip -o sonar-scanner.zip - popd - - - name: Configure libQuotient - run: | - if [[ '${{ runner.os }}' == 'Windows' ]]; then - BIN_DIR=. - else - BIN_DIR=bin - fi - echo "BIN_DIR=$BIN_DIR" >>$GITHUB_ENV - cmake -S $GITHUB_WORKSPACE -B build $CMAKE_ARGS -DQuotient_ENABLE_E2EE=${{ matrix.e2ee }} - - - name: Regenerate API code - if: matrix.update-api - run: cmake --build build --target update-api - - - name: Build libQuotient - run: | - $BUILD_WRAPPER cmake --build build --target all - - - name: Run sonar-scanner - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - run: | - $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ - -Dsonar.host.url="${{ env.SONAR_SERVER_URL }}" \ - -Dsonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}" \ - -Dsonar.cfamily.gcov.reportsPath=build/coverage -- cgit v1.2.3 From 669ed9bcae110ca0539876193ec3b8cb9b8a8a18 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 02:35:44 +0100 Subject: Actually do and submit coverage ...instead of hoping the thing will sort itself out because CLion does. --- .github/workflows/ci.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01a4468f..8596ccd5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -114,6 +114,7 @@ jobs: if [ -n "${{ matrix.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 @@ -215,7 +216,11 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | + mkdir .coverage && pushd .coverage + find $BUILD_PATH/CMakeFiles/Quotient.dir/lib -name '*.gcda' -print0 \ + | xargs -0 $COV -s $GITHUB_WORKSPACE/lib -pr + popd $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ -Dsonar.host.url="$SONAR_SERVER_URL" \ -Dsonar.cfamily.build-wrapper-output="$BUILD_PATH/sonar" \ - -Dsonar.cfamily.gcov.reportsPath="$BUILD_PATH/coverage" + -Dsonar.cfamily.gcov.reportsPath=.coverage -- cgit v1.2.3 From 3fa5925ad6c9ce558dd9726a02614fd6f9c031e5 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 02:35:56 +0100 Subject: Analyse in 2 threads --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8596ccd5..47c92ad3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -223,4 +223,5 @@ jobs: $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ -Dsonar.host.url="$SONAR_SERVER_URL" \ -Dsonar.cfamily.build-wrapper-output="$BUILD_PATH/sonar" \ + -Dsonar.cfamily.threads=2 \ -Dsonar.cfamily.gcov.reportsPath=.coverage -- cgit v1.2.3 From e1c19404846b2a7a2f321c662528252e4eeef35e Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 06:42:36 +0100 Subject: Don't strip lib from names in .gcov files That apparently confuses Sonar as it fails to match the source files. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 47c92ad3..27c65b26 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -218,7 +218,7 @@ jobs: run: | mkdir .coverage && pushd .coverage find $BUILD_PATH/CMakeFiles/Quotient.dir/lib -name '*.gcda' -print0 \ - | xargs -0 $COV -s $GITHUB_WORKSPACE/lib -pr + | xargs -0 $COV -s $GITHUB_WORKSPACE -pr popd $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ -Dsonar.host.url="$SONAR_SERVER_URL" \ -- cgit v1.2.3 From a207439d165b00b689e37b2759e0ca42bdfb22ae Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 08:00:39 +0100 Subject: Reinstate update-api jobs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 27c65b26..5a3a0708 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: qt-version: [ '5.12.10' ] # Not using binary values here, to make the job captions more readable e2ee: [ '' ] - update-api: [ '' ] #, 'update-api' ] + update-api: [ '', 'update-api' ] sonar: [ '' ] platform: [ '' ] qt-arch: [ '' ] -- cgit v1.2.3 From e4a9132ab5c684be9743823df7c31d12da1e3f3b Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 10:40:44 +0100 Subject: CI: Add missing coverage files --- .github/workflows/ci.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a3a0708..72deb803 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,9 +217,11 @@ jobs: SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} run: | mkdir .coverage && pushd .coverage - find $BUILD_PATH/CMakeFiles/Quotient.dir/lib -name '*.gcda' -print0 \ + find $BUILD_PATH -name '*.gcda' -print0 \ | xargs -0 $COV -s $GITHUB_WORKSPACE -pr popd + # Drop coverage of the test source code, which is obviously 100% + rm -f quotest* autotests* $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ -Dsonar.host.url="$SONAR_SERVER_URL" \ -Dsonar.cfamily.build-wrapper-output="$BUILD_PATH/sonar" \ -- cgit v1.2.3 From 179564eb4c2d5ee59ef129edab39ca1a7cbc4258 Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 12:22:59 +0100 Subject: CI: Move a comment outside of the script Comments inside shell scripts apparently break the flimsy GHA machinery. --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 72deb803..5cac5874 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,12 +215,13 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + # Coverage of the test source code is not tracked, as it is obviously 100% + # (if it's not, some tests failed and break the build at an earlier stage) run: | mkdir .coverage && pushd .coverage find $BUILD_PATH -name '*.gcda' -print0 \ | xargs -0 $COV -s $GITHUB_WORKSPACE -pr popd - # Drop coverage of the test source code, which is obviously 100% rm -f quotest* autotests* $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ -Dsonar.host.url="$SONAR_SERVER_URL" \ -- cgit v1.2.3 From 165e17d4ad289dabdcb6a09ce27c02c6122b7f8a Mon Sep 17 00:00:00 2001 From: Alexey Rusakov Date: Fri, 24 Dec 2021 13:37:55 +0100 Subject: CI: Fix rm being run in the wrong directory It's been alright with the comment inside the script. --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to '.github') diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cac5874..a1b6f0c0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -215,14 +215,14 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - # Coverage of the test source code is not tracked, as it is obviously 100% - # (if it's not, some tests failed and break the build at an earlier stage) run: | mkdir .coverage && pushd .coverage find $BUILD_PATH -name '*.gcda' -print0 \ | xargs -0 $COV -s $GITHUB_WORKSPACE -pr - popd + # 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* + popd $HOME/.sonar/sonar-scanner*/bin/sonar-scanner \ -Dsonar.host.url="$SONAR_SERVER_URL" \ -Dsonar.cfamily.build-wrapper-output="$BUILD_PATH/sonar" \ -- cgit v1.2.3