Workflow #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
with: | |
version: "5.0.0-beta2" | |
path: Vendor/Premake/Bin | |
- name: Setup MSBuild | |
uses: microsoft/[email protected] | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
- name: Setup gcovr | |
run: | | |
pip install gcovr | |
- 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:${{ env.RUNNER_TEMP }}\testoutput.junit.xml" | |
- name: Run gcovr | |
run: | | |
gcovr --sonarqube ${{ env.RUNNER_TEMP }}\testoutput.junit.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=${{ env.RUNNER_TEMP }}\testoutput.junit.xml | |