]> git.sesse.net Git - stockfish/blob - appveyor.yml
Merge branch 'master' of /srv/git.sesse.net/www/stockfish
[stockfish] / appveyor.yml
1 version: 1.0.{build}
2 clone_depth: 50
3
4 branches:
5   only:
6     - master
7     - appveyor
8
9 # Operating system (build VM template)
10 os: Visual Studio 2017
11
12 # Build platform, i.e. x86, x64, AnyCPU. This setting is optional.
13 platform:
14   - x86
15   - x64
16
17 # build Configuration, i.e. Debug, Release, etc.
18 configuration:
19   - Debug
20   - Release
21
22 matrix:
23   # The build fail immediately once one of the job fails
24   fast_finish: true
25
26 # Scripts that are called at very beginning, before repo cloning
27 init:
28   - cmake --version
29   - msbuild /version
30
31 before_build:
32   - ps: |
33       # Get sources
34       $src = get-childitem -Path *.cpp -Recurse | select -ExpandProperty FullName
35       $src = $src -join ' '
36       $src = $src.Replace("\", "/")
37
38       # Build CMakeLists.txt
39       $t = 'cmake_minimum_required(VERSION 3.8)',
40            'project(Stockfish)',
41            'set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src)',
42            'set(source_files', $src, ')',
43            'add_executable(stockfish ${source_files})'
44
45       # Write CMakeLists.txt withouth BOM
46       $MyPath = (Get-Item -Path "." -Verbose).FullName + '\CMakeLists.txt'
47       $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
48       [System.IO.File]::WriteAllLines($MyPath, $t, $Utf8NoBomEncoding)
49
50       # Obtain bench reference from git log
51       $b = git log HEAD | sls "\b[Bb]ench[ :]+[0-9]{7}" | select -first 1
52       $bench = $b -match '\D+(\d+)' | % { $matches[1] }
53       Write-Host "Reference bench:" $bench
54       $g = "Visual Studio 15 2017"
55       If (${env:PLATFORM} -eq 'x64') { $g = $g + ' Win64' }
56       cmake -G "${g}" .
57       Write-Host "Generated files for: " $g
58
59 build_script:
60   - cmake --build . --config %CONFIGURATION% -- /verbosity:minimal
61
62 before_test:
63   - cd src/%CONFIGURATION%
64   - stockfish bench 2> out.txt >NUL
65   - ps: |
66       # Verify bench number
67       $s = (gc "./out.txt" | out-string)
68       $r = ($s -match 'Nodes searched \D+(\d+)' | % { $matches[1] })
69       Write-Host "Engine bench:" $r
70       Write-Host "Reference bench:" $bench
71       If ($r -ne $bench) { exit 1 }