blob: ec155a76ad30ffd33c5c50b9a3002245840492c6 [file] [log] [blame]
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +03001version: '{build}'
2
3os: Visual Studio 2015
4
5environment:
6 matrix:
Arkady Shapkinb153bfd2017-10-25 18:37:57 +03007 - compiler: msvc-15-seh
8 generator: "Visual Studio 15 2017"
Pavel Samolysov91bfc082019-01-22 10:46:59 +03009 build_system: cmake
Arkady Shapkinb153bfd2017-10-25 18:37:57 +030010 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
misterg62510712019-12-06 13:01:34 -050011 enabled_on_pr: yes
Arkady Shapkinb153bfd2017-10-25 18:37:57 +030012
13 - compiler: msvc-15-seh
14 generator: "Visual Studio 15 2017 Win64"
Pavel Samolysov91bfc082019-01-22 10:46:59 +030015 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
Arkady Shapkinb153bfd2017-10-25 18:37:57 +030021 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050022 enabled_on_pr: yes
Arkady Shapkinb153bfd2017-10-25 18:37:57 +030023
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030024 - compiler: msvc-14-seh
Pavel Samolysov91bfc082019-01-22 10:46:59 +030025 build_system: cmake
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030026 generator: "Visual Studio 14 2015"
Gennadiy Civila3c73ed2018-02-06 11:06:11 -050027 enabled_on_pr: yes
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030028
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030029 - compiler: msvc-14-seh
Pavel Samolysov91bfc082019-01-22 10:46:59 +030030 build_system: cmake
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030031 generator: "Visual Studio 14 2015 Win64"
misterg62510712019-12-06 13:01:34 -050032 enabled_on_pr: yes
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030033
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030034 - compiler: gcc-6.3.0-posix
Pavel Samolysov91bfc082019-01-22 10:46:59 +030035 build_system: cmake
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030036 generator: "MinGW Makefiles"
37 cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
Gennadiy Civil440527a2018-09-26 21:52:12 -070038 enabled_on_pr: yes
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030039
40configuration:
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030041 - Debug
42
43build:
44 verbosity: minimal
45
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030046install:
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030047- ps: |
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030048 Write-Output "Compiler: $env:compiler"
49 Write-Output "Generator: $env:generator"
Gennadiy Civil5eee7a32018-09-12 10:33:31 -040050 Write-Output "Env:Configuation: $env:configuration"
Gennadiy Civil77301d62018-09-25 20:53:57 -070051 Write-Output "Env: $env"
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050052 if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
Carlos O'Ryand3acb4b2018-01-05 09:32:50 -050053 Write-Output "This is *NOT* a pull request build"
54 } else {
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050055 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 }
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050059 }
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030060
Pavel Samolysov91bfc082019-01-22 10:46:59 +030061 # install Bazel
62 if ($env:build_system -eq "bazel") {
Yannic Bonenberger800c9b32019-08-07 17:50:31 +020063 appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.28.1/bazel-0.28.1-windows-x86_64.exe -FileName bazel.exe
Pavel Samolysov91bfc082019-01-22 10:46:59 +030064 }
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 }
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030073 }
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030074 }
75
Pavel Samolysov91bfc082019-01-22 10:46:59 +030076before_build:
77- ps: |
78 $env:root=$env:APPVEYOR_BUILD_FOLDER
79 Write-Output "env:root: $env:root"
80
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030081build_script:
82- ps: |
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050083 # Only enable some builds for pull requests, the AppVeyor queue is too long.
Carlos O'Ryanadfdc652018-01-05 11:01:37 -050084 if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050085 return
Pavel Samolysov91bfc082019-01-22 10:46:59 +030086 } 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 }
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050097 }
Pavel Samolysov91bfc082019-01-22 10:46:59 +030098 # by default build with CMake
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030099 md _build -Force | Out-Null
100 cd _build
101
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +0300102 $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)
Gennadiy Civilc2a2f492018-09-25 21:58:40 -0700104 $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"}
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +0300106 & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests ..
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300107 if ($LastExitCode -ne 0) {
108 throw "Exec: $ErrorMessage"
109 }
Carlos O'Ryan3431b692018-02-28 11:28:57 -0500110 $cmake_parallel = if ($env:generator -eq "MinGW Makefiles") {"-j2"} else {"/m"}
111 & cmake --build . --config $env:configuration -- $cmake_parallel
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300112 if ($LastExitCode -ne 0) {
113 throw "Exec: $ErrorMessage"
114 }
115
Gennadiy Civilc7ec5932018-06-13 15:47:07 -0400116
117skip_commits:
118 files:
119 - '**/*.md'
120
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300121test_script:
122- ps: |
Carlos O'Ryan9cee6772018-01-04 13:04:31 -0500123 # Only enable some builds for pull requests, the AppVeyor queue is too long.
Carlos O'Ryanadfdc652018-01-05 11:01:37 -0500124 if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
Carlos O'Ryan9cee6772018-01-04 13:04:31 -0500125 return
126 }
Pavel Samolysov91bfc082019-01-22 10:46:59 +0300127 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 }
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300135 }
Pavel Samolysov91bfc082019-01-22 10:46:59 +0300136 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 }
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300146 }
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +0300147
148artifacts:
149 - path: '_build/CMakeFiles/*.log'
150 name: logs
151 - path: '_build/Testing/**/*.xml'
152 name: test_results
Pavel Samolysov91bfc082019-01-22 10:46:59 +0300153 - path: 'bazel-testlogs/**/test.log'
154 name: test_logs
155 - path: 'bazel-testlogs/**/test.xml'
156 name: test_results