.appveyor.yml 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. version: 1.0.{build}
  2. clone_depth: 50
  3. # Appveyor images are named after the Visual Studio version they contain.
  4. # But we compile using MinGW, not Visual Studio.
  5. # We use these images because they have different Windows versions.
  6. image:
  7. # Windows Server 2019
  8. - Visual Studio 2019
  9. # Windows Server 2012 R2
  10. - Visual Studio 2015
  11. environment:
  12. compiler: mingw
  13. matrix:
  14. - target: i686-w64-mingw32
  15. compiler_path: mingw32
  16. mingw_prefix: mingw-w64-i686
  17. hardening:
  18. - target: x86_64-w64-mingw32
  19. compiler_path: mingw64
  20. mingw_prefix: mingw-w64-x86_64
  21. # hardening doesn't work with mingw-w64-x86_64-gcc, because it's gcc 8
  22. hardening: --disable-gcc-hardening
  23. matrix:
  24. # Don't keep building failing jobs
  25. fast_finish: true
  26. # Skip the 32-bit Windows Server 2019 job, and the 64-bit Windows Server
  27. # 2012 R2 job, to speed up the build.
  28. # The environment variables must be listed without the 'environment' tag.
  29. exclude:
  30. - image: Visual Studio 2019
  31. target: i686-w64-mingw32
  32. compiler_path: mingw32
  33. mingw_prefix: mingw-w64-i686
  34. hardening:
  35. - image: Visual Studio 2015
  36. target: x86_64-w64-mingw32
  37. compiler_path: mingw64
  38. mingw_prefix: mingw-w64-x86_64
  39. # hardening doesn't work with mingw-w64-x86_64-gcc, because it's gcc 8
  40. hardening: --disable-gcc-hardening
  41. install:
  42. - ps: >-
  43. Function Execute-Command ($commandPath)
  44. {
  45. & $commandPath $args 2>&1
  46. if ( $LastExitCode -ne 0 ) {
  47. $host.SetShouldExit( $LastExitCode )
  48. }
  49. }
  50. Function Execute-Bash ()
  51. {
  52. Execute-Command 'c:\msys64\usr\bin\bash' '-e' '-c' $args
  53. }
  54. <# mingw packages start with ${env:mingw_prefix}
  55. # unprefixed packages are from MSYS2, which is like Cygwin. Avoid them.
  56. #
  57. # Use pacman --debug to show package downloads and install locations
  58. #>
  59. Execute-Command "C:\msys64\usr\bin\pacman" -Sy --verbose --needed --noconfirm ${env:mingw_prefix}-libevent ${env:mingw_prefix}-openssl ${env:mingw_prefix}-pkg-config ${env:mingw_prefix}-xz ${env:mingw_prefix}-zstd ;
  60. build_script:
  61. - ps: >-
  62. if ($env:compiler -eq "mingw") {
  63. <# use the MSYS2 compiler and user binaries to build and install #>
  64. $oldpath = ${env:Path} -split ';'
  65. $buildpath = @("C:\msys64\${env:compiler_path}\bin", "C:\msys64\usr\bin") + $oldpath
  66. $env:Path = @($buildpath) -join ';'
  67. $env:build = @("${env:APPVEYOR_BUILD_FOLDER}", $env:target) -join '\'
  68. Set-Location "${env:APPVEYOR_BUILD_FOLDER}"
  69. Execute-Bash 'autoreconf -i'
  70. mkdir "${env:build}"
  71. Set-Location "${env:build}"
  72. Execute-Bash "which ${env:target}-gcc"
  73. Execute-Bash "${env:target}-gcc --version"
  74. <# compile for mingw
  75. # mingw zstd doesn't come with a pkg-config file, so we manually
  76. # configure its flags. liblzma just works.
  77. #>
  78. Execute-Bash "ZSTD_CFLAGS='-L/${env:compiler_path}/include' ZSTD_LIBS='-L/${env:compiler_path}/lib -lzstd' ../configure --prefix=/${env:compiler_path} --build=${env:target} --host=${env:target} --with-openssl-dir=/${env:compiler_path} --disable-asciidoc --enable-fatal-warnings ${env:hardening}"
  79. Execute-Bash "V=1 make -k -j2"
  80. Execute-Bash "V=1 make -k -j2 install"
  81. }
  82. test_script:
  83. - ps: >-
  84. if ($env:compiler -eq "mingw") {
  85. <# use the MSYS2 compiler binaries to make check #>
  86. $oldpath = ${env:Path} -split ';'
  87. $buildpath = @("C:\msys64\${env:compiler_path}\bin") + $oldpath
  88. $env:Path = $buildpath -join ';'
  89. Set-Location "${env:build}"
  90. Copy-Item "C:/msys64/${env:compiler_path}/bin/libssp-0.dll" -Destination "${env:build}/src/test"
  91. Copy-Item "C:/msys64/${env:compiler_path}/bin/zlib1.dll" -Destination "${env:build}/src/test"
  92. Execute-Bash "VERBOSE=1 make -k -j2 check"
  93. }
  94. on_finish:
  95. - ps: >-
  96. <# if we failed before install:, these functions won't be defined #>
  97. Function Execute-Command ($commandPath)
  98. {
  99. & $commandPath $args 2>&1
  100. if ( $LastExitCode -ne 0 ) {
  101. $host.SetShouldExit( $LastExitCode )
  102. }
  103. }
  104. Function Execute-Bash ()
  105. {
  106. Execute-Command 'c:\msys64\usr\bin\bash' '-e' '-c' $args
  107. }
  108. if ($env:compiler -eq "mingw") {
  109. <# use the MSYS2 user binaries to archive failures #>
  110. $oldpath = ${env:Path} -split ';'
  111. $buildpath = @("C:\msys64\usr\bin") + $oldpath
  112. $env:Path = @($buildpath) -join ';'
  113. Set-Location "${env:build}"
  114. <# store logs as appveyor artifacts: see the artifacts tab #>
  115. Execute-Bash "7z a logs.zip config.log || true"
  116. Execute-Bash "7z a logs.zip test-suite.log || true"
  117. Execute-Bash "appveyor PushArtifact logs.zip || true"
  118. Execute-Bash "tail -1000 config.log || true"
  119. Execute-Bash "cat test-suite.log || true"
  120. }
  121. # notify the IRC channel of any failures
  122. on_failure:
  123. - cmd: C:\Python27\python.exe %APPVEYOR_BUILD_FOLDER%\scripts\test\appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure