9 # Operating system (build VM template)
10 os: Visual Studio 2015
12 # Build platform, i.e. x86, x64, AnyCPU. This setting is optional.
18 # build Configuration, i.e. Debug, Release, etc.
22 # The build fail immediately once one of the job fails
25 # Scripts that are called at very beginning, before repo cloning
33 $src = get-childitem -Path *.cpp -Recurse | select -ExpandProperty FullName
35 $src = $src.Replace("\", "/")
37 # Build CMakeLists.txt
38 $t = 'cmake_minimum_required(VERSION 3.8)',
40 'set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src)',
41 'set(source_files', $src, ')',
42 'add_executable(stockfish ${source_files})'
44 # Write CMakeLists.txt withouth BOM
45 $MyPath = (Get-Item -Path "." -Verbose).FullName + '\CMakeLists.txt'
46 $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
47 [System.IO.File]::WriteAllLines($MyPath, $t, $Utf8NoBomEncoding)
49 # Obtain bench reference from git log
50 $b = git log HEAD | sls "\b[Bb]ench[ :]+[0-9]{7}" | select -first 1
51 $bench = $b -match '\D+(\d+)' | % { $matches[1] }
52 Write-Host "Reference bench:" $bench
55 - cmake -G "Visual Studio 14 2015 Win64" .
62 ./stockfish bench 2> out.txt 1> null
63 $s = (gc "./out.txt" | out-string)
64 $r = ($s -match 'Nodes searched \D+(\d+)' | % { $matches[1] })
65 Write-Host "Engine bench:" $r
66 Write-Host "Reference bench:" $bench
67 If ($r -ne $bench) { exit 1 }