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