.appveyor.yml 6.1 KB

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