1version: '{build}' 2 3os: Visual Studio 2015 4 5environment: 6 matrix: 7 - compiler: msvc-15-seh 8 generator: "Visual Studio 15 2017" 9 build_system: cmake 10 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 11 enabled_on_pr: yes 12 13 - compiler: msvc-15-seh 14 generator: "Visual Studio 15 2017 Win64" 15 build_system: cmake 16 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 17 enabled_on_pr: yes 18 19 - compiler: msvc-15-seh 20 build_system: bazel 21 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 22 enabled_on_pr: yes 23 24 - compiler: msvc-14-seh 25 build_system: cmake 26 generator: "Visual Studio 14 2015" 27 enabled_on_pr: yes 28 29 - compiler: msvc-14-seh 30 build_system: cmake 31 generator: "Visual Studio 14 2015 Win64" 32 enabled_on_pr: yes 33 34 - compiler: gcc-6.3.0-posix 35 build_system: cmake 36 generator: "MinGW Makefiles" 37 cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin' 38 enabled_on_pr: yes 39 40configuration: 41 - Debug 42 43build: 44 verbosity: minimal 45 46install: 47- ps: | 48 Write-Output "Compiler: $env:compiler" 49 Write-Output "Generator: $env:generator" 50 Write-Output "Env:Configuation: $env:configuration" 51 Write-Output "Env: $env" 52 if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) { 53 Write-Output "This is *NOT* a pull request build" 54 } else { 55 Write-Output "This is a pull request build" 56 if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") { 57 Write-Output "PR builds are *NOT* explicitly enabled" 58 } 59 } 60 61 # install Bazel 62 if ($env:build_system -eq "bazel") { 63 appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.28.1/bazel-0.28.1-windows-x86_64.exe -FileName bazel.exe 64 } 65 66 if ($env:build_system -eq "cmake") { 67 # git bash conflicts with MinGW makefiles 68 if ($env:generator -eq "MinGW Makefiles") { 69 $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "") 70 if ($env:cxx_path -ne "") { 71 $env:path += ";$env:cxx_path" 72 } 73 } 74 } 75 76before_build: 77- ps: | 78 $env:root=$env:APPVEYOR_BUILD_FOLDER 79 Write-Output "env:root: $env:root" 80 81build_script: 82- ps: | 83 # Only enable some builds for pull requests, the AppVeyor queue is too long. 84 if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { 85 return 86 } else { 87 # special case - build with Bazel 88 if ($env:build_system -eq "bazel") { 89 & $env:root\bazel.exe build -c opt //:gtest_samples 90 if ($LastExitCode -eq 0) { # bazel writes to StdErr and PowerShell interprets it as an error 91 $host.SetShouldExit(0) 92 } else { # a real error 93 throw "Exec: $ErrorMessage" 94 } 95 return 96 } 97 } 98 # by default build with CMake 99 md _build -Force | Out-Null 100 cd _build 101 102 $conf = if ($env:generator -eq "MinGW Makefiles") {"-DCMAKE_BUILD_TYPE=$env:configuration"} else {"-DCMAKE_CONFIGURATION_TYPES=Debug;Release"} 103 # Disable test for MinGW (gtest tests fail, gmock tests can not build) 104 $gtest_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgtest_build_tests=OFF"} else {"-Dgtest_build_tests=ON"} 105 $gmock_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgmock_build_tests=OFF"} else {"-Dgmock_build_tests=ON"} 106 & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests .. 107 if ($LastExitCode -ne 0) { 108 throw "Exec: $ErrorMessage" 109 } 110 $cmake_parallel = if ($env:generator -eq "MinGW Makefiles") {"-j2"} else {"/m"} 111 & cmake --build . --config $env:configuration -- $cmake_parallel 112 if ($LastExitCode -ne 0) { 113 throw "Exec: $ErrorMessage" 114 } 115 116 117skip_commits: 118 files: 119 - '**/*.md' 120 121test_script: 122- ps: | 123 # Only enable some builds for pull requests, the AppVeyor queue is too long. 124 if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) { 125 return 126 } 127 if ($env:build_system -eq "bazel") { 128 # special case - testing with Bazel 129 & $env:root\bazel.exe test //:gtest_samples 130 if ($LastExitCode -eq 0) { # bazel writes to StdErr and PowerShell interprets it as an error 131 $host.SetShouldExit(0) 132 } else { # a real error 133 throw "Exec: $ErrorMessage" 134 } 135 } 136 if ($env:build_system -eq "cmake") { 137 # built with CMake - test with CTest 138 if ($env:generator -eq "MinGW Makefiles") { 139 return # No test available for MinGW 140 } 141 142 & ctest -C $env:configuration --timeout 600 --output-on-failure 143 if ($LastExitCode -ne 0) { 144 throw "Exec: $ErrorMessage" 145 } 146 } 147 148artifacts: 149 - path: '_build/CMakeFiles/*.log' 150 name: logs 151 - path: '_build/Testing/**/*.xml' 152 name: test_results 153 - path: 'bazel-testlogs/**/test.log' 154 name: test_logs 155 - path: 'bazel-testlogs/**/test.xml' 156 name: test_results 157