Skip to content

Workflow

Workflow #16

Workflow file for this run

name: Sonarcube Analysis
on:
workflow_dispatch:
push:
branches: [ develop, master ]
pull_request:
branches: [ develop, master ]
jobs:
config-matrix:
runs-on: [ windows-latest ]
name: Build and Analyze
strategy:
matrix:
config: [ Debug, Release, Dist ]
env:
BUILD_WRAPPER_OUT_DIR: build_wrapper_output_directory
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install sonar-scanner and build-wrapper
uses: SonarSource/sonarcloud-github-c-cpp@v3
- name: Setup Premake
uses: abel0b/setup-premake@v2.3
with:
version: "5.0.0-beta2"
path: Vendor/Premake/Bin
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1.3.1
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Setup gcovr
run: |
pip install gcovr==5.0
- name: Cache VulkanSDK
id: cache-vulkansdk
uses: actions/cache@v4
with:
path: "C:/VulkanSDK"
key: vulkansdk
- name: Download and Install VulkanSDK
if: steps.cache-vulkansdk.outputs.cache-hit != 'true'
shell: pwsh
run: |
Invoke-WebRequest -Uri https://sdk.lunarg.com/sdk/download/1.3.275.0/windows/VulkanSDK-1.3.275.0-Installer.exe -OutFile VulkanSDK.exe
.\VulkanSDK.exe --accept-licenses --default-answer --confirm-command install com.lunarg.vulkan.debug
- name: Run Premake
run: .\Vendor\Premake\Bin\Premake5.exe vs2022
- name: Run build-wrapper
run: |
build-wrapper-win-x86-64 --out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }} msbuild /m /t:rebuild /nodeReuse:false /p:Configuration=${{ matrix.config }} EppoEngine.sln
- name: Run tests
run: |
.\Bin\${{ matrix.config }}-windows-x86_64\EppoTesting\EppoTesting.exe --gtest_output="xml:testoutput.xml"
- name: Save test output
uses: actions/upload-artifact@v4
with:
name: testoutput-${{ matrix.config }}
path: testoutput.xml
- name: Run gcovr
run: |
gcovr --sonarqube testoutput.xml > coverage.xml
- name: Save coverage
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.config }}
path: coverage.xml
- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
run: |
sonar-scanner --define sonar.cfamily.compile-commands="${{ env.BUILD_WRAPPER_OUT_DIR }}/compile_commands.json" --define sonar.coverageReportPaths=coverage.xml