Debug cmake #129
This file contains hidden or 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
| # TODO: Use Infer | |
| # TODO: Use GCC | |
| # TODO: Create commit-hook for auto-formatting | |
| # TODO: Add valgrind / etc. style of tools | |
| # TODO: Add seahorn (export results as sarif into sonar) | |
| # TODO: add frama-c with clang plugin (export results as sarif into sonar) | |
| # TODO: introduce msys2 via opam on the windows image as opam is also needed for infer, frama-c, offers GCC | |
| # TODO: Add formatting check | |
| name: Build and Test | |
| on: | |
| push: | |
| jobs: | |
| build-and-test: | |
| runs-on: windows-latest | |
| env: | |
| # Needed by vcpkg to find the binary cache and | |
| # restore dependencies like Boost faster. | |
| VCPKG_BINARY_SOURCES: clear;x-gha,readwrite | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| # Rebuilding all vcpkg dependencies at each commit is time consuming, | |
| # in particular when Boost is a dependency. So cache binaries. | |
| # https://learn.microsoft.com/en-us/vcpkg/consume/binary-caching-github-actions-cache | |
| - name: Export GitHub Actions cache environment variables | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || ''); | |
| core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || ''); | |
| - name: Install Doxygen | |
| uses: ssciwr/doxygen-install@v1 | |
| - name: Install OpenCppCoverage | |
| uses: KungFuDonkey/Install-OpenCppCoverage@v1 | |
| - name: Install cppcheck | |
| run: | | |
| $url = "https://github.com/danmar/cppcheck/releases/download/2.17.1/cppcheck-2.17.1-x64-Setup.msi" | |
| $output = "cppcheck.msi" | |
| Invoke-WebRequest -Uri $url -OutFile $output | |
| Start-Process ` | |
| -FilePath msiexec ` | |
| -ArgumentList "/package $output /quiet /norestart" ` | |
| -NoNewWindow ` | |
| -Wait | |
| Start-Process ` | |
| -FilePath "C:\Program Files\Cppcheck\cppcheck.exe" ` | |
| -ArgumentList "--version" ` | |
| -NoNewWindow ` | |
| -Wait | |
| - name: Install behave | |
| run: | | |
| pip install behave | |
| behave --version | |
| - name: Build (GCC) | |
| shell: C:\msys64\msys2_shell.cmd -defterm -here -no-start -ucrt64 {0} | |
| env: | |
| MSYSTEM: UCRT64 | |
| CMAKE_TOOLCHAIN_FILE: C:/vcpkg/scripts/buildsystems/vcpkg.cmake | |
| run: | | |
| pacman -S --noconfirm pactoys | |
| pacboy -S --noconfirm cmake:p | |
| cmake --version | |
| which cmake | |
| cmake --workflow --preset x64-Debug-GCC | |
| - name: Build (MSVC) | |
| uses: lukka/run-cmake@v10 | |
| env: | |
| CMAKE_TOOLCHAIN_FILE: C:/vcpkg/scripts/buildsystems/vcpkg.cmake | |
| # LLVM_PATH: C:/Program Files/LLVM/bin/ | |
| with: | |
| workflowPreset: x64-Debug-MSVC | |
| - name: Build (Clang) | |
| uses: lukka/run-cmake@v10 | |
| env: | |
| CMAKE_TOOLCHAIN_FILE: C:/vcpkg/scripts/buildsystems/vcpkg.cmake | |
| LLVM_PATH: C:/Program Files/LLVM/bin/ | |
| with: | |
| workflowPreset: x64-Debug-Clang | |
| - name: Run unit tests | |
| run: | | |
| $dir = "${{ github.workspace }}\out\x64-Debug-MSVC" | |
| New-Item -Path "$dir" -Name "test" -ItemType Directory | |
| Start-Process ` | |
| -FilePath "OpenCppCoverage.exe" ` | |
| -ArgumentList ` | |
| "--working_dir", "`"$dir`"", ` | |
| "--export_type", "`"cobertura:$dir\unit-test-coverage.xml`"", ` | |
| "--cover_children", ` | |
| "--sources", "`"${{ github.workspace }}`"", ` | |
| "--excluded_sources", "`"$dir\vcpkg_installed\*`"", ` | |
| "--", ` | |
| "ctest", ` | |
| "-j", ` | |
| "--verbose", ` | |
| "-T", "Test", ` | |
| "--output-junit", "$dir/TESTS-ctest.xml" ` | |
| -NoNewWindow ` | |
| -Wait | |
| - name: Run system tests | |
| run: | | |
| $dir = "${{ github.workspace }}\out\x64-Debug-MSVC" | |
| Start-Process ` | |
| -FilePath "OpenCppCoverage.exe" ` | |
| -ArgumentList ` | |
| "--working_dir", "`"${{ github.workspace }}\tests`"", ` | |
| "--export_type", "`"cobertura:$dir\system-test-coverage.xml`"", ` | |
| "--cover_children", ` | |
| "--sources", "`"${{ github.workspace }}`"", ` | |
| "--excluded_sources", "`"$dir\vcpkg_installed\*`"", ` | |
| "--", ` | |
| "behave" ` | |
| -NoNewWindow ` | |
| -Wait | |
| - name: Convert JUnit to CPPUnit format | |
| run: | | |
| $dir = "${{ github.workspace }}\out\x64-Debug-MSVC" | |
| $xsltPath = "${{ github.workspace }}\tests\junit-to-cppunit.xsl" | |
| $xslt = New-Object System.Xml.Xsl.XslCompiledTransform | |
| $xslt.Load($xsltPath) | |
| $junitFiles = Get-ChildItem -Path "$dir\*" -Include "TESTS-*.xml" | |
| New-Item -Path $dir -Name "reports" -ItemType Directory | |
| foreach ($inputXmlPath in $junitFiles) { | |
| $outputXmlPath = Join-Path $dir "reports" (Split-Path $inputXmlPath -Leaf) | |
| $inputXml = New-Object System.Xml.XPath.XPathDocument($inputXmlPath) | |
| $outputWriter = New-Object System.Xml.XmlTextWriter($outputXmlPath, $null) | |
| $xslt.Transform($inputXml, $outputWriter) | |
| $outputWriter.Close() | |
| } | |
| # This step depends on the compile commands database created by CMake for | |
| # the Clang build. | |
| - name: Analyze (cppcheck) | |
| run: | | |
| Start-Process ` | |
| -FilePath "C:\Program Files\Cppcheck\cppcheck.exe" ` | |
| -ArgumentList ` | |
| "--project=`"${{ github.workspace }}/hello.cppcheck`"", ` | |
| "--output-file=`"${{ github.workspace }}/out/x64-Debug-Clang/cppcheck.sarif`"", ` | |
| "--output-format=sarif" ` | |
| -NoNewWindow ` | |
| -Wait | |
| # This step depends on the compile commands database created by CMake for | |
| # the Clang build. | |
| - name: SonarQube Scan | |
| uses: SonarSource/sonarqube-scan-action@v5 | |
| env: | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |