Files
deskflow/.github/workflows/sonarcloud-analysis.yml
Nick Bolton 6399feb324 Solve low hanging reliability and maintainability issues (#7403)
* Add missing atom ctor init

* Init members with `None`

* Use in-class init and delcare getter inside if init

* Temp revert of changes ahead of unit test repair

* Move IPC header to shared, restore X clipboard test, simplify test cmake, new X clipboard unit test

* Suppress sonar for undefs

* Remove base dir include

* Revert "Temp revert of changes ahead of unit test repair"

This reverts commit 8f84b6ea5d5828f1be1362de3809279bcacb8cc8.

* Use new accessor

* Use default dtor

* Beef up to 32 core

* Use enum class

* Make IPC protocol headers const at all levels

* Use enum class and const char for better type safety

* Use unique_ptr for m_clipboard

* Use `-j` instead of `-j8` to utilize full parallelism

* Increase thread count for sonar-scanner

* Use 32 threads

* Use in-class init for IpcClientProxy members

* Use const instead of #define

* Remove ctor member inits

* Use unique_ptr on win

* Implement temp bin dir for windows with more robust post-build copy

* Fixed missing iostream

* Add warning about copy errors

* Only run clean-gcda on Linux

* Use in-class init for IPC mutex

* Do no-op on Windows

* Hide clean-gcda task

* Move flakey test to integtests

* Delete dead code

* Test

* Temp disable post_config_all

* Disable post config step

* Revert "Disable post config step"

This reverts commit 2f956a7714ba9bedacd4b39d4ae00940c3d565d6.

* Revert "Temp disable post_config_all"

This reverts commit b44ed72e44f838bfe1309f6e9672d2f1c6f21b75.

* Restore -j8

* Simplify error handling

* Use const for test port

* Remove python check

* Update changelog

* Fixed order

* Fixed bad issue number

* Fixed bin copy source path

* Remove redundant except
2024-07-18 08:04:39 +01:00

91 lines
2.8 KiB
YAML

name: "SonarCloud Analysis"
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches: [master]
concurrency:
group: "${{ github.workflow }}-${{ github.ref || github.run_id }}"
cancel-in-progress: true
jobs:
sonarcloud-analysis:
if: ${{ vars.SONAR_SCANNER_ENABLED }}
runs-on: ubuntu-24.04-32-core-x64
container: symless/synergy-core:ubuntu-22.04-amd64
timeout-minutes: 20
env:
SONAR_SCANNER_VERSION: 6.1.0.4477
SONAR_SCANNER_OPTS: -server
SONAR_SCANNER_URL_BASE: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli
SONAR_SCANNER_THREADS: 32
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: "recursive"
- name: Config Git safe dir
run: git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Install dependencies
run: |
./scripts/install_deps.py --ci-env &&
apt install curl unzip -y &&
pip install gcovr
- name: Install SonarScanner
run: |
export SONAR_SCANNER_HOME=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64
curl --create-dirs -sSLo $HOME/.sonar/sonar-scanner.zip \
$SONAR_SCANNER_URL_BASE/sonar-scanner-cli-$SONAR_SCANNER_VERSION-linux-x64.zip
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
- name: Install build-wrapper
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 -p build
cd build
cmake -DCMAKE_BUILD_TYPE=Debug -DENABLE_COVERAGE=ON ..
build-wrapper-linux-x86-64 --out-dir bw-output make -j
- name: Make coverage
env:
QT_QPA_PLATFORM: offscreen
run: |
cd build
make coverage
- name: Run SonarScanner
run: |
export PATH=$HOME/.sonar/sonar-scanner-$SONAR_SCANNER_VERSION-linux-x64/bin:$PATH
cd build
sonar-scanner \
-Dsonar.organization=symless \
-Dsonar.projectKey=symless_synergy-core \
-Dsonar.sources=. \
-Dsonar.projectBaseDir=../ \
-Dsonar.exclusions=ext/**,build/** \
-Dsonar.cfamily.build-wrapper-output=bw-output \
-Dsonar.host.url=https://sonarcloud.io \
-Dsonar.coverageReportPaths=build/coverage.xml \
-Dsonar.cfamily.threads=${{ env.SONAR_SCANNER_THREADS }}
env:
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}