Skip to content

Commit

Permalink
Add basic CMake testing to AppVeyor
Browse files Browse the repository at this point in the history
To reduce build time impact we just do a quick smoke test (configure &
build).
  • Loading branch information
zeux committed Oct 30, 2024
1 parent 6f8ac9c commit 1a66f1c
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
6 changes: 6 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,16 @@ build_script:
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\scripts\nuget_build.ps1 2022}

test_script:
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\cmake-appveyor.ps1 9 10 11 12 14 }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\tests\cmake-appveyor.ps1 15 }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\tests\cmake-appveyor.ps1 19 }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\tests\cmake-appveyor.ps1 22 }

- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\autotest-appveyor.ps1 9 10 11 12 14 }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\tests\autotest-appveyor.ps1 15 }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\tests\autotest-appveyor.ps1 19 }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\tests\autotest-appveyor.ps1 22 }

- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { & C:\cygwin\bin\bash.exe -c "PATH=/usr/bin:/usr/local/bin:$PATH; make -j2 config=coverage test && bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov 2>&1" }
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { & C:\cygwin\bin\bash.exe -c "PATH=/usr/bin:/usr/local/bin:$PATH; make -j2 config=coverage defines=PUGIXML_WCHAR_MODE test && bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov 2>&1" }

Expand Down
47 changes: 47 additions & 0 deletions tests/cmake-appveyor.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
$failed = $FALSE

foreach ($vs in $args)
{
$target = "cmake_vs${vs}"

Add-AppveyorTest $target -Outcome Running

Write-Output "# Setting up CMake VS$vs"
& cmake . -G "Visual Studio $vs" | Tee-Object -Variable cmakeOutput

$sw = [Diagnostics.Stopwatch]::StartNew()

if ($?)
{
Write-Output "# Building"

& cmake --build . | Tee-Object -Variable cmakeOutput

if ($?)
{
Write-Output "# Passed"

Update-AppveyorTest $target -Outcome Passed -StdOut ($cmakeOutput | out-string) -Duration $sw.ElapsedMilliseconds
}
else
{
Write-Output "# Failed to build"

Update-AppveyorTest $target -Outcome Failed -StdOut ($cmakeOutput | out-string) -ErrorMessage "Building failed"

$failed = $TRUE
}
}
else
{
Write-Output "# Failed to configure"

Update-AppveyorTest $target -Outcome Failed -StdOut ($cmakeOutput | out-string) -ErrorMessage "Configuration failed"

$failed = $TRUE
}
}

if ($failed) { throw "One or more build steps failed" }

Write-Output "# End"

0 comments on commit 1a66f1c

Please sign in to comment.