appveyor.yml 3.21 KB
Newer Older
1 2 3 4 5 6
# Cap'n Proto AppVeyor configuration
#
# See https://www.appveyor.com/docs/appveyor-yml/ for configuration options.
#
# This script configures AppVeyor to:
#   - Use CMake to ...
7 8
#       build Cap'n Proto with VS2017.
#       build Cap'n Proto samples with VS2017.
9 10
#       build Cap'n Proto with MinGW.
#       build Cap'n Proto with Cygwin.
11 12 13

version: "{build}"

14 15 16
branches:
  only:
    - master
17
    - /release-.*/
18 19
# Don't build non-master branches (unless they open a pull request).

20 21 22 23 24 25 26
image: Visual Studio 2017
# AppVeyor build worker image (VM template).

shallow_clone: true
# Fetch repository as zip archive.

environment:
27
  MINGW_DIR: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1\mingw64
28 29
  BUILD_TYPE: debug

30 31 32 33 34 35 36 37 38 39 40 41 42
  matrix:
    # TODO(someday): Add MSVC x64 builds, MinGW x86 build?

    - CMAKE_GENERATOR: Visual Studio 15 2017
      BUILD_NAME: vs2017
      EXTRA_BUILD_FLAGS: # /maxcpucount
      # TODO(someday): Right now /maxcpucount occasionally expresses a filesystem-related race:
      #   capnp-capnpc++ complains that it can't create test.capnp.h.

    - CMAKE_GENERATOR: MinGW Makefiles
      BUILD_NAME: mingw
      EXTRA_BUILD_FLAGS: -j2

43 44
    - BUILD_NAME: cygwin

45 46 47 48 49
install:
  - ps: Get-Command sh.exe -All | Remove-Item
  # CMake refuses to generate MinGW Makefiles if sh.exe is in the PATH

before_build:
50
  - set PATH=%MINGW_DIR%\bin;%PATH%
51 52
  - set BUILD_DIR=build-%BUILD_NAME%
  - set INSTALL_PREFIX=%CD%\capnproto-c++-%BUILD_NAME%
53 54 55
  - cmake --version

build_script:
56
  - echo "Building Cap'n Proto with %CMAKE_GENERATOR%"
57 58
  - if NOT "%BUILD_NAME%"=="cygwin" cmake -Hc++ -B%BUILD_DIR% -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_INSTALL_PREFIX=%INSTALL_PREFIX%
  - if NOT "%BUILD_NAME%"=="cygwin" cmake --build %BUILD_DIR% --config %BUILD_TYPE% --target install -- %EXTRA_BUILD_FLAGS%
59 60 61
  # MinGW wants the build type at configure-time while MSVC wants the build type at build-time. We
  # can satisfy both by passing the build type to both cmake invocations. We have to suffer a
  # warning, but both generators will work.
62

63
  - echo "Building Cap'n Proto samples with %CMAKE_GENERATOR%"
64 65 66
  - if NOT "%BUILD_NAME%"=="cygwin" cmake -Hc++/samples -B%BUILD_DIR%-samples -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=%BUILD_TYPE% -DCMAKE_PREFIX_PATH=%INSTALL_PREFIX%
  - if NOT "%BUILD_NAME%"=="cygwin" cmake --build %BUILD_DIR%-samples --config %BUILD_TYPE%

67
  # Cygwin build -- use super-test.sh like other Unix builds.
68 69 70 71
  # But, we need to install Cygwin's cmake package in order to pass the cmake part of super-test.
  # Somewhat ridiculously, this requires downloading Cygwin's setup program and running it.
  - if "%BUILD_NAME%"=="cygwin" appveyor DownloadFile "https://cygwin.com/setup-x86_64.exe" -FileName "C:\cygwin64\setup-x86_64.exe"
  - if "%BUILD_NAME%"=="cygwin" C:\cygwin64\setup-x86_64.exe --quiet-mode --no-shortcuts --upgrade-also --root "C:\cygwin64" --packages cmake
72
  - if "%BUILD_NAME%"=="cygwin" C:\cygwin64\bin\bash -lc 'cd /cygdrive/c/projects/capnproto; ./super-test.sh -j2 quick'
73

74 75
test_script:
  # Sleep a little to prevent interleaving test output with build output.
76 77
  - if NOT "%BUILD_NAME%"=="cygwin" timeout /t 2
  - if NOT "%BUILD_NAME%"=="cygwin" cd %BUILD_DIR%\src
78
  - if NOT "%BUILD_NAME%"=="cygwin" ctest -V -C %BUILD_TYPE%