fix: ci fix + code measurement reported (#5)

* patch: code coverage

* fix: ci fix
This commit is contained in:
Sebastian Dine
2026-05-09 15:01:22 +02:00
committed by GitHub
parent 108863b795
commit a691291413
3 changed files with 64 additions and 15 deletions
+18 -2
View File
@@ -27,17 +27,32 @@ jobs:
sudo apt-get install -y
cmake
ninja-build
gcovr
pkg-config
libgtk-3-dev
libwxgtk3.2-dev
- name: Generate compile commands
- name: Configure with coverage instrumentation
run: >
cmake -S . -B build -G Ninja
-DCCM_BUILD_TESTS=OFF
-DCCM_BUILD_TESTS=ON
-DCCM_USE_SYSTEM_WX=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_FLAGS=--coverage
-DCMAKE_CXX_FLAGS=--coverage
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Build and run tests for coverage
run: >
cmake --build build --parallel &&
ctest --test-dir build --output-on-failure
- name: Generate Sonar coverage report
run: >
gcovr -r .
--sonarqube build/sonarqube-coverage.xml
--exclude "build/_deps/"
- name: SonarQube Cloud scan
uses: SonarSource/sonarqube-scan-action@v5
env:
@@ -50,6 +65,7 @@ jobs:
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.sources=core,ui_wx,app
-Dsonar.cfamily.compile-commands=build/compile_commands.json
-Dsonar.coverageReportPaths=build/sonarqube-coverage.xml
linux:
name: Linux build + tests
+43 -12
View File
@@ -1,11 +1,6 @@
name: Master CI
on:
pull_request:
branches:
- master
types:
- closed
push:
branches:
- master
@@ -16,7 +11,6 @@ permissions:
jobs:
sonarqube:
name: SonarQube Cloud scan
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
@@ -33,17 +27,32 @@ jobs:
sudo apt-get install -y
cmake
ninja-build
gcovr
pkg-config
libgtk-3-dev
libwxgtk3.2-dev
- name: Generate compile commands
- name: Configure with coverage instrumentation
run: >
cmake -S . -B build -G Ninja
-DCCM_BUILD_TESTS=OFF
-DCCM_BUILD_TESTS=ON
-DCCM_USE_SYSTEM_WX=ON
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_FLAGS=--coverage
-DCMAKE_CXX_FLAGS=--coverage
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: Build and run tests for coverage
run: >
cmake --build build --parallel &&
ctest --test-dir build --output-on-failure
- name: Generate Sonar coverage report
run: >
gcovr -r .
--sonarqube build/sonarqube-coverage.xml
--exclude "build/_deps/"
- name: SonarQube Cloud scan
uses: SonarSource/sonarqube-scan-action@v5
env:
@@ -56,23 +65,45 @@ jobs:
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.sources=core,ui_wx,app
-Dsonar.cfamily.compile-commands=build/compile_commands.json
-Dsonar.coverageReportPaths=build/sonarqube-coverage.xml
compute-version:
name: Determine semantic version
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
release_tag: ${{ steps.version.outputs.release_tag }}
pr_title: ${{ steps.pr.outputs.pr_title }}
steps:
- name: Checkout tags
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve merged PR title for pushed commit
id: pr
uses: actions/github-script@v7
with:
script: |
const { owner, repo } = context.repo;
const commitSha = context.sha;
const pulls = await github.rest.repos.listPullRequestsAssociatedWithCommit({
owner,
repo,
commit_sha: commitSha,
});
if (!pulls.data.length) {
core.setFailed(`No PR found for commit ${commitSha}. Release flow expects merges into master through PRs.`);
return;
}
const mergedPr = pulls.data.find((pr) => pr.merged_at) ?? pulls.data[0];
core.setOutput("pr_title", mergedPr.title);
- name: Resolve semantic version
id: version
run: bash scripts/compute_master_semver.sh "${{ github.event.pull_request.title }}"
run: bash scripts/compute_master_semver.sh "${{ steps.pr.outputs.pr_title }}"
build-windows:
name: Windows build + tests
@@ -82,7 +113,7 @@ jobs:
uses: ./.github/workflows/master-windows.yml
with:
version: ${{ needs.compute-version.outputs.version }}
merge_commit_sha: ${{ github.event.pull_request.merge_commit_sha }}
merge_commit_sha: ${{ github.sha }}
release-master:
name: Tag and release on master
@@ -114,6 +145,6 @@ jobs:
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compute-version.outputs.release_tag }}
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
target_commitish: ${{ github.sha }}
generate_release_notes: true
files: release-assets/*
+3 -1
View File
@@ -1,6 +1,8 @@
# Card Collection Manager 3
[![SonarQube Cloud](https://sonarcloud.io/images/project_badges/sonarcloud-dark.svg)](https://sonarcloud.io/summary/new_code?id=sebastiandine_Card-Collection-Manager-3)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=sebastiandine_Card-Collection-Manager-3&metric=alert_status&token=a7e5822db3829af68223a1d3710f3105ff9543bc)](https://sonarcloud.io/summary/new_code?id=sebastiandine_Card-Collection-Manager-3)
[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=sebastiandine_Card-Collection-Manager-3&metric=bugs&token=a7e5822db3829af68223a1d3710f3105ff9543bc)](https://sonarcloud.io/summary/new_code?id=sebastiandine_Card-Collection-Manager-3)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=sebastiandine_Card-Collection-Manager-3&metric=security_rating&token=a7e5822db3829af68223a1d3710f3105ff9543bc)](https://sonarcloud.io/summary/new_code?id=sebastiandine_Card-Collection-Manager-3)
Card Collection Manager 3 is an extensible desktop application for managing trading card game collections. It is designed as a practical way to track cards and manage per-card images for large collections, with local per-game data, set synchronization workflows, and a desktop-first UX. The app preserves the established JSON layout from earlier CCM versions so existing collections stay compatible.