|
| 1 | +name: CI Windows Coverity |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - master |
| 7 | + paths: |
| 8 | + - 'include/sys/*' |
| 9 | + - 'src/common/*' |
| 10 | + - 'src/windows/*' |
| 11 | + - 'test/*' |
| 12 | + - '.github/workflows/ci-windows-coverity.yml' |
| 13 | + |
| 14 | +jobs: |
| 15 | + windows-coverity: |
| 16 | + if: github.repository == 'mheily/libkqueue' |
| 17 | + timeout-minutes: 20 |
| 18 | + runs-on: windows-2022 |
| 19 | + name: "ci-windows-coverity" |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v5 |
| 22 | + |
| 23 | + - name: Download coverity tool MD5 |
| 24 | + shell: pwsh |
| 25 | + run: | |
| 26 | + $project = [uri]::EscapeDataString($env:GITHUB_REPOSITORY) |
| 27 | + Invoke-WebRequest ` |
| 28 | + -Uri "https://scan.coverity.com/download/win64" ` |
| 29 | + -Method Post ` |
| 30 | + -ContentType "application/x-www-form-urlencoded" ` |
| 31 | + -Body "token=$($env:TOKEN)&project=$project&md5=1" ` |
| 32 | + -OutFile coverity_tool.zip.md5 |
| 33 | + env: |
| 34 | + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
| 35 | + |
| 36 | + - name: Cache coverity tool |
| 37 | + uses: actions/cache@v4 |
| 38 | + id: cache-coverity |
| 39 | + with: |
| 40 | + path: coverity_tool.zip |
| 41 | + key: coverity-tool-win64-${{ hashFiles('coverity_tool.zip.md5') }} |
| 42 | + |
| 43 | + - name: Download coverity tool |
| 44 | + if: steps.cache-coverity.outputs.cache-hit != 'true' |
| 45 | + shell: pwsh |
| 46 | + run: | |
| 47 | + $project = [uri]::EscapeDataString($env:GITHUB_REPOSITORY) |
| 48 | + Invoke-WebRequest ` |
| 49 | + -Uri "https://scan.coverity.com/download/win64" ` |
| 50 | + -Method Post ` |
| 51 | + -ContentType "application/x-www-form-urlencoded" ` |
| 52 | + -Body "token=$($env:TOKEN)&project=$project" ` |
| 53 | + -OutFile coverity_tool.zip |
| 54 | + env: |
| 55 | + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
| 56 | + |
| 57 | + - name: Extract coverity tool |
| 58 | + shell: pwsh |
| 59 | + run: | |
| 60 | + Expand-Archive -Path coverity_tool.zip -DestinationPath coverity_tool_stage |
| 61 | + $inner = Get-ChildItem -Path coverity_tool_stage -Directory | Select-Object -First 1 |
| 62 | + Move-Item -Path $inner.FullName -Destination coverity_tool |
| 63 | +
|
| 64 | + - name: Configure build system |
| 65 | + shell: pwsh |
| 66 | + run: | |
| 67 | + cmake -S . -B build_x64 -A x64 -G "Visual Studio 17 2022" ` |
| 68 | + -DSTATICLIB=ON ` |
| 69 | + -DCMAKE_BUILD_TYPE=Debug ` |
| 70 | + -DCMAKE_VERBOSE_MAKEFILE=ON |
| 71 | +
|
| 72 | + - name: Build with coverity |
| 73 | + shell: pwsh |
| 74 | + run: | |
| 75 | + $env:PATH = "$(Get-Location)\coverity_tool\bin;$env:PATH" |
| 76 | + cov-configure --msvc |
| 77 | + cov-build --dir cov-int cmake --build build_x64 --config Debug --parallel 1 |
| 78 | +
|
| 79 | + - name: Display build result |
| 80 | + shell: pwsh |
| 81 | + run: | |
| 82 | + Get-Content cov-int\build-log.txt |
| 83 | +
|
| 84 | + - name: Submit result |
| 85 | + shell: pwsh |
| 86 | + run: | |
| 87 | + $project = [uri]::EscapeDataString($env:GITHUB_REPOSITORY) |
| 88 | + $version = (Select-String -Path version.h -Pattern 'LIBKQUEUE_VERSION_STRING\s+"([^"]+)"').Matches[0].Groups[1].Value |
| 89 | + tar -czf cov-int.tar.gz cov-int |
| 90 | + curl.exe ` |
| 91 | + --form "token=$env:TOKEN" ` |
| 92 | + --form "email=a.cudbardb@freeradius.org" ` |
| 93 | + --form "file=@cov-int.tar.gz" ` |
| 94 | + --form "version=$version" ` |
| 95 | + --form "description=$env:GITHUB_REPOSITORY" ` |
| 96 | + "https://scan.coverity.com/builds?project=$project" |
| 97 | + env: |
| 98 | + TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }} |
0 commit comments