* Move QApplication out of main to reduce memory impact when running individual tests * Add --valgrind arg and colorize output when command returns non-zero exit code * Fixed: colorama not always available * Test multiple Qt tests * Fixed: Windows Qt test failing due to missing QCoreApplication * Simplify fake args for Qt * Use --ci-env arg * Create Valgrind analysis workflow * Rename vars for fake args * Parse and output valgrind summary * Add build mode to comment * Use GITHUB_OUTPUT to output summary * Merge valgrind comment * Improve comment * Use `tee` instead of `--log-file` to also print stdout * Improve comment about debug and release * Simplify output writing in parse step * Improve step name * Correct comment about summaries * Remove commented out code * Better var name * Missing copyright * Rename global to shared * Remove space * Revert change to ConfigTests.cpp
89 lines
2.8 KiB
YAML
89 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-16-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
|
|
|
|
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=2
|
|
env:
|
|
SONAR_TOKEN: ${{secrets.SONAR_TOKEN}}
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|