Files
Card-Collection-Manager-3/.github/workflows/master-ci.yml
T
Sebastian Dine c434ee51a7 fix: sonarqube (#3)
* sonarqube

* sonarqube

* sonarqube

---------

Co-authored-by: sdine <sdine@sdine.com>
2026-05-09 14:43:03 +02:00

120 lines
3.5 KiB
YAML

name: Master CI
on:
pull_request:
branches:
- master
types:
- closed
push:
branches:
- master
permissions:
contents: write
jobs:
sonarqube:
name: SonarQube Cloud scan
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Compute Sonar project key
run: echo "SONAR_PROJECT_KEY=${GITHUB_REPOSITORY/\//_}" >> "$GITHUB_ENV"
- name: Install scan prerequisites
run: >
sudo apt-get update &&
sudo apt-get install -y
cmake
ninja-build
pkg-config
libgtk-3-dev
libwxgtk3.2-dev
- name: Generate compile commands
run: >
cmake -S . -B build -G Ninja
-DCCM_BUILD_TESTS=OFF
-DCCM_USE_SYSTEM_WX=ON
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON
- name: SonarQube Cloud scan
uses: SonarSource/sonarqube-scan-action@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
with:
args: >
-Dsonar.host.url=https://sonarcloud.io
-Dsonar.organization=${{ github.repository_owner }}
-Dsonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
-Dsonar.sources=core,ui_wx,app
-Dsonar.cfamily.compile-commands=build/compile_commands.json
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 }}
steps:
- name: Checkout tags
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Resolve semantic version
id: version
run: bash scripts/compute_master_semver.sh "${{ github.event.pull_request.title }}"
build-windows:
name: Windows build + tests
needs:
- sonarqube
- compute-version
uses: ./.github/workflows/master-windows.yml
with:
version: ${{ needs.compute-version.outputs.version }}
merge_commit_sha: ${{ github.event.pull_request.merge_commit_sha }}
release-master:
name: Tag and release on master
needs:
- compute-version
- build-windows
runs-on: ubuntu-latest
steps:
- name: Download Windows artifact
uses: actions/download-artifact@v4
with:
name: ccm3-windows-${{ needs.compute-version.outputs.version }}.zip
path: release/windows
- name: Download Windows installer artifact
uses: actions/download-artifact@v4
with:
name: ccm3-windows-installer-${{ needs.compute-version.outputs.version }}
path: release/installer
- name: Package release assets with semantic version
run: |
mkdir -p release-assets
VERSION="${{ needs.compute-version.outputs.version }}"
zip -r "release-assets/ccm3-windows-${VERSION}.zip" release/windows
cp release/installer/ccm3-windows-installer.exe "release-assets/ccm3-windows-installer-${VERSION}.exe"
- name: Create tag and GitHub release
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.compute-version.outputs.release_tag }}
target_commitish: ${{ github.event.pull_request.merge_commit_sha }}
generate_release_notes: true
files: release-assets/*