appveyor.yml 5.0 KB

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