ci/AppVeyor: use PowerShell (#8124)
This commit is contained in:
parent
c7f95fde1b
commit
e24e98534b
|
@ -16,9 +16,9 @@ install: []
|
|||
before_build:
|
||||
- ps: Install-Product node 8
|
||||
build_script:
|
||||
- call ci\build.bat
|
||||
- powershell ci\build.ps1
|
||||
cache:
|
||||
- C:\msys64\var\cache\pacman\pkg -> ci\build.bat
|
||||
- C:\msys64\var\cache\pacman\pkg -> ci\build.ps1
|
||||
- .deps -> third-party\**
|
||||
artifacts:
|
||||
- path: build/Neovim.zip
|
||||
|
|
88
ci/build.bat
88
ci/build.bat
|
@ -1,88 +0,0 @@
|
|||
echo on
|
||||
if "%CONFIGURATION%" == "MINGW_32" (
|
||||
set ARCH=i686
|
||||
set BITS=32
|
||||
) else if "%CONFIGURATION:~0,8%" == "MINGW_64" (
|
||||
set ARCH=x86_64
|
||||
set BITS=64
|
||||
if "%CONFIGURATION%" == "MINGW_64-gcov" (
|
||||
set "USE_GCOV=-DUSE_GCOV=ON"
|
||||
)
|
||||
) else if "%CONFIGURATION%" == "MSVC_32" (
|
||||
set "CMAKE_GENERATOR=Visual Studio 15 2017"
|
||||
) else if "%CONFIGURATION%" == "MSVC_64" (
|
||||
set "CMAKE_GENERATOR=Visual Studio 15 2017 Win64"
|
||||
)
|
||||
|
||||
if "%CONFIGURATION:~0,5%" == "MINGW" (
|
||||
:: 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.
|
||||
set "CMAKE_GENERATOR=MinGW Makefiles"
|
||||
set CMAKE_GENERATOR_ARGS=VERBOSE=1
|
||||
:: Add MinGW to the PATH and remove the Git directory because it
|
||||
:: has a conflicting sh.exe
|
||||
set "PATH=C:\msys64\mingw%BITS%\bin;C:\Windows\System32;C:\Windows;%PATH:C:\Program Files\Git\usr\bin;=%"
|
||||
:: Build third-party dependencies
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" || goto :error
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-%ARCH%-cmake mingw-w64-%ARCH%-perl mingw-w64-%ARCH%-diffutils mingw-w64-%ARCH%-unibilium gperf" || goto :error
|
||||
) else if "%CONFIGURATION:~0,4%" == "MSVC" (
|
||||
set CMAKE_GENERATOR_ARGS=/verbosity:normal
|
||||
)
|
||||
|
||||
:: Setup python (use AppVeyor system python)
|
||||
C:\Python27\python.exe -m pip install neovim || goto :error
|
||||
C:\Python35\python.exe -m pip install neovim || goto :error
|
||||
:: Disambiguate python3
|
||||
move c:\Python35\python.exe c:\Python35\python3.exe
|
||||
set PATH=C:\Python35;C:\Python27;%PATH%
|
||||
:: Sanity check
|
||||
python -c "import neovim; print(str(neovim))" || goto :error
|
||||
python3 -c "import neovim; print(str(neovim))" || goto :error
|
||||
|
||||
set PATH=C:\Ruby24\bin;%PATH%
|
||||
cmd /c gem.cmd install neovim || goto :error
|
||||
where.exe neovim-ruby-host.bat || goto :error
|
||||
|
||||
cmd /c npm.cmd install -g neovim || goto :error
|
||||
where.exe neovim-node-host.cmd || goto :error
|
||||
|
||||
mkdir .deps
|
||||
cd .deps
|
||||
cmake -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=RelWithDebInfo ..\third-party\ || goto :error
|
||||
cmake --build . -- %CMAKE_GENERATOR_ARGS% || goto :error
|
||||
cd ..
|
||||
|
||||
:: Build Neovim
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "%CMAKE_GENERATOR%" -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUSTED_OUTPUT_TYPE=nvim %USE_GCOV% -DGPERF_PRG="C:\msys64\usr\bin\gperf.exe" .. || goto :error
|
||||
cmake --build . --config RelWithDebInfo -- %CMAKE_GENERATOR_ARGS% || goto :error
|
||||
bin\nvim --version || goto :error
|
||||
|
||||
:: Functional tests
|
||||
cmake --build . --config RelWithDebInfo --target functionaltest -- %CMAKE_GENERATOR_ARGS% || goto :error
|
||||
|
||||
if defined USE_GCOV (
|
||||
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'"
|
||||
)
|
||||
|
||||
:: Old tests
|
||||
setlocal
|
||||
set PATH=%PATH%;C:\msys64\usr\bin
|
||||
cmake --build "%~dp0\..\src\nvim\testdir" -- %CMAKE_GENERATOR_ARGS%
|
||||
endlocal
|
||||
|
||||
if defined USE_GCOV (
|
||||
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'"
|
||||
)
|
||||
|
||||
:: The default cpack in the PATH is not CMake
|
||||
set "PATH=C:\Program Files (x86)\CMake\bin\cpack.exe;%PATH%"
|
||||
:: Build artifacts
|
||||
cpack -G ZIP -C RelWithDebInfo
|
||||
if defined APPVEYOR_REPO_TAG_NAME cpack -G NSIS -C RelWithDebInfo
|
||||
|
||||
goto :EOF
|
||||
:error
|
||||
exit /b %errorlevel%
|
|
@ -0,0 +1,112 @@
|
|||
Set-PSDebug -Trace 1
|
||||
|
||||
$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$'
|
||||
$compiler = $Matches.compiler
|
||||
$compileOption = $Matches.option
|
||||
$bits = $Matches.bits
|
||||
$cmakeBuildType = 'RelWithDebInfo'
|
||||
$depsCmakeVars = @{
|
||||
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
||||
}
|
||||
$nvimCmakeVars = @{
|
||||
CMAKE_BUILD_TYPE = $cmakeBuildType;
|
||||
BUSTED_OUTPUT_TYPE = 'nvim';
|
||||
GPERF_PRG = 'C:\msys64\usr\bin\gperf.exe';
|
||||
}
|
||||
|
||||
function exitIfFailed() {
|
||||
if ($LastExitCode -ne 0) {
|
||||
exit $LastExitCode
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
# 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.
|
||||
$cmakeGenerator = 'MinGW Makefiles'
|
||||
$cmakeGeneratorArgs = 'VERBOSE=1'
|
||||
|
||||
# Add MinGW to the PATH
|
||||
$env:PATH = "C:\msys64\mingw$bits\bin;$env:PATH"
|
||||
# Remove the Git sh.exe from the PATH
|
||||
$env:PATH = $env:PATH.Replace('C:\Program Files\Git\usr\bin', '')
|
||||
|
||||
# Build third-party dependencies
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Su" ; exitIfFailed
|
||||
C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S mingw-w64-$arch-cmake mingw-w64-$arch-perl mingw-w64-$arch-diffutils mingw-w64-$arch-unibilium gperf" ; exitIfFailed
|
||||
}
|
||||
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)
|
||||
C:\Python27\python.exe -m pip install neovim ; exitIfFailed
|
||||
C:\Python35\python.exe -m pip install neovim ; exitIfFailed
|
||||
# Disambiguate python3
|
||||
move c:\Python35\python.exe c:\Python35\python3.exe
|
||||
$env:PATH = "C:\Python35;C:\Python27;$env:PATH"
|
||||
# Sanity check
|
||||
python -c "import neovim; print(str(neovim))" ; exitIfFailed
|
||||
python3 -c "import neovim; print(str(neovim))" ; exitIfFailed
|
||||
|
||||
$env:PATH = "C:\Ruby24\bin;$env:PATH"
|
||||
cmd /c gem.cmd install neovim ; exitIfFailed
|
||||
where.exe neovim-ruby-host.bat ; exitIfFailed
|
||||
|
||||
cmd /c npm.cmd install -g neovim ; exitIfFailed
|
||||
where.exe neovim-node-host.cmd ; exitIfFailed
|
||||
|
||||
function convertToCmakeArgs($vars) {
|
||||
return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" }
|
||||
}
|
||||
|
||||
mkdir .deps
|
||||
cd .deps
|
||||
cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) ..\third-party\ ; exitIfFailed
|
||||
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
||||
cd ..
|
||||
|
||||
# Build Neovim
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed
|
||||
cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed
|
||||
bin\nvim --version ; exitIfFailed
|
||||
|
||||
# Functional tests
|
||||
cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs ; exitIfFailed
|
||||
|
||||
if ($uploadToCodecov) {
|
||||
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F functionaltest || echo 'codecov upload failed.'"
|
||||
}
|
||||
|
||||
# Old tests
|
||||
$env:PATH += ';C:\msys64\usr\bin'
|
||||
& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1
|
||||
|
||||
if ($uploadToCodecov) {
|
||||
C:\msys64\usr\bin\bash -lc "cd /c/projects/neovim; bash <(curl -s https://codecov.io/bash) -c -F oldtest || echo 'codecov upload failed.'"
|
||||
}
|
||||
|
||||
# Build artifacts
|
||||
cpack -G ZIP -C RelWithDebInfo
|
||||
if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) {
|
||||
cpack -G NSIS -C RelWithDebInfo
|
||||
}
|
Loading…
Reference in New Issue