diff options
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/before_install.sh | 11 | ||||
-rwxr-xr-x | ci/before_script.sh | 11 | ||||
-rw-r--r-- | ci/build.ps1 | 134 | ||||
-rw-r--r-- | ci/common/build.sh | 15 | ||||
-rwxr-xr-x | ci/common/submit_coverage.sh | 11 | ||||
-rwxr-xr-x | ci/install.sh | 11 | ||||
-rwxr-xr-x | ci/run_lint.sh | 4 | ||||
-rwxr-xr-x | ci/run_tests.sh | 4 | ||||
-rwxr-xr-x | ci/snap/after_success.sh | 14 | ||||
-rwxr-xr-x | ci/snap/deploy.sh | 21 | ||||
-rwxr-xr-x | ci/snap/install.sh | 10 | ||||
-rwxr-xr-x | ci/snap/script.sh | 8 | ||||
-rw-r--r-- | ci/snap/travis_snapcraft.cfg | bin | 0 -> 2448 bytes |
13 files changed, 181 insertions, 73 deletions
diff --git a/ci/before_install.sh b/ci/before_install.sh index 5cb6894b8c..1cf60edf73 100755 --- a/ci/before_install.sh +++ b/ci/before_install.sh @@ -3,10 +3,6 @@ set -e set -o pipefail -if [[ "${CI_TARGET}" == lint ]]; then - exit -fi - echo 'Python info:' ( set -x @@ -26,7 +22,7 @@ if [[ "${TRAVIS_OS_NAME}" != osx ]] && command -v pyenv; then echo 'Setting Python versions via pyenv' # Prefer Python 2 over 3 (more conservative). - pyenv global 2.7.15:3.7 + pyenv global 2.7.15:3.7.1 echo 'Updated Python info:' ( @@ -47,12 +43,11 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then fi source ~/.nvm/nvm.sh -nvm install --lts -nvm use --lts +nvm install 10 if [[ -n "$CMAKE_URL" ]]; then echo "Installing custom CMake: $CMAKE_URL" - curl --retry 5 --silent --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" + curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" mkdir -p "$HOME/.local/bin" /opt/cmake-custom bash /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake" diff --git a/ci/before_script.sh b/ci/before_script.sh index 605ecdbf66..1759dbe942 100755 --- a/ci/before_script.sh +++ b/ci/before_script.sh @@ -10,6 +10,12 @@ fi CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${CI_DIR}/common/build.sh" +# Enable ipv6 on Travis. ref: a39c8b7ce30d +if ! test "${TRAVIS_OS_NAME}" = osx ; then + echo "before_script.sh: enable ipv6" + sudo sysctl -w net.ipv6.conf.lo.disable_ipv6=0 +fi + # Test some of the configuration variables. if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then echo "\$GCOV: '${GCOV}' is not executable." @@ -35,5 +41,10 @@ fi # Compile dependencies. build_deps +# Install cluacov for Lua coverage. +if [[ "$USE_LUACOV" == 1 ]]; then + "${DEPS_BUILD_DIR}/usr/bin/luarocks" install cluacov +fi + rm -rf "${LOG_DIR}" mkdir -p "${LOG_DIR}" diff --git a/ci/build.ps1 b/ci/build.ps1 index d533d7b4e0..36570be7ae 100644 --- a/ci/build.ps1 +++ b/ci/build.ps1 @@ -1,10 +1,12 @@ -$ErrorActionPreference = 'stop' -Set-PSDebug -Strict -Trace 1 +param([switch]$NoTests) +Set-StrictMode -Version Latest +$ErrorActionPreference = 'Stop' +$ProgressPreference = 'SilentlyContinue' $isPullRequest = ($env:APPVEYOR_PULL_REQUEST_HEAD_COMMIT -ne $null) $env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$' $compiler = $Matches.compiler -$compileOption = $Matches.option +$compileOption = if ($Matches -contains 'option') {$Matches.option} else {''} $bits = $Matches.bits $cmakeBuildType = $(if ($env:CMAKE_BUILD_TYPE -ne $null) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'}); $buildDir = [System.IO.Path]::GetFullPath("$(pwd)") @@ -23,11 +25,33 @@ $uploadToCodeCov = $false function exitIfFailed() { if ($LastExitCode -ne 0) { - Set-PSDebug -Off exit $LastExitCode } } +# https://github.com/lukesampson/scoop#installation +$scoop = (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh') +& { + Set-StrictMode -Off + Invoke-Expression $scoop +} + +scoop install perl +perl --version +cpanm.bat --version + +if (-not $NoTests) { + scoop install nodejs-lts + node --version + npm.cmd --version + + cpanm.bat -n Neovim::Ext + if ($LastExitCode -ne 0) { + Get-Content -Path "$env:USERPROFILE\.cpanm\build.log" + } + perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION'; exitIfFailed +} + 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 @@ -46,13 +70,17 @@ if ($compiler -eq 'MINGW') { $nvimCmakeVars['USE_GCOV'] = 'ON' $uploadToCodecov = $true $env:GCOV = "C:\msys64\mingw$bits\bin\gcov" + + # Setup/build Lua coverage. + $env:USE_LUACOV = 1 + $env:BUSTED_ARGS = "--coverage" } # 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 = 'Ninja' $cmakeGeneratorArgs = '-v' - $mingwPackages = @('ninja', 'cmake', 'perl', 'diffutils').ForEach({ + $mingwPackages = @('ninja', 'cmake', 'diffutils').ForEach({ "mingw-w64-$arch-$_" }) @@ -76,23 +104,30 @@ elseif ($compiler -eq 'MSVC') { } } -# Setup python (use AppVeyor system python) -C:\Python27\python.exe -m pip install pynvim ; exitIfFailed -C:\Python35\python.exe -m pip install pynvim ; 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 pynvim; print(str(pynvim))" ; exitIfFailed -python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed - -$env:PATH = "C:\Ruby24\bin;$env:PATH" -gem.cmd install neovim -Get-Command -CommandType Application neovim-ruby-host.bat +if (-not $NoTests) { + # Setup python (use AppVeyor system python) + C:\Python27\python.exe -m pip install pynvim ; exitIfFailed + C:\Python35\python.exe -m pip install pynvim ; 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 pynvim; print(str(pynvim))" ; exitIfFailed + python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed + + $env:PATH = "C:\Ruby24\bin;$env:PATH" + gem.cmd install neovim + Get-Command -CommandType Application neovim-ruby-host.bat + + npm.cmd install -g neovim + Get-Command -CommandType Application neovim-node-host.cmd + npm.cmd link neovim +} -npm.cmd install -g neovim -Get-Command -CommandType Application neovim-node-host.cmd -npm.cmd link neovim +if ($compiler -eq 'MSVC') { + # Required for LuaRocks (https://github.com/luarocks/luarocks/issues/1039#issuecomment-507296940). + $env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2017/Community/VC/Tools/MSVC/14.16.27023/" +} function convertToCmakeArgs($vars) { return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" } @@ -113,37 +148,42 @@ cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed # Ensure that the "win32" feature is set. .\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed -# Functional tests -# The $LastExitCode from MSBuild can't be trusted -$failed = $false -# Temporarily turn off tracing to reduce log file output -Set-PSDebug -Off -cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 | - foreach { $failed = $failed -or - $_ -match 'functional tests failed with error'; $_ } -if ($failed) { - if ($uploadToCodecov) { - bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest - } - exit $LastExitCode +if ($env:USE_LUACOV -eq 1) { + & $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov } -Set-PSDebug -Strict -Trace 1 +if (-not $NoTests) { + # Functional tests + # The $LastExitCode from MSBuild can't be trusted + $failed = $false -if ($uploadToCodecov) { - bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest -} + # Run only this test file: + # $env:TEST_FILE = "test\functional\foo.lua" + cmake --build . --config $cmakeBuildType --target functionaltest -- $cmakeGeneratorArgs 2>&1 | + foreach { $failed = $failed -or + $_ -match 'functional tests failed with error'; $_ } + + if ($uploadToCodecov) { + if ($env:USE_LUACOV -eq 1) { + & $env:DEPS_PREFIX\bin\luacov.bat + } + bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest + } + if ($failed) { + exit $LastExitCode + } -# Old tests -# Add MSYS to path, required for e.g. `find` used in test scripts. -# But would break functionaltests, where its `more` would be used then. -$OldPath = $env:PATH -$env:PATH = "C:\msys64\usr\bin;$env:PATH" -& "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed -$env:PATH = $OldPath + # Old tests + # Add MSYS to path, required for e.g. `find` used in test scripts. + # But would break functionaltests, where its `more` would be used then. + $OldPath = $env:PATH + $env:PATH = "C:\msys64\usr\bin;$env:PATH" + & "C:\msys64\mingw$bits\bin\mingw32-make.exe" -C $(Convert-Path ..\src\nvim\testdir) VERBOSE=1 ; exitIfFailed + $env:PATH = $OldPath -if ($uploadToCodecov) { - bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest + if ($uploadToCodecov) { + bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest + } } # Build artifacts diff --git a/ci/common/build.sh b/ci/common/build.sh index 8e9b2f8ebb..0024f2cbd5 100644 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -18,9 +18,6 @@ build_make() { } build_deps() { - if test "${BUILD_32BIT}" = ON ; then - DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}" - fi if test "${FUNCTIONALTEST}" = "functionaltest-lua" \ || test "${CLANG_SANITIZER}" = "ASAN_UBSAN" ; then DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" @@ -53,9 +50,6 @@ prepare_build() { if test -n "${CLANG_SANITIZER}" ; then CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" fi - if test "${BUILD_32BIT}" = ON ; then - CMAKE_FLAGS="${CMAKE_FLAGS} ${CMAKE_FLAGS_32BIT}" - fi mkdir -p "${BUILD_DIR}" cd "${BUILD_DIR}" @@ -92,12 +86,3 @@ build_nvim() { cd "${TRAVIS_BUILD_DIR}" } - -macos_rvm_dance() { - # neovim-ruby gem requires a ruby newer than the macOS default. - source ~/.rvm/scripts/rvm - rvm get stable --auto-dotfiles - rvm reload - rvm use 2.2.5 - rvm use -} diff --git a/ci/common/submit_coverage.sh b/ci/common/submit_coverage.sh index 4e92975d22..9c7887de0b 100755 --- a/ci/common/submit_coverage.sh +++ b/ci/common/submit_coverage.sh @@ -43,3 +43,14 @@ fi # Cleanup always, especially collected data. find . \( -name '*.gcov' -o -name '*.gcda' \) -ls -delete | wc -l rm -f coverage.xml + +# Upload Lua coverage (generated manually on AppVeyor/Windows). +if [ "$USE_LUACOV" = 1 ] && [ "$1" != "oldtest" ]; then + if [ -x "${DEPS_BUILD_DIR}/usr/bin/luacov" ]; then + "${DEPS_BUILD_DIR}/usr/bin/luacov" + fi + if ! "$codecov_sh" -f luacov.report.out -X gcov -X fix -Z -F "lua,${codecov_flags}"; then + echo "codecov upload failed." + fi + rm luacov.stats.out +fi diff --git a/ci/install.sh b/ci/install.sh index cda9a11f08..a4dfc87a1b 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -4,7 +4,7 @@ set -e set -o pipefail if [[ "${CI_TARGET}" == lint ]]; then - python -m pip -q install --user --upgrade flake8 + python3 -m pip -q install --user --upgrade flake8 exit fi @@ -14,13 +14,18 @@ fi # Use default CC to avoid compilation problems when installing Python modules. echo "Install neovim module for Python 3." -CC=cc python3 -m pip -q install --upgrade pynvim +CC=cc python3 -m pip -q install --user --upgrade pynvim echo "Install neovim module for Python 2." -CC=cc python2 -m pip -q install --upgrade pynvim +CC=cc python2 -m pip -q install --user --upgrade pynvim echo "Install neovim RubyGem." gem install --no-document --version ">= 0.8.0" neovim echo "Install neovim npm package" +source ~/.nvm/nvm.sh +nvm use 10 npm install -g neovim npm link neovim + +sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log" +perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION' diff --git a/ci/run_lint.sh b/ci/run_lint.sh index 88af163e80..8373a3cb36 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -20,6 +20,10 @@ enter_suite 'pylint' run_test 'make pylint' pylint exit_suite --continue +enter_suite 'shlint' +run_test 'make shlint' shlint +exit_suite --continue + enter_suite single-includes CLICOLOR_FORCE=1 run_test_wd \ --allow-hang \ diff --git a/ci/run_tests.sh b/ci/run_tests.sh index c175910da5..d91ac5589e 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -17,6 +17,10 @@ build_nvim exit_suite --continue +source ~/.nvm/nvm.sh +nvm use 10 + + enter_suite tests if test "$CLANG_SANITIZER" != "TSAN" ; then diff --git a/ci/snap/after_success.sh b/ci/snap/after_success.sh new file mode 100755 index 0000000000..e66721a5e2 --- /dev/null +++ b/ci/snap/after_success.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + + +RESULT_SNAP=$(find ./ -name "*.snap") + +sudo snap install "$RESULT_SNAP" --dangerous --classic + +/snap/bin/nvim --version + +SHA256=$(sha256sum "$RESULT_SNAP") +echo "SHA256: ${SHA256} ." diff --git a/ci/snap/deploy.sh b/ci/snap/deploy.sh new file mode 100755 index 0000000000..5fbd52d775 --- /dev/null +++ b/ci/snap/deploy.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +# not a tagged release, abort +# [[ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ]] && exit 0 + +mkdir -p .snapcraft +# shellcheck disable=SC2154 +openssl aes-256-cbc -K "$encrypted_ece1c4844832_key" -iv "$encrypted_ece1c4844832_iv" \ + -in ci/snap/travis_snapcraft.cfg -out .snapcraft/snapcraft.cfg -d + +SNAP=$(find ./ -name "*.snap") + +# TODO(justinmk): This always does `edge` until we enable tagged builds. +if [[ "$SNAP" =~ "dirty" || "$SNAP" =~ "nightly" ]]; then + snapcraft push "$SNAP" --release edge +else + snapcraft push "$SNAP" --release candidate +fi diff --git a/ci/snap/install.sh b/ci/snap/install.sh new file mode 100755 index 0000000000..23e0bc5eb8 --- /dev/null +++ b/ci/snap/install.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +sudo apt update +sudo /snap/bin/lxd.migrate -yes +sudo /snap/bin/lxd waitready +sudo /snap/bin/lxd init --auto + diff --git a/ci/snap/script.sh b/ci/snap/script.sh new file mode 100755 index 0000000000..647cda4874 --- /dev/null +++ b/ci/snap/script.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e +set -o pipefail + +mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache" +sudo snapcraft --use-lxd + diff --git a/ci/snap/travis_snapcraft.cfg b/ci/snap/travis_snapcraft.cfg Binary files differnew file mode 100644 index 0000000000..3e6a60c30d --- /dev/null +++ b/ci/snap/travis_snapcraft.cfg |