diff options
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/before_install.sh | 10 | ||||
-rwxr-xr-x | ci/before_script.sh | 5 | ||||
-rw-r--r-- | ci/build.ps1 | 53 | ||||
-rw-r--r-- | ci/common/build.sh | 6 | ||||
-rwxr-xr-x | ci/common/submit_coverage.sh | 11 | ||||
-rwxr-xr-x | ci/install.sh | 26 | ||||
-rwxr-xr-x | ci/run_lint.sh | 4 | ||||
-rwxr-xr-x | ci/run_tests.sh | 2 | ||||
-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, 142 insertions, 28 deletions
diff --git a/ci/before_install.sh b/ci/before_install.sh index 5cb6894b8c..5810bec71a 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 @@ -47,12 +43,12 @@ if [[ "${TRAVIS_OS_NAME}" == osx ]] || [ ! -f ~/.nvm/nvm.sh ]; then fi source ~/.nvm/nvm.sh -nvm install --lts -nvm use --lts +nvm install 10 +nvm use 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..a0e87adb9e 100755 --- a/ci/before_script.sh +++ b/ci/before_script.sh @@ -35,5 +35,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..244b4766b2 100644 --- a/ci/build.ps1 +++ b/ci/build.ps1 @@ -1,10 +1,11 @@ -$ErrorActionPreference = 'stop' -Set-PSDebug -Strict -Trace 1 +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,7 +24,6 @@ $uploadToCodeCov = $false function exitIfFailed() { if ($LastExitCode -ne 0) { - Set-PSDebug -Off exit $LastExitCode } } @@ -46,6 +46,10 @@ 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 @@ -94,6 +98,27 @@ npm.cmd install -g neovim Get-Command -CommandType Application neovim-node-host.cmd npm.cmd link neovim + +$env:TREE_SITTER_DIR = $env:USERPROFILE + "\tree-sitter-build" +mkdir "$env:TREE_SITTER_DIR\bin" + +$xbits = if ($bits -eq '32') {'x86'} else {'x64'} +Invoke-WebRequest -UseBasicParsing -Uri "https://github.com/tree-sitter/tree-sitter/releases/download/0.15.9/tree-sitter-windows-$xbits.gz" -OutFile tree-sitter.exe.gz +C:\msys64\usr\bin\gzip -d tree-sitter.exe.gz + +Invoke-WebRequest -UseBasicParsing -Uri "https://codeload.github.com/tree-sitter/tree-sitter-c/zip/v0.15.2" -OutFile tree_sitter_c.zip +Expand-Archive .\tree_sitter_c.zip -DestinationPath . +cd tree-sitter-c-0.15.2 +..\tree-sitter.exe test +if (-Not (Test-Path -PathType Leaf "$env:TREE_SITTER_DIR\bin\c.dll")) { + exit 1 +} + +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,26 +138,26 @@ cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed # Ensure that the "win32" feature is set. .\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed +if ($env:USE_LUACOV -eq 1) { + & $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov +} + # 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 -} -Set-PSDebug -Strict -Trace 1 - 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. diff --git a/ci/common/build.sh b/ci/common/build.sh index 8e9b2f8ebb..02e1110a15 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}" 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..a6cd955da5 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 @@ -24,3 +24,27 @@ gem install --no-document --version ">= 0.8.0" neovim echo "Install neovim npm package" npm install -g neovim npm link neovim + +echo "Install tree-sitter npm package" + +# FIXME +# https://github.com/tree-sitter/tree-sitter/commit/e14e285a1087264a8c74a7c62fcaecc49db9d904 +# If queries added to tree-sitter-c, we can use latest tree-sitter-cli +npm install -g tree-sitter-cli@v0.15.9 + +echo "Install tree-sitter c parser" +curl "https://codeload.github.com/tree-sitter/tree-sitter-c/tar.gz/v0.15.2" -o tree_sitter_c.tar.gz +tar xf tree_sitter_c.tar.gz +cd tree-sitter-c-0.15.2 +export TREE_SITTER_DIR=$HOME/tree-sitter-build/ +mkdir -p "$TREE_SITTER_DIR/bin" + +if [[ "$BUILD_32BIT" != "ON" ]]; then + # builds c parser in $HOME/tree-sitter-build/bin/c.(so|dylib) + tree-sitter test +else + # no tree-sitter binary for 32bit linux, so fake it (no tree-sitter unit tests) + cd src/ + gcc -m32 -o "$TREE_SITTER_DIR/bin/c.so" -shared parser.c -I. +fi +test -f "$TREE_SITTER_DIR/bin/c.so" 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..6b2f69293c 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -19,6 +19,8 @@ exit_suite --continue enter_suite tests +export TREE_SITTER_DIR=$HOME/tree-sitter-build/ + if test "$CLANG_SANITIZER" != "TSAN" ; then # Additional threads are only created when the builtin UI starts, which # doesn't happen in the unit/functional tests 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 |