mirror of
https://github.com/sockspls/badfish
synced 2025-04-29 16:23:09 +00:00

covers the most important cases from the user perspective: It embeds the default net in the binary, so a download of that binary will result in a working engine with the default net. The engine will be functional in the default mode without any additional user action. It allows non-default nets to be used, which will be looked for in up to three directories (working directory, location of the binary, and optionally a specific default directory). This mechanism is also kept for those developers that use MSVC, the one compiler that doesn't have an easy mechanism for embedding data. It is possible to disable embedding, and instead specify a specific directory, e.g. linux distros might want to use CXXFLAGS="-DNNUE_EMBEDDING_OFF -DDEFAULT_NNUE_DIRECTORY=/usr/share/games/stockfish/" make -j ARCH=x86-64 profile-build passed STC non-regression: https://tests.stockfishchess.org/tests/view/5f4a581c150f0aef5f8ae03a LLR: 2.95 (-2.94,2.94) {-1.25,-0.25} Total: 66928 W: 7202 L: 7147 D: 52579 Ptnml(0-2): 291, 5309, 22211, 5360, 293 closes https://github.com/official-stockfish/Stockfish/pull/3070 fixes https://github.com/official-stockfish/Stockfish/issues/3030 No functional change.
88 lines
2.9 KiB
YAML
88 lines
2.9 KiB
YAML
version: 1.0.{build}
|
|
clone_depth: 50
|
|
|
|
branches:
|
|
only:
|
|
- master
|
|
|
|
# Operating system (build VM template)
|
|
os: Visual Studio 2019
|
|
|
|
# Build platform, i.e. x86, x64, AnyCPU. This setting is optional.
|
|
platform:
|
|
- x86
|
|
- x64
|
|
|
|
# build Configuration, i.e. Debug, Release, etc.
|
|
configuration:
|
|
- Debug
|
|
- Release
|
|
|
|
matrix:
|
|
# The build fail immediately once one of the job fails
|
|
fast_finish: true
|
|
|
|
# Scripts that are called at very beginning, before repo cloning
|
|
init:
|
|
- cmake --version
|
|
- msbuild /version
|
|
|
|
before_build:
|
|
- 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 --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 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 }
|