diff --git a/.github/workflows/sonarcube.yml b/.github/workflows/sonarcube.yml new file mode 100644 index 00000000..3ff86108 --- /dev/null +++ b/.github/workflows/sonarcube.yml @@ -0,0 +1,63 @@ +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: 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 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" + \ No newline at end of file diff --git a/.github/workflows/test-report.yml b/.github/workflows/test-report.yml index 2ccdaa4a..715fd2d2 100644 --- a/.github/workflows/test-report.yml +++ b/.github/workflows/test-report.yml @@ -2,7 +2,7 @@ name: Test Report on: workflow_run: - workflows: [ develop, master ] + workflows: [ CI ] types: - completed diff --git a/sonar-project.properties b/sonar-project.properties new file mode 100644 index 00000000..475fd2dc --- /dev/null +++ b/sonar-project.properties @@ -0,0 +1,2 @@ +sonar.projectKey=nepp95_EppoEngine +sonar.organization=nepp95 \ No newline at end of file