blob: a58b7687d70028beaac0154171523466ee84fd56 [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
11
12 - compiler: msvc-15-seh
13 generator: "Visual Studio 15 2017 Win64"
Pavel Samolysov91bfc082019-01-22 10:46:59 +030014 build_system: cmake
15 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
16 enabled_on_pr: yes
17
18 - compiler: msvc-15-seh
19 build_system: bazel
Arkady Shapkinb153bfd2017-10-25 18:37:57 +030020 APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050021 enabled_on_pr: yes
Arkady Shapkinb153bfd2017-10-25 18:37:57 +030022
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030023 - compiler: msvc-14-seh
Pavel Samolysov91bfc082019-01-22 10:46:59 +030024 build_system: cmake
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030025 generator: "Visual Studio 14 2015"
Gennadiy Civila3c73ed2018-02-06 11:06:11 -050026 enabled_on_pr: yes
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030027
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030028 - compiler: msvc-14-seh
Pavel Samolysov91bfc082019-01-22 10:46:59 +030029 build_system: cmake
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030030 generator: "Visual Studio 14 2015 Win64"
31
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030032 - compiler: gcc-6.3.0-posix
Pavel Samolysov91bfc082019-01-22 10:46:59 +030033 build_system: cmake
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030034 generator: "MinGW Makefiles"
35 cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
Gennadiy Civil440527a2018-09-26 21:52:12 -070036 enabled_on_pr: yes
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030037
38configuration:
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030039 - Debug
40
41build:
42 verbosity: minimal
43
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030044install:
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030045- ps: |
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030046 Write-Output "Compiler: $env:compiler"
47 Write-Output "Generator: $env:generator"
Gennadiy Civil5eee7a32018-09-12 10:33:31 -040048 Write-Output "Env:Configuation: $env:configuration"
Gennadiy Civil77301d62018-09-25 20:53:57 -070049 Write-Output "Env: $env"
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050050 if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
Carlos O'Ryand3acb4b2018-01-05 09:32:50 -050051 Write-Output "This is *NOT* a pull request build"
52 } else {
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050053 Write-Output "This is a pull request build"
54 if (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes") {
55 Write-Output "PR builds are *NOT* explicitly enabled"
56 }
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050057 }
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030058
Pavel Samolysov91bfc082019-01-22 10:46:59 +030059 # install Bazel
60 if ($env:build_system -eq "bazel") {
Yannic Bonenberger800c9b32019-08-07 17:50:31 +020061 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 +030062 }
63
64 if ($env:build_system -eq "cmake") {
65 # git bash conflicts with MinGW makefiles
66 if ($env:generator -eq "MinGW Makefiles") {
67 $env:path = $env:path.replace("C:\Program Files\Git\usr\bin;", "")
68 if ($env:cxx_path -ne "") {
69 $env:path += ";$env:cxx_path"
70 }
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +030071 }
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030072 }
73
Pavel Samolysov91bfc082019-01-22 10:46:59 +030074before_build:
75- ps: |
76 $env:root=$env:APPVEYOR_BUILD_FOLDER
77 Write-Output "env:root: $env:root"
78
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030079build_script:
80- ps: |
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050081 # Only enable some builds for pull requests, the AppVeyor queue is too long.
Carlos O'Ryanadfdc652018-01-05 11:01:37 -050082 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 -050083 return
Pavel Samolysov91bfc082019-01-22 10:46:59 +030084 } else {
85 # special case - build with Bazel
86 if ($env:build_system -eq "bazel") {
87 & $env:root\bazel.exe build -c opt //:gtest_samples
88 if ($LastExitCode -eq 0) { # bazel writes to StdErr and PowerShell interprets it as an error
89 $host.SetShouldExit(0)
90 } else { # a real error
91 throw "Exec: $ErrorMessage"
92 }
93 return
94 }
Carlos O'Ryan9cee6772018-01-04 13:04:31 -050095 }
Pavel Samolysov91bfc082019-01-22 10:46:59 +030096 # by default build with CMake
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +030097 md _build -Force | Out-Null
98 cd _build
99
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +0300100 $conf = if ($env:generator -eq "MinGW Makefiles") {"-DCMAKE_BUILD_TYPE=$env:configuration"} else {"-DCMAKE_CONFIGURATION_TYPES=Debug;Release"}
101 # Disable test for MinGW (gtest tests fail, gmock tests can not build)
Gennadiy Civilc2a2f492018-09-25 21:58:40 -0700102 $gtest_build_tests = if ($env:generator -eq "MinGW Makefiles") {"-Dgtest_build_tests=OFF"} else {"-Dgtest_build_tests=ON"}
103 $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 +0300104 & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests ..
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300105 if ($LastExitCode -ne 0) {
106 throw "Exec: $ErrorMessage"
107 }
Carlos O'Ryan3431b692018-02-28 11:28:57 -0500108 $cmake_parallel = if ($env:generator -eq "MinGW Makefiles") {"-j2"} else {"/m"}
109 & cmake --build . --config $env:configuration -- $cmake_parallel
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300110 if ($LastExitCode -ne 0) {
111 throw "Exec: $ErrorMessage"
112 }
113
Gennadiy Civilc7ec5932018-06-13 15:47:07 -0400114
115skip_commits:
116 files:
117 - '**/*.md'
118
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300119test_script:
120- ps: |
Carlos O'Ryan9cee6772018-01-04 13:04:31 -0500121 # Only enable some builds for pull requests, the AppVeyor queue is too long.
Carlos O'Ryanadfdc652018-01-05 11:01:37 -0500122 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 -0500123 return
124 }
Pavel Samolysov91bfc082019-01-22 10:46:59 +0300125 if ($env:build_system -eq "bazel") {
126 # special case - testing with Bazel
127 & $env:root\bazel.exe test //:gtest_samples
128 if ($LastExitCode -eq 0) { # bazel writes to StdErr and PowerShell interprets it as an error
129 $host.SetShouldExit(0)
130 } else { # a real error
131 throw "Exec: $ErrorMessage"
132 }
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300133 }
Pavel Samolysov91bfc082019-01-22 10:46:59 +0300134 if ($env:build_system -eq "cmake") {
135 # built with CMake - test with CTest
136 if ($env:generator -eq "MinGW Makefiles") {
137 return # No test available for MinGW
138 }
139
140 & ctest -C $env:configuration --timeout 600 --output-on-failure
141 if ($LastExitCode -ne 0) {
142 throw "Exec: $ErrorMessage"
143 }
Arkadiy Shapkin43c0ae32016-06-25 01:29:18 +0300144 }
Arkadiy Shapkin5dde6682016-09-05 00:55:42 +0300145
146artifacts:
147 - path: '_build/CMakeFiles/*.log'
148 name: logs
149 - path: '_build/Testing/**/*.xml'
150 name: test_results
Pavel Samolysov91bfc082019-01-22 10:46:59 +0300151 - path: 'bazel-testlogs/**/test.log'
152 name: test_logs
153 - path: 'bazel-testlogs/**/test.xml'
154 name: test_results