2018-10-18 21:07:58 -07:00
|
|
|
$ErrorActionPreference = 'stop'
|
|
|
|
Set-PSDebug -Strict -Trace 1
|
2018-03-11 15:44:07 -07:00
|
|
|
|
2019-04-08 15:17:07 -07:00
|
|
|
$isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null)
|
2018-03-11 15:44:07 -07:00
|
|
|
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
|
|
|
|
$compiler = $Matches.compiler
|
|
|
|
$compileOption = $Matches.option
|
|
|
|
$bits = $Matches.bits
|
2019-04-08 15:17:07 -07:00
|
|
|
$cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
|
2019-04-07 15:14:01 -07:00
|
|
|
$buildDir = [System.IO.Path]::GetFullPath("$(pwd)")
|
2018-03-11 15:44:07 -07:00
|
|
|
$depsCmakeVars = @{
|
|
|
|
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
|
|
|
}
|
|
|
|
$nvimCmakeVars = @{
|
|
|
|
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
|
|
|
BUSTED_OUTPUT_TYPE = 'nvim';
|
2019-04-07 15:14:01 -07:00
|
|
|
DEPS_PREFIX=$(if ($env:DEPS_PREFIX -ne $null) {$env:DEPS_PREFIX} else {".deps/usr"});
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
2019-07-27 02:55:17 -07:00
|
|
|
if ($env:DEPS_BUILD_DIR -eq $null) {
|
|
|
|
$env:DEPS_BUILD_DIR = ".deps";
|
|
|
|
}
|
2018-10-18 21:07:58 -07:00
|
|
|
$uploadToCodeCov = $false
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
function exitIfFailed() {
|
|
|
|
if ($LastExitCode -ne 0) {
|
2018-10-18 21:07:58 -07:00
|
|
|
Set-PSDebug -Off
|
2018-03-11 15:44:07 -07:00
|
|
|
exit $LastExitCode
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-27 02:55:17 -07:00
|
|
|
if (-Not (Test-Path -PathType container $env:DEPS_BUILD_DIR)) {
|
|
|
|
write-host "cache dir not found: $($env:DEPS_BUILD_DIR)"
|
|
|
|
mkdir $env:DEPS_BUILD_DIR
|
2019-04-07 16:19:38 -07:00
|
|
|
} else {
|
2019-07-27 02:55:17 -07:00
|
|
|
write-host "cache dir $($env:DEPS_BUILD_DIR) size: $(Get-ChildItem $env:DEPS_BUILD_DIR -recurse | Measure-Object -property length -sum | Select -expand sum)"
|
2019-04-07 15:14:01 -07:00
|
|
|
}
|
|
|
|
|
2018-03-11 15:44:07 -07:00
|
|
|
if ($compiler -eq 'MINGW') {
|
|
|
|
if ($bits -eq 32) {
|
|
|
|
$arch = 'i686'
|
|
|
|
}
|
|
|
|
elseif ($bits -eq 64) {
|
|
|
|
$arch = 'x86_64'
|
|
|
|
}
|
|
|
|
if ($compileOption -eq 'gcov') {
|
|
|
|
$nvimCmakeVars['USE_GCOV'] = 'ON'
|
|
|
|
$uploadToCodecov = $true
|
2019-06-25 06:35:33 -07:00
|
|
|
$env:GCOV = "C:\msys64\mingw$bits\bin\gcov"
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
|
|
|
# These are native MinGW builds, but they use the toolchain inside
|
|
|
|
# MSYS2, this allows using all the dependencies and tools available
|
|
|
|
# in MSYS2, but we cannot build inside the MSYS2 shell.
|
2018-08-12 04:39:46 -07:00
|
|
|
$cmakeGenerator = 'Ninja'
|
|
|
|
$cmakeGeneratorArgs = '-v'
|
2019-07-10 08:28:35 -07:00
|
|
|
$mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils').ForEach({
|
2018-08-12 04:39:46 -07:00
|
|
|
"mingw-w64-$arch-$_"
|
|
|
|
})
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
# Add MinGW to the PATH
|
|
|
|
$env:PATH = "C:\msys64\mingw$bits\bin;$env:PATH"
|
|
|
|
|
2018-11-04 06:39:13 -07:00
|
|
|
# Avoid pacman "warning" which causes non-zero return code. https://github.com/open62541/open62541/issues/2068
|
|
|
|
& C:\msys64\usr\bin\mkdir -p /var/cache/pacman/pkg
|
|
|
|
|
2018-03-11 15:44:07 -07:00
|
|
|
# Build third-party dependencies
|
|
|
|
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" ; exitIfFailed
|
2018-08-12 04:39:46 -07:00
|
|
|
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S $mingwPackages" ; exitIfFailed
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
|
|
|
elseif ($compiler -eq 'MSVC') {
|
|
|
|
$cmakeGeneratorArgs = '/verbosity:normal'
|
|
|
|
if ($bits -eq 32) {
|
|
|
|
$cmakeGenerator = 'Visual Studio 15 2017'
|
|
|
|
}
|
|
|
|
elseif ($bits -eq 64) {
|
|
|
|
$cmakeGenerator = 'Visual Studio 15 2017 Win64'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# Setup python (use AppVeyor system python)
|
2018-12-16 02:47:59 -07:00
|
|
|
C:\Python27\python.exe -m pip install pynvim ; exitIfFailed
|
|
|
|
C:\Python35\python.exe -m pip install pynvim ; exitIfFailed
|
2018-03-11 15:44:07 -07:00
|
|
|
# Disambiguate python3
|
|
|
|
move c:\Python35\python.exe c:\Python35\python3.exe
|
|
|
|
$env:PATH = "C:\Python35;C:\Python27;$env:PATH"
|
|
|
|
# Sanity check
|
2018-12-16 02:47:59 -07:00
|
|
|
python -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
|
|
|
python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
$env:PATH = "C:\Ruby24\bin;$env:PATH"
|
2018-10-18 21:07:58 -07:00
|
|
|
gem.cmd install neovim
|
|
|
|
Get-Command -CommandType Application neovim-ruby-host.bat
|
2018-03-11 15:44:07 -07:00
|
|
|
|
2018-10-18 21:07:58 -07:00
|
|
|
npm.cmd install -g neovim
|
|
|
|
Get-Command -CommandType Application neovim-node-host.cmd
|
|
|
|
npm.cmd link neovim
|
2018-03-11 15:44:07 -07:00
|
|
|
|
2019-06-09 04:26:48 -07:00
|
|
|
#npm.cmd install -g tree-sitter-cli
|
|
|
|
#npm.cmd link tree-sitter-cli
|
|
|
|
|
|
|
|
mkdir c:\treesitter
|
|
|
|
$env:TREE_SITTER_DIR = "c:\treesitter"
|
|
|
|
#$env:PATH = "c:\treesitter;$env:PATH"
|
|
|
|
$client = new-object System.Net.WebClient
|
|
|
|
cd c:\treesitter
|
|
|
|
|
|
|
|
if ($bits -eq 32) {
|
|
|
|
$client.DownloadFile("https://github.com/tree-sitter/tree-sitter/releases/download/0.15.5/tree-sitter-windows-x86.gz","c:\treesitter\tree-sitter-cli.gz")
|
|
|
|
}
|
|
|
|
elseif ($bits -eq 64) {
|
|
|
|
$client.DownloadFile("https://github.com/tree-sitter/tree-sitter/releases/download/0.15.5/tree-sitter-windows-x64.gz","c:\treesitter\tree-sitter-cli.gz")
|
|
|
|
}
|
|
|
|
python -c "import gzip, shutil; f1,f2 = gzip.open('tree-sitter-cli.gz', 'rb'), open('tree-sitter.exe', 'wb'); shutil.copyfileobj(f1, f2); f2.close()"
|
|
|
|
|
|
|
|
$client.DownloadFile("https://codeload.github.com/tree-sitter/tree-sitter-c/zip/v0.15.2","c:\treesitter\tree_sitter_c.zip")
|
|
|
|
Expand-Archive c:\treesitter\tree_sitter_c.zip -DestinationPath c:\treesitter\
|
|
|
|
cd c:\treesitter\tree-sitter-c-0.15.2
|
|
|
|
c:\treesitter\tree-sitter.exe test
|
|
|
|
|
2018-03-11 15:44:07 -07:00
|
|
|
function convertToCmakeArgs($vars) {
|
|
|
|
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
|
|
|
|
}
|
|
|
|
|
2019-07-27 02:55:17 -07:00
|
|
|
cd $env:DEPS_BUILD_DIR
|
2019-04-07 15:14:01 -07:00
|
|
|
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed
|
2018-03-11 15:44:07 -07:00
|
|
|
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
2019-04-07 15:14:01 -07:00
|
|
|
cd $buildDir
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
# Build Neovim
|
|
|
|
mkdir build
|
|
|
|
cd build
|
|
|
|
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
|
|
|
|
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
2019-06-15 17:33:47 -07:00
|
|
|
.\bin\nvim --version ; exitIfFailed
|
|
|
|
|
|
|
|
# Ensure that the "win32" feature is set.
|
|
|
|
.\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
# Functional tests
|
2018-03-26 08:54:44 -07:00
|
|
|
# The $LastExitCode from MSBuild can't be trusted
|
2018-04-13 10:38:31 -07:00
|
|
|
$failed = $false
|
|
|
|
# Temporarily turn off tracing to reduce log file output
|
|
|
|
Set-PSDebug -Off
|
2018-04-13 10:42:02 -07:00
|
|
|
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 |
|
2018-04-13 10:38:31 -07:00
|
|
|
foreach { $failed = $failed -or
|
2018-10-20 12:49:33 -07:00
|
|
|
$_ -match 'functional tests failed with error'; $_ }
|
2018-04-13 10:38:31 -07:00
|
|
|
if ($failed) {
|
2019-06-25 06:35:33 -07:00
|
|
|
if ($uploadToCodecov) {
|
|
|
|
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
|
|
|
|
}
|
2018-04-13 10:38:31 -07:00
|
|
|
exit $LastExitCode
|
2018-03-26 08:54:44 -07:00
|
|
|
}
|
2018-10-18 21:07:58 -07:00
|
|
|
Set-PSDebug -Strict -Trace 1
|
2018-03-26 08:54:44 -07:00
|
|
|
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
if ($uploadToCodecov) {
|
2019-06-25 06:35:33 -07:00
|
|
|
bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Old tests
|
2019-06-13 13:09:29 -07:00
|
|
|
# Add MSYS to path, required for e.g. `find` used in test scripts.
|
|
|
|
# But would break functionaltests, where its `more` would be used then.
|
2019-08-07 13:09:18 -07:00
|
|
|
$OldPath = $env:PATH
|
2018-03-27 23:27:10 -07:00
|
|
|
$env:PATH = "C:\msys64\usr\bin;$env:PATH"
|
2019-08-21 12:54:03 -07:00
|
|
|
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed
|
2019-08-07 13:09:18 -07:00
|
|
|
$env:PATH = $OldPath
|
2018-03-11 15:44:07 -07:00
|
|
|
|
|
|
|
if ($uploadToCodecov) {
|
2019-06-25 06:35:33 -07:00
|
|
|
bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
|
2018-03-11 15:44:07 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
# Build artifacts
|
|
|
|
cpack -G ZIP -C RelWithDebInfo
|
|
|
|
if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) {
|
|
|
|
cpack -G NSIS -C RelWithDebInfo
|
|
|
|
}
|