aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-23 11:43:01 +0100
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2021-12-24 02:34:27 +0100
commit0cbbae133d61ccb1fbb41a40660a70c65f65235f (patch)
tree550ed87d5d7fd7abdbd8e5203b051d7497229baf /.github/workflows/ci.yml
parenta08348007dd0a73a40b7b1d755b3affc963b5b80 (diff)
downloadlibquotient-0cbbae133d61ccb1fbb41a40660a70c65f65235f.tar.gz
libquotient-0cbbae133d61ccb1fbb41a40660a70c65f65235f.zip
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.
Diffstat (limited to '.github/workflows/ci.yml')
-rw-r--r--.github/workflows/ci.yml59
1 files changed, 51 insertions, 8 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"