You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

154 lines
5.0 KiB

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