Home | History | Annotate | Download | only in googletest
      1 version: '{build}'
      2 
      3 os: Visual Studio 2015
      4 
      5 environment:
      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 
     12     - compiler: msvc-15-seh
     13       generator: "Visual Studio 15 2017 Win64"
     14       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
     20       APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
     21       enabled_on_pr: yes
     22 
     23     - compiler: msvc-14-seh
     24       build_system: cmake
     25       generator: "Visual Studio 14 2015"
     26       enabled_on_pr: yes
     27 
     28     - compiler: msvc-14-seh
     29       build_system: cmake
     30       generator: "Visual Studio 14 2015 Win64"
     31 
     32     - compiler: gcc-6.3.0-posix
     33       build_system: cmake
     34       generator: "MinGW Makefiles"
     35       cxx_path: 'C:\mingw-w64\i686-6.3.0-posix-dwarf-rt_v5-rev1\mingw32\bin'
     36       enabled_on_pr: yes
     37 
     38 configuration:
     39   - Debug
     40 
     41 build:
     42   verbosity: minimal
     43 
     44 install:
     45 - ps: |
     46     Write-Output "Compiler: $env:compiler"
     47     Write-Output "Generator: $env:generator"
     48     Write-Output "Env:Configuation: $env:configuration"
     49     Write-Output "Env: $env"
     50     if (-not (Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER)) {
     51       Write-Output "This is *NOT* a pull request build"
     52     } else {
     53       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       }
     57     }
     58 
     59     # install Bazel
     60     if ($env:build_system -eq "bazel") {
     61         appveyor DownloadFile https://github.com/bazelbuild/bazel/releases/download/0.21.0/bazel-0.21.0-windows-x86_64.exe -FileName bazel.exe
     62     }
     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             }
     71         }
     72     }
     73 
     74 before_build:
     75 - ps: |
     76      $env:root=$env:APPVEYOR_BUILD_FOLDER
     77      Write-Output "env:root: $env:root"
     78 
     79 build_script:
     80 - ps: |
     81     # Only enable some builds for pull requests, the AppVeyor queue is too long.
     82     if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
     83       return
     84     } 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         }
     95     }
     96     # by default build with CMake
     97     md _build -Force | Out-Null
     98     cd _build
     99 
    100     $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)
    102     $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"}
    104     & cmake -G "$env:generator" $conf -Dgtest_build_samples=ON $gtest_build_tests $gmock_build_tests ..
    105     if ($LastExitCode -ne 0) {
    106         throw "Exec: $ErrorMessage"
    107     }
    108     $cmake_parallel = if ($env:generator -eq "MinGW Makefiles") {"-j2"} else  {"/m"}
    109     & cmake --build . --config $env:configuration -- $cmake_parallel
    110     if ($LastExitCode -ne 0) {
    111         throw "Exec: $ErrorMessage"
    112     }
    113 
    114 
    115 skip_commits:
    116   files:
    117     - '**/*.md'
    118 
    119 test_script:
    120 - ps: |
    121     # Only enable some builds for pull requests, the AppVeyor queue is too long.
    122     if ((Test-Path env:APPVEYOR_PULL_REQUEST_NUMBER) -And (-not (Test-Path env:enabled_on_pr) -or $env:enabled_on_pr -ne "yes")) {
    123       return
    124     }
    125     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         }
    133     }
    134     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         }
    144     }
    145 
    146 artifacts:
    147   - path: '_build/CMakeFiles/*.log'
    148     name: logs
    149   - path: '_build/Testing/**/*.xml'
    150     name: test_results
    151   - path: 'bazel-testlogs/**/test.log'
    152     name: test_logs
    153   - path: 'bazel-testlogs/**/test.xml'
    154     name: test_results
    155