aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/ci.yml59
-rw-r--r--.github/workflows/sonar.yml117
2 files changed, 51 insertions, 125 deletions
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