]> git.sesse.net Git - stockfish/blobdiff - appveyor.yml
Affine transform robust implementation
[stockfish] / appveyor.yml
index a46a0f3ff6ed2073c0f541d4c460056c18945471..ab6084090a40da687b6ce4b2c08b61d955aa85eb 100644 (file)
@@ -1,22 +1,22 @@
 version: 1.0.{build}
-clone_depth: 5
+clone_depth: 50
 
 branches:
   only:
     - master
-    - appveyor
 
 # Operating system (build VM template)
-os: Visual Studio 2015
+os: Visual Studio 2019
 
 # Build platform, i.e. x86, x64, AnyCPU. This setting is optional.
 platform:
   - x86
   - x64
-  - Any CPU
 
 # build Configuration, i.e. Debug, Release, etc.
-configuration: Debug
+configuration:
+  - Debug
+  - Release
 
 matrix:
   # The build fail immediately once one of the job fails
@@ -28,18 +28,61 @@ init:
   - msbuild /version
 
 before_build:
-  - cd src
-  - echo project (Stockfish) >> CMakeLists.txt
-  - echo add_executable(stockfish benchmark.cpp bitbase.cpp bitboard.cpp endgame.cpp evaluate.cpp >> CMakeLists.txt
-  - echo main.cpp material.cpp misc.cpp movegen.cpp movepick.cpp pawns.cpp position.cpp psqt.cpp >> CMakeLists.txt
-  - echo search.cpp thread.cpp timeman.cpp tt.cpp uci.cpp ucioption.cpp syzygy/tbprobe.cpp) >> CMakeLists.txt
-  - echo set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src) >> CMakeLists.txt
-#   - echo target_compile_options(stockfish PUBLIC "/Ox") >> CMakeLists.txt
+  - ps: |
+      # Get sources
+      $src = get-childitem -Path *.cpp -Recurse | select -ExpandProperty FullName
+      $src = $src -join ' '
+      $src = $src.Replace("\", "/")
+
+      # Build CMakeLists.txt
+      $t = 'cmake_minimum_required(VERSION 3.17)',
+           'project(Stockfish)',
+           'set(CMAKE_CXX_STANDARD 17)',
+           'set(CMAKE_CXX_STANDARD_REQUIRED ON)',
+           'set (CMAKE_CXX_EXTENSIONS OFF)',
+           'set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/src)',
+           'set(source_files', $src, ')',
+           'add_executable(stockfish ${source_files})'
+
+      # Write CMakeLists.txt withouth BOM
+      $MyPath = (Get-Item -Path "." -Verbose).FullName + '\CMakeLists.txt'
+      $Utf8NoBomEncoding = New-Object System.Text.UTF8Encoding $False
+      [System.IO.File]::WriteAllLines($MyPath, $t, $Utf8NoBomEncoding)
+
+      # Obtain bench reference from git log
+      $b = git log HEAD | sls "\b[Bb]ench[ :]+[0-9]{7}" | select -first 1
+      $bench = $b -match '\D+(\d+)' | % { $matches[1] }
+      Write-Host "Reference bench:" $bench
+      $g = "Visual Studio 16 2019"
+      If (${env:PLATFORM} -eq 'x64') { $a = "x64" }
+      If (${env:PLATFORM} -eq 'x86') { $a = "Win32" }
+      cmake -G "${g}" -A ${a} .
+      Write-Host "Generated files for: " $g $a
 
 build_script:
-  - cmake -G "Visual Studio 14 2015 Win64" .
-  - cmake --build .
+  - cmake --build . --config %CONFIGURATION% -- /verbosity:minimal
+  - ps: |
+      # Download default NNUE net from fishtest
+      $nnuenet = Get-Content -Path src\evaluate.h | Select-String -CaseSensitive -Pattern "EvalFileDefaultName" | Select-String -CaseSensitive -Pattern "nn-[a-z0-9]{12}.nnue"
+      $dummy = $nnuenet -match "(?<nnuenet>nn-[a-z0-9]{12}.nnue)"
+      $nnuenet = $Matches.nnuenet
+      Write-Host "Default net:" $nnuenet
+      $nnuedownloadurl = "https://tests.stockfishchess.org/api/nn/$nnuenet"
+      $nnuefilepath = "src\${env:CONFIGURATION}\$nnuenet"
+      if (Test-Path -Path $nnuefilepath) {
+            Write-Host "Already available."
+      } else {
+            Write-Host "Downloading $nnuedownloadurl to $nnuefilepath"
+            Invoke-WebRequest -Uri $nnuedownloadurl -OutFile $nnuefilepath
+      }
 
 before_test:
-  - cd Debug
-  - stockfish.exe bench > null
+  - cd src/%CONFIGURATION%
+  - stockfish bench 2> out.txt >NUL
+  - ps: |
+      # Verify bench number
+      $s = (gc "./out.txt" | out-string)
+      $r = ($s -match 'Nodes searched \D+(\d+)' | % { $matches[1] })
+      Write-Host "Engine bench:" $r
+      Write-Host "Reference bench:" $bench
+      If ($r -ne $bench) { exit 1 }