deskflow/.github/workflows/sonarcloud-analysis.yml
Nick Bolton 444b7d764e
Repair macOS CI workflow ahead of combining all CI workflows (#7350)
* Test

* Fixed Mac image names

* Version lock to macOS 14

* Change name of Homebrew Qt package

* Use CMake to build

* Remove dep already installed

* Remove version source

* Remove env var not needed

* Add homebrew path to CMake presets

* Revert "Add homebrew path to CMake presets"

This reverts commit 6b1342cdc2f412cad3e840e51e3e018dd7470d21.

* Add Qt prefix to workflow

* Upgrade CodeQL analysis to v2

* Rename SonarCloud workflow for convention

* Delete test file

* Upgrade CodeQL analysis to v3
2024-06-11 11:48:15 +01:00

76 lines
2.5 KiB
YAML

name: "SonarCloud Analysis"
on:
push:
branches: [master]
pull_request:
branches: [master]
concurrency:
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
cancel-in-progress: true
jobs:
sonarcloud-analysis:
runs-on: ubuntu-latest
container: symless/synergy-core:debian10
timeout-minutes: 20
env:
SONAR_SCANNER_VERSION: 5.0.1.3006
SONAR_SCANNER_OPTS: -server
steps:
- name: Checkout git repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Installing gcovr
run: |
apt-get update
apt-get install -y python python-pip
pip install gcovr
- name: Installing Sonar Scanner
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- name: Installing buildWrapper
run: |
curl --create-dirs -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- name: Build
run: |
export PATH=$HOME/.sonar/build-wrapper-linux-x86:$PATH
mkdir build-release
cd build-release
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
. ./version
build-wrapper-linux-x86-64 --out-dir bw-output make -j
- name: Running coverage
run: |
cd build-release
make coverage
- name: Run Sonar Scanner
run: |
export PATH=$HOME/.sonar/sonar-scanner-${SONAR_SCANNER_VERSION}-linux/bin:$PATH
cd build-release
sonar-scanner \
-Dsonar.organization=symless \
-Dsonar.projectKey=symless_synergy-core \
-Dsonar.sources=. \
-Dsonar.projectBaseDir=../ \
-Dsonar.exclusions=./ext/**,**/build-release/** \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.coverageReportPaths=build-release/coverage.xml \
-Dsonar.cfamily.threads=2
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}