Skip to content

Commit 781e2db

Browse files
authored
Merge pull request #643 from zeux/cmake-test
Enhance CMake testing in CI
2 parents 4d0043f + f1f1b4e commit 781e2db

File tree

3 files changed

+81
-0
lines changed

3 files changed

+81
-0
lines changed

.github/workflows/build.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,22 @@ jobs:
3434
make test defines=${{matrix.defines}} config=coverage -j2
3535
bash <(curl -s https://codecov.io/bash) -f pugixml.cpp.gcov -X search -t ${{secrets.CODECOV_TOKEN}} -B ${{github.ref}}
3636
37+
unix-cmake:
38+
strategy:
39+
matrix:
40+
os: [ubuntu, macos]
41+
name: ${{matrix.os}} cmake
42+
runs-on: ${{matrix.os}}-latest
43+
steps:
44+
- uses: actions/checkout@v1
45+
- name: cmake configure
46+
run: |
47+
mkdir cmake && cd cmake
48+
cmake .. -D PUGIXML_BUILD_TESTS=ON
49+
- name: cmake test
50+
run: |
51+
make -C cmake -j2
52+
3753
windows:
3854
runs-on: windows-latest
3955
strategy:

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)