Skip to content

Commit f1f1b4e

Browse files
committed
Add basic CMake testing to AppVeyor
To reduce build time impact we just do a quick smoke test (configure & build).
1 parent 25b5080 commit f1f1b4e

File tree

2 files changed

+65
-0
lines changed

2 files changed

+65
-0
lines changed

appveyor.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,18 @@ build_script:
1818
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\scripts\nuget_build.ps1 2022}
1919

2020
test_script:
21+
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\cmake-appveyor.ps1 9 2008 }
22+
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\cmake-appveyor.ps1 12 2013 }
23+
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\cmake-appveyor.ps1 14 2015 }
24+
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\tests\cmake-appveyor.ps1 15 2017 }
25+
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\tests\cmake-appveyor.ps1 16 2019 }
26+
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\tests\cmake-appveyor.ps1 17 2022 }
27+
2128
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") { .\tests\autotest-appveyor.ps1 9 10 11 12 14 }
2229
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") { .\tests\autotest-appveyor.ps1 15 }
2330
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2019") { .\tests\autotest-appveyor.ps1 19 }
2431
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2022") { .\tests\autotest-appveyor.ps1 22 }
32+
2533
- 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" }
2634
- 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" }
2735

tests/cmake-appveyor.ps1

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
$failed = $FALSE
2+
3+
$vs = $args[0]
4+
$vsy = $args[1]
5+
6+
$target = "cmake_vs${vs}_${vsy}"
7+
8+
Add-AppveyorTest $target -Outcome Running
9+
10+
mkdir $target
11+
pushd $target
12+
13+
try
14+
{
15+
Write-Output "# Setting up CMake VS$vs"
16+
& cmake .. -G "Visual Studio $vs $vsy" | Tee-Object -Variable cmakeOutput
17+
18+
$sw = [Diagnostics.Stopwatch]::StartNew()
19+
20+
if ($?)
21+
{
22+
Write-Output "# Building"
23+
24+
& cmake --build . | Tee-Object -Variable cmakeOutput
25+
26+
if ($?)
27+
{
28+
Write-Output "# Passed"
29+
30+
Update-AppveyorTest $target -Outcome Passed -StdOut ($cmakeOutput | out-string) -Duration $sw.ElapsedMilliseconds
31+
}
32+
else
33+
{
34+
Write-Output "# Failed to build"
35+
36+
Update-AppveyorTest $target -Outcome Failed -StdOut ($cmakeOutput | out-string) -ErrorMessage "Building failed"
37+
38+
$failed = $TRUE
39+
}
40+
}
41+
else
42+
{
43+
Write-Output "# Failed to configure"
44+
45+
Update-AppveyorTest $target -Outcome Failed -StdOut ($cmakeOutput | out-string) -ErrorMessage "Configuration failed"
46+
47+
$failed = $TRUE
48+
}
49+
}
50+
finally
51+
{
52+
popd
53+
}
54+
55+
if ($failed) { throw "One or more build steps failed" }
56+
57+
Write-Output "# End"

0 commit comments

Comments
 (0)