|
| 1 | +# Copyright (c) 2026 Lukasz Stalmirski |
| 2 | +# |
| 3 | +# Permission is hereby granted, free of charge, to any person obtaining a copy |
| 4 | +# of this software and associated documentation files (the "Software"), to deal |
| 5 | +# in the Software without restriction, including without limitation the rights |
| 6 | +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 7 | +# copies of the Software, and to permit persons to whom the Software is |
| 8 | +# furnished to do so, subject to the following conditions: |
| 9 | +# |
| 10 | +# The above copyright notice and this permission notice shall be included in all |
| 11 | +# copies or substantial portions of the Software. |
| 12 | +# |
| 13 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 15 | +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 16 | +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 17 | +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 18 | +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 19 | +# SOFTWARE. |
| 20 | + |
| 21 | +name: Coverity Scan |
| 22 | + |
| 23 | +on: |
| 24 | + workflow_dispatch: |
| 25 | +# schedule: |
| 26 | +# - cron: '00 09 * * 6' |
| 27 | + |
| 28 | +jobs: |
| 29 | + build: |
| 30 | + runs-on: windows-latest |
| 31 | + permissions: |
| 32 | + contents: read |
| 33 | + actions: read |
| 34 | + security-events: write |
| 35 | + |
| 36 | + steps: |
| 37 | + - uses: actions/checkout@v6 |
| 38 | + with: |
| 39 | + submodules: recursive |
| 40 | + fetch-depth: 0 |
| 41 | + |
| 42 | + - uses: actions/setup-python@v6 |
| 43 | + with: |
| 44 | + python-version: '3.12' |
| 45 | + cache: 'pip' |
| 46 | + - run: | |
| 47 | + python3 -m pip install ` |
| 48 | + -r '${{ github.workspace }}/VkLayer_profiler_layer/scripts/requirements.txt' |
| 49 | +
|
| 50 | + - name: Get Coverity Build Tools |
| 51 | + id: get-coverity |
| 52 | + run: | |
| 53 | + $request = @{ |
| 54 | + Uri = 'https://scan.coverity.com/download/cxx/win64' |
| 55 | + Method = 'POST' |
| 56 | + Body = @{ |
| 57 | + token = '${{ secrets.COVERITY_PASSPHRASE }}' |
| 58 | + project = '${{ github.repository }}' |
| 59 | + } |
| 60 | + } |
| 61 | + |
| 62 | + Invoke-WebRequest @request -OutFile cov_build_tools.zip |
| 63 | + Expand-Archive cov_build_tools.zip |
| 64 | + |
| 65 | + $cov_build_exe = (Get-ChildItem -Recurse "cov_build_tools/*/cov-build.exe").FullName |
| 66 | + if (-Not $cov_build_exe) { |
| 67 | + Write-Error "Coverity build tool not found." |
| 68 | + exit 1 |
| 69 | + } |
| 70 | + |
| 71 | + echo "cov_build_exe=$cov_build_exe" >> $env:GITHUB_OUTPUT |
| 72 | +
|
| 73 | + - name: Configure CMake |
| 74 | + id: configure |
| 75 | + run: | |
| 76 | + $source_dir = '${{ github.workspace }}' |
| 77 | + $build_dir = '${{ github.workspace }}/build' |
| 78 | + |
| 79 | + cmake -S $source_dir -B $build_dir |
| 80 | + |
| 81 | + echo "source_dir=$source_dir" >> $env:GITHUB_OUTPUT |
| 82 | + echo "build_dir=$build_dir" >> $env:GITHUB_OUTPUT |
| 83 | +
|
| 84 | + - name: Build |
| 85 | + run: | |
| 86 | + ${{ steps.get-coverity.outputs.cov_build_exe }} ` |
| 87 | + --dir cov-int ` |
| 88 | + cmake --build ${{ steps.configure.outputs.build_dir }} ` |
| 89 | + --config Release -j |
| 90 | +
|
| 91 | + - name: Package |
| 92 | + id: package |
| 93 | + run: | |
| 94 | + $profiler_version = (python3 '${{ github.workspace }}/VkLayer_profiler_layer/scripts/gen_version.py') |
| 95 | + if (-Not $profiler_version) { |
| 96 | + Write-Error "Profiler version not found." |
| 97 | + exit 1 |
| 98 | + } |
| 99 | + |
| 100 | + $profiler_build_zip = "$($profiler_version).zip" |
| 101 | + Compress-Archive cov-int -DestinationPath $profiler_build_zip |
| 102 | + |
| 103 | + echo "profiler_version=$profiler_version" >> $env:GITHUB_OUTPUT |
| 104 | + echo "profiler_build_zip=$profiler_build_zip" >> $env:GITHUB_OUTPUT |
| 105 | +
|
| 106 | + - uses: actions/upload-artifact@v7 |
| 107 | + with: |
| 108 | + path: ${{ steps.package.outputs.profiler_build_zip }} |
| 109 | + archive: false |
| 110 | + |
| 111 | + - name: Submit |
| 112 | + run: | |
| 113 | + $project_name = [uri]::EscapeDataString("${{ github.repository }}") |
| 114 | + $project_uri = "https://scan.coverity.com/builds?project=$project_name" |
| 115 | + $form = @{ |
| 116 | + token = '${{ secrets.COVERITY_PASSPHRASE }}' |
| 117 | + email = '${{ secrets.COVERITY_USER }}' |
| 118 | + file = Get-Item -Path '${{ steps.package.outputs.profiler_build_zip }}' |
| 119 | + version = '${{ steps.package.outputs.profiler_version }}' |
| 120 | + } |
| 121 | + |
| 122 | + #Invoke-WebRequest -Uri $project_uri -Method Post -Form $form |
0 commit comments