.appveyor.yml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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. # All installed library dlls must be copied to the test and app
  60. # directories, before running tor's tests. (See below.)
  61. #>
  62. 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 ;
  63. build_script:
  64. - ps: >-
  65. if ($env:compiler -eq "mingw") {
  66. <# use the MSYS2 compiler and user binaries to build and install #>
  67. $oldpath = ${env:Path} -split ';'
  68. $buildpath = @("C:\msys64\${env:compiler_path}\bin", "C:\msys64\usr\bin") + $oldpath
  69. $env:Path = @($buildpath) -join ';'
  70. $env:build = @("${env:APPVEYOR_BUILD_FOLDER}", $env:target) -join '\'
  71. Set-Location "${env:APPVEYOR_BUILD_FOLDER}"
  72. Execute-Bash 'autoreconf -i'
  73. mkdir "${env:build}"
  74. Set-Location "${env:build}"
  75. Execute-Bash "which ${env:target}-gcc"
  76. Execute-Bash "${env:target}-gcc --version"
  77. <# compile for mingw
  78. # mingw zstd doesn't come with a pkg-config file, so we manually
  79. # configure its flags. liblzma just works.
  80. #>
  81. 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}"
  82. Execute-Bash "V=1 make -k -j2"
  83. Execute-Bash "V=1 make -k -j2 install"
  84. }
  85. test_script:
  86. - ps: >-
  87. if ($env:compiler -eq "mingw") {
  88. <# use the MSYS2 compiler binaries to make check #>
  89. $oldpath = ${env:Path} -split ';'
  90. $buildpath = @("C:\msys64\${env:compiler_path}\bin") + $oldpath
  91. $env:Path = $buildpath -join ';'
  92. Set-Location "${env:build}"
  93. <# Some compiler dlls must be copied to the test and app
  94. # directories, before running tor's tests.
  95. #>
  96. Copy-Item "C:/msys64/${env:compiler_path}/bin/libssp-0.dll","C:/msys64/${env:compiler_path}/bin/zlib1.dll" -Destination "${env:build}/src/test"
  97. Copy-Item "C:/msys64/${env:compiler_path}/bin/libssp-0.dll","C:/msys64/${env:compiler_path}/bin/zlib1.dll" -Destination "${env:build}/src/app"
  98. <# All installed library dlls must be copied to the test and app
  99. # directories, before running tor's tests.
  100. # (See install command above.)
  101. #>
  102. Copy-Item "C:/${env:compiler_path}/bin/libcrypto*.dll","C:/${env:compiler_path}/bin/libssl*.dll","C:/${env:compiler_path}/bin/liblzma*.dll","C:/${env:compiler_path}/bin/libevent*.dll","C:/${env:compiler_path}/bin/libzstd*.dll" -Destination "${env:build}/src/test"
  103. Copy-Item "C:/${env:compiler_path}/bin/libcrypto*.dll","C:/${env:compiler_path}/bin/libssl*.dll","C:/${env:compiler_path}/bin/liblzma*.dll","C:/${env:compiler_path}/bin/libevent*.dll","C:/${env:compiler_path}/bin/libzstd*.dll" -Destination "${env:build}/src/app"
  104. Execute-Bash "VERBOSE=1 TOR_SKIP_TESTCASES=crypto/openssl_version make -k -j2 check"
  105. }
  106. on_finish:
  107. - ps: >-
  108. <# if we failed before install:, these functions won't be defined #>
  109. Function Execute-Command ($commandPath)
  110. {
  111. & $commandPath $args 2>&1
  112. if ( $LastExitCode -ne 0 ) {
  113. $host.SetShouldExit( $LastExitCode )
  114. }
  115. }
  116. Function Execute-Bash ()
  117. {
  118. Execute-Command 'c:\msys64\usr\bin\bash' '-e' '-c' $args
  119. }
  120. if ($env:compiler -eq "mingw") {
  121. <# use the MSYS2 user binaries to archive failures #>
  122. $oldpath = ${env:Path} -split ';'
  123. $buildpath = @("C:\msys64\usr\bin") + $oldpath
  124. $env:Path = @($buildpath) -join ';'
  125. Set-Location "${env:build}"
  126. <# store logs as appveyor artifacts: see the artifacts tab #>
  127. Execute-Bash "7z a logs.zip config.log || true"
  128. Execute-Bash "7z a logs.zip test-suite.log || true"
  129. Execute-Bash "appveyor PushArtifact logs.zip || true"
  130. Execute-Bash "tail -1000 config.log || true"
  131. Execute-Bash "cat test-suite.log || true"
  132. }
  133. # notify the IRC channel of any failures
  134. on_failure:
  135. - cmd: C:\Python27\python.exe %APPVEYOR_BUILD_FOLDER%\scripts\test\appveyor-irc-notify.py irc.oftc.net:6697 tor-ci failure