diff options
author | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
---|---|---|
committer | Josh Rahm <rahm@google.com> | 2022-07-18 19:37:18 +0000 |
commit | 308e1940dcd64aa6c344c403d4f9e0dda58d9c5c (patch) | |
tree | 35fe43e01755e0f312650667004487a44d6b7941 /ci | |
parent | 96a00c7c588b2f38a2424aeeb4ea3581d370bf2d (diff) | |
parent | e8c94697bcbe23a5c7b07c292b90a6b70aadfa87 (diff) | |
download | rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.gz rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.tar.bz2 rneovim-308e1940dcd64aa6c344c403d4f9e0dda58d9c5c.zip |
Merge remote-tracking branch 'upstream/master' into rahm
Diffstat (limited to 'ci')
-rwxr-xr-x | ci/before_cache.sh | 4 | ||||
-rw-r--r-- | ci/build.ps1 | 326 | ||||
-rw-r--r-- | ci/common/build.sh | 11 | ||||
-rwxr-xr-x | ci/common/submit_coverage.sh | 6 | ||||
-rw-r--r-- | ci/common/suite.sh | 74 | ||||
-rw-r--r-- | ci/common/test.sh | 44 | ||||
-rwxr-xr-x | ci/install.sh | 12 | ||||
-rwxr-xr-x | ci/run_lint.sh | 31 | ||||
-rwxr-xr-x | ci/run_tests.sh | 47 | ||||
-rwxr-xr-x | ci/script.sh | 12 | ||||
-rwxr-xr-x | ci/snap/deploy.sh | 4 |
11 files changed, 209 insertions, 362 deletions
diff --git a/ci/before_cache.sh b/ci/before_cache.sh index c86109168e..bec6c37bbe 100755 --- a/ci/before_cache.sh +++ b/ci/before_cache.sh @@ -7,6 +7,8 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "${CI_DIR}/common/build.sh" source "${CI_DIR}/common/suite.sh" +mkdir -p "${HOME}/.cache" + echo "before_cache.sh: cache size" du -chd 1 "${HOME}/.cache" | sort -rh | head -20 @@ -16,7 +18,7 @@ ccache -s 2>/dev/null || true find "${HOME}/.ccache" -name stats -delete # Update the third-party dependency cache only if the build was successful. -if ended_successfully; then +if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then # Do not cache downloads. They should not be needed with up-to-date deps. rm -rf "${DEPS_BUILD_DIR}/build/downloads" rm -rf "${CACHE_NVIM_DEPS_DIR}" diff --git a/ci/build.ps1 b/ci/build.ps1 index a81d351bc6..6c042f9116 100644 --- a/ci/build.ps1 +++ b/ci/build.ps1 @@ -1,182 +1,144 @@ -param([switch]$NoTests) -Set-StrictMode -Version Latest -$ErrorActionPreference = 'Stop' -$ProgressPreference = 'SilentlyContinue' - -$env:CONFIGURATION -match '^(?<compiler>\w+)_(?<bits>32|64)(?:-(?<option>\w+))?$' -$compiler = $Matches.compiler -$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)") -$depsCmakeVars = @{ - CMAKE_BUILD_TYPE = $cmakeBuildType; -} -$nvimCmakeVars = @{ - CMAKE_BUILD_TYPE = $cmakeBuildType; - BUSTED_OUTPUT_TYPE = 'nvim'; - DEPS_PREFIX=$(if ($env:DEPS_PREFIX -ne $null) {$env:DEPS_PREFIX} else {".deps/usr"}); -} -if ($env:DEPS_BUILD_DIR -eq $null) { - $env:DEPS_BUILD_DIR = ".deps"; -} -$uploadToCodeCov = $false - -function exitIfFailed() { - if ($LastExitCode -ne 0) { - exit $LastExitCode - } -} - -if (-not $NoTests) { - node --version - npm.cmd --version -} - -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 -} else { - write-host "cache dir $($env:DEPS_BUILD_DIR) size: $(Get-ChildItem $env:DEPS_BUILD_DIR -recurse | Measure-Object -property length -sum | Select -expand sum)" -} - -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 - $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', 'diffutils').ForEach({ - "mingw-w64-$arch-$_" - }) - - # Add MinGW to the PATH - $env:PATH = "C:\msys64\mingw$bits\bin;$env:PATH" - - # 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 - - # Build third-party dependencies - C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm -Syu" ; exitIfFailed - C:\msys64\usr\bin\bash -lc "pacman --verbose --noconfirm --needed -S $mingwPackages" ; 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' - } -} - -if (-not $NoTests) { - # Setup python (use AppVeyor system python) - - # Disambiguate python3, if needed - if (-not (Test-Path -Path C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe) ) { - move C:\hostedtoolcache\windows\Python\3.5.4\x64\python.exe C:\hostedtoolcache\windows\Python\3.5.4\x64\python3.exe - } - $env:PATH = "C:\hostedtoolcache\windows\Python\2.7.18\x64;C:\hostedtoolcache\windows\Python\3.5.4\x64;$env:PATH" - - python -m pip install pynvim ; exitIfFailed - python3 -m pip install pynvim ; exitIfFailed - # Sanity check - python -c "import pynvim; print(str(pynvim))" ; exitIfFailed - python3 -c "import pynvim; print(str(pynvim))" ; exitIfFailed - - gem.cmd install --pre 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 -} - -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)" } -} - -cd $env:DEPS_BUILD_DIR -cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed -cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed -cd $buildDir - -# Build Neovim -mkdir build -cd build -cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed -cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed -.\bin\nvim --version ; 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 -} - -if (-not $NoTests) { - # Functional tests - # The $LastExitCode from MSBuild can't be trusted - $failed = $false - - # 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 - - if ($uploadToCodecov) { - bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest - } -} - -# Ensure choco's cpack is not in PATH otherwise, it conflicts with CMake's -if (Test-Path -Path $env:ChocolateyInstall\bin\cpack.exe) { - Remove-Item -Path $env:ChocolateyInstall\bin\cpack.exe -Force -} - -# Build artifacts -cpack -G ZIP -C RelWithDebInfo -if ($env:APPVEYOR_REPO_TAG_NAME -ne $null) { - cpack -G NSIS -C RelWithDebInfo -} +[CmdletBinding(DefaultParameterSetName = "Build")]
+param(
+ [Parameter(ParameterSetName="Build")][switch]$Build,
+ [Parameter(ParameterSetName="BuildDeps")][switch]$BuildDeps,
+ [Parameter(ParameterSetName="EnsureTestDeps")][switch]$EnsureTestDeps,
+ [Parameter(ParameterSetName="Package")][switch]$Package,
+ [Parameter(ParameterSetName="Test")][switch]$Test,
+ [Parameter(ParameterSetName="TestOld")][switch]$TestOld
+)
+
+Set-StrictMode -Version Latest
+$ErrorActionPreference = 'Stop'
+$ProgressPreference = 'SilentlyContinue'
+
+$projectDir = [System.IO.Path]::GetFullPath("$(Get-Location)")
+$buildDir = Join-Path -Path $projectDir -ChildPath "build"
+
+# $env:CMAKE_BUILD_TYPE is ignored by cmake when not using ninja
+$cmakeBuildType = $(if ($null -ne $env:CMAKE_BUILD_TYPE) {$env:CMAKE_BUILD_TYPE} else {'RelWithDebInfo'});
+$depsCmakeVars = @{
+ CMAKE_BUILD_TYPE=$cmakeBuildType;
+}
+$nvimCmakeVars = @{
+ CMAKE_BUILD_TYPE=$cmakeBuildType;
+ BUSTED_OUTPUT_TYPE = 'nvim';
+ DEPS_PREFIX=$(if ($null -ne $env:DEPS_PREFIX) {$env:DEPS_PREFIX} else {".deps/usr"});
+}
+if ($null -eq $env:DEPS_BUILD_DIR) {
+ $env:DEPS_BUILD_DIR = Join-Path -Path $projectDir -ChildPath ".deps"
+}
+$uploadToCodeCov = $false
+
+function exitIfFailed() {
+ if ($LastExitCode -ne 0) {
+ exit $LastExitCode
+ }
+}
+
+function convertToCmakeArgs($vars) {
+ return $vars.GetEnumerator() | ForEach-Object { "-D$($_.Key)=$($_.Value)" }
+}
+
+$installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
+if ($installationPath -and (Test-Path "$installationPath\Common7\Tools\vsdevcmd.bat")) {
+ & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x64 -no_logo && set" | ForEach-Object {
+ $name, $value = $_ -split '=', 2
+ Set-Content env:\"$name" $value
+ }
+}
+
+function BuildDeps {
+
+ if (Test-Path -PathType container $env:DEPS_BUILD_DIR) {
+ $cachedBuildTypeStr = $(Get-Content $env:DEPS_BUILD_DIR\CMakeCache.txt | Select-String -Pattern "CMAKE_BUILD_TYPE.*=($cmakeBuildType)")
+ if (-not $cachedBuildTypeStr) {
+ Write-Warning " unable to validate build type from cache dir ${env:DEPS_BUILD_DIR}"
+ }
+ }
+
+ # we currently can't use ninja for cmake.deps, see #19405
+ $depsCmakeGenerator = "Visual Studio 16 2019"
+ $depsCmakeGeneratorPlf = "x64"
+ cmake -S "$projectDir\cmake.deps" -B $env:DEPS_BUILD_DIR -G $depsCmakeGenerator -A $depsCmakeGeneratorPlf $(convertToCmakeArgs($depsCmakeVars)); exitIfFailed
+
+ $depsCmakeNativeToolOptions= @('/verbosity:normal', '/m')
+ cmake --build $env:DEPS_BUILD_DIR --config $cmakeBuildType -- $depsCmakeNativeToolOptions; exitIfFailed
+}
+
+function Build {
+ cmake -S $projectDir -B $buildDir $(convertToCmakeArgs($nvimCmakeVars)) -G Ninja; exitIfFailed
+ cmake --build $buildDir --config $cmakeBuildType; exitIfFailed
+}
+
+function EnsureTestDeps {
+ & $buildDir\bin\nvim.exe "--version"; exitIfFailed
+
+ # Ensure that the "win32" feature is set.
+ & $buildDir\bin\nvim -u NONE --headless -c 'exe !has(\"win32\").\"cq\"' ; exitIfFailed
+
+ python -m pip install pynvim
+ # Sanity check
+ python -c "import pynvim; print(str(pynvim))"; exitIfFailed
+
+ gem.cmd install --pre neovim
+ Get-Command -CommandType Application neovim-ruby-host.bat; exitIfFailed
+
+ node --version
+ npm.cmd --version
+
+ npm.cmd install -g neovim; exitIfFailed
+ Get-Command -CommandType Application neovim-node-host.cmd; exitIfFailed
+ npm.cmd link neovim
+
+ if ($env:USE_LUACOV -eq 1) {
+ & $env:DEPS_PREFIX\luarocks\luarocks.bat install cluacov
+ }
+}
+
+function Test {
+ # Functional tests
+ # The $LastExitCode from MSBuild can't be trusted
+ $failed = $false
+
+ cmake --build $buildDir --target functionaltest 2>&1 |
+ ForEach-Object { $failed = $failed -or
+ $_ -match 'functional tests failed with error'; $_ }
+
+ if ($failed) {
+ exit $LastExitCode
+ }
+
+ if (-not $uploadToCodecov) {
+ return
+ }
+ if ($env:USE_LUACOV -eq 1) {
+ & $env:DEPS_PREFIX\bin\luacov.bat
+ }
+ bash -l /c/projects/neovim/ci/common/submit_coverage.sh functionaltest
+}
+
+function TestOld {
+ # 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\mingw64\bin\mingw32-make.exe" -C $(Convert-Path $projectDir\src\nvim\testdir) VERBOSE=1; exitIfFailed
+ $env:PATH = $OldPath
+
+ if ($uploadToCodecov) {
+ bash -l /c/projects/neovim/ci/common/submit_coverage.sh oldtest
+ }
+}
+
+
+function Package {
+ cmake -S $projectDir -B $buildDir $(convertToCmakeArgs($nvimCmakeVars)) -G Ninja; exitIfFailed
+ cmake --build $buildDir --target package; exitIfFailed
+}
+
+if ($PSCmdlet.ParameterSetName) {
+ & (Get-ChildItem "Function:$($PSCmdlet.ParameterSetName)")
+ exit
+}
diff --git a/ci/common/build.sh b/ci/common/build.sh index 0ee4b7493f..f083796a28 100644 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -8,8 +8,6 @@ _stat() { top_make() { printf '%78s\n' | tr ' ' '=' - # Travis has 1.5 virtual cores according to: - # http://docs.travis-ci.com/user/speeding-up-the-build/#Paralellizing-your-build-on-one-VM ninja "$@" } @@ -37,7 +35,7 @@ build_deps() { # update CMake configuration and update to newer deps versions. cd "${DEPS_BUILD_DIR}" echo "Configuring with '${DEPS_CMAKE_FLAGS}'." - CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/third-party/" + CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/cmake.deps/" if ! top_make; then exit 1 @@ -46,7 +44,9 @@ build_deps() { cd "${CI_BUILD_DIR}" } -prepare_build() { +build_nvim() { + check_core_dumps --delete quiet + if test -n "${CLANG_SANITIZER}" ; then CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" fi @@ -55,9 +55,8 @@ prepare_build() { cd "${BUILD_DIR}" echo "Configuring with '${CMAKE_FLAGS} $@'." cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}" -} -build_nvim() { + echo "Building nvim." if ! top_make nvim ; then exit 1 diff --git a/ci/common/submit_coverage.sh b/ci/common/submit_coverage.sh index 9c7887de0b..f781ca8e5e 100755 --- a/ci/common/submit_coverage.sh +++ b/ci/common/submit_coverage.sh @@ -4,7 +4,7 @@ # Args: # $1: Flag(s) for codecov, separated by comma. -set -ex +set -e # Change to grandparent dir (POSIXly). CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit @@ -18,12 +18,12 @@ if ! [ -f "$codecov_sh" ]; then curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash chmod +x "$codecov_sh" - python3 -m pip install --quiet --user gcovr + python -m pip install --quiet --user gcovr fi ( cd build - python3 -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml + python -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml ) # Upload to codecov. diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 561849ce2d..0320ac15c3 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -1,9 +1,3 @@ -# HACK: get newline for use in strings given that "\n" and $'' do not work. -NL="$(printf '\nE')" -NL="${NL%E}" - -FAIL_SUMMARY="" - # Test success marker. If END_MARKER file exists, we know that all tests # finished. If FAIL_SUMMARY_FILE exists we know that some tests failed, this # file will contain information about failed tests. Build is considered @@ -11,81 +5,27 @@ FAIL_SUMMARY="" END_MARKER="$BUILD_DIR/.tests_finished" FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors" -ci_fold() { - if test "$GITHUB_ACTIONS" = "true"; then - local action="$1" - local name="$2" - case "$action" in - start) - echo "::group::${name}" - ;; - end) - echo "::endgroup::" - ;; - *) - :;; - esac - fi -} - -enter_suite() { - set +x - FAILED=0 - rm -f "${END_MARKER}" - local suite_name="$1" - export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE}/$suite_name" - ci_fold "start" "$suite_name" - set -x -} - -exit_suite() { - set +x - if test $FAILED -ne 0 ; then - echo "Suite ${NVIM_TEST_CURRENT_SUITE} failed, summary:" - echo "${FAIL_SUMMARY}" - else - ci_fold "end" "" - fi - export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}" - if test "$1" != "--continue" ; then - exit $FAILED - else - local saved_failed=$FAILED - FAILED=0 - return $saved_failed - fi -} - fail() { local test_name="$1" - local fail_char="$2" - local message="$3" + local message="$2" - : ${fail_char:=F} : ${message:=Test $test_name failed} - local full_msg="$fail_char $NVIM_TEST_CURRENT_SUITE|$test_name :: $message" - FAIL_SUMMARY="${FAIL_SUMMARY}${NL}${full_msg}" + local full_msg="$test_name :: $message" echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}" echo "Failed: $full_msg" FAILED=1 } -run_test() { - local cmd="$1" - test $# -gt 0 && shift - local test_name="$1" - : ${test_name:=$cmd} - test $# -gt 0 && shift - if ! eval "$cmd" ; then - fail "${test_name}" "$@" - fi -} - ended_successfully() { if test -f "${FAIL_SUMMARY_FILE}" ; then echo 'Test failed, complete summary:' cat "${FAIL_SUMMARY_FILE}" + + if [[ "$GITHUB_ACTIONS" == "true" ]]; then + rm -f "$FAIL_SUMMARY_FILE" + fi + return 1 fi if ! test -f "${END_MARKER}" ; then diff --git a/ci/common/test.sh b/ci/common/test.sh index 92c15c8ba1..7db39a0e5f 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -51,7 +51,7 @@ check_core_dumps() { fi done if test "$app" != quiet ; then - fail 'cores' E 'Core dumps found' + fail 'cores' 'Core dumps found' fi } @@ -72,7 +72,7 @@ check_logs() { rm "${log}" done if test -n "${err}" ; then - fail 'logs' E 'Runtime errors detected.' + fail 'logs' 'Runtime errors detected.' fi } @@ -86,46 +86,39 @@ check_sanitizer() { fi } -run_unittests() {( - enter_suite unittests +unittests() {( ulimit -c unlimited || true if ! build_make unittest ; then - fail 'unittests' F 'Unit tests failed' + fail 'unittests' 'Unit tests failed' fi submit_coverage unittest check_core_dumps "$(command -v luajit)" - exit_suite )} -run_functionaltests() {( - enter_suite functionaltests +functionaltests() {( ulimit -c unlimited || true if ! build_make ${FUNCTIONALTEST}; then - fail 'functionaltests' F 'Functional tests failed' + fail 'functionaltests' 'Functional tests failed' fi submit_coverage functionaltest check_sanitizer "${LOG_DIR}" valgrind_check "${LOG_DIR}" check_core_dumps - exit_suite )} -run_oldtests() {( - enter_suite oldtests +oldtests() {( ulimit -c unlimited || true if ! make oldtest; then reset - fail 'oldtests' F 'Legacy tests failed' + fail 'oldtests' 'Legacy tests failed' fi submit_coverage oldtest check_sanitizer "${LOG_DIR}" valgrind_check "${LOG_DIR}" check_core_dumps - exit_suite )} check_runtime_files() {( - set +x local test_name="$1" ; shift local message="$1" ; shift local tst="$1" ; shift @@ -136,27 +129,25 @@ check_runtime_files() {( # Prefer failing the build over using more robust construct because files # with IFS are not welcome. if ! test -e "$file" ; then - fail "$test_name" E \ - "It appears that $file is only a part of the file name" + fail "$test_name" "It appears that $file is only a part of the file name" fi if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file" ; then - fail "$test_name" F "$(printf "$message" "$file")" + fail "$test_name" "$(printf "$message" "$file")" fi done )} install_nvim() {( - enter_suite 'install_nvim' if ! build_make install ; then - fail 'install' E 'make install failed' - exit_suite + fail 'install' 'make install failed' + exit 1 fi "${INSTALL_PREFIX}/bin/nvim" --version if ! "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' ; then echo "Running ':help' in the installed nvim failed." echo "Maybe the helptags have not been generated properly." - fail 'help' F 'Failed running :help' + fail 'help' 'Failed running :help' fi # Check that all runtime files were installed @@ -177,13 +168,6 @@ install_nvim() {( local genvimsynf=syntax/vim/generated.vim local gpat='syn keyword vimFuncName .*eval' if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf" ; then - fail 'funcnames' F "It appears that $genvimsynf does not contain $gpat." + fail 'funcnames' "It appears that $genvimsynf does not contain $gpat." fi - - exit_suite )} - -csi_clean() { - find "${BUILD_DIR}/bin" -name 'test-includes-*' -delete - find "${BUILD_DIR}" -name '*test-include*.o' -delete -} diff --git a/ci/install.sh b/ci/install.sh index bd42274b49..5925cc7b02 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -4,12 +4,8 @@ set -e set -o pipefail # Use default CC to avoid compilation problems when installing Python modules. -echo "Install neovim module for Python 3." +echo "Install neovim module for Python." CC=cc python3 -m pip -q install --user --upgrade pynvim -if python2 -m pip -c True 2>&1; then - echo "Install neovim module for Python 2." - CC=cc python2 -m pip -q install --user --upgrade pynvim -fi echo "Install neovim RubyGem." gem install --no-document --bindir "$HOME/.local/bin" --user-install --pre neovim @@ -18,5 +14,7 @@ echo "Install neovim npm package" 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' +if [[ $CI_OS_NAME != osx ]]; then + sudo cpanm -n Neovim::Ext || cat "$HOME/.cpanm/build.log" + perl -W -e 'use Neovim::Ext; print $Neovim::Ext::VERSION' +fi diff --git a/ci/run_lint.sh b/ci/run_lint.sh deleted file mode 100755 index 314976edc2..0000000000 --- a/ci/run_lint.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" - -source "${CI_DIR}/common/build.sh" -source "${CI_DIR}/common/suite.sh" - -enter_suite 'clint' -run_test 'make clint-full' clint -exit_suite --continue - -enter_suite 'lualint' -run_test 'make lualint' lualint -exit_suite --continue - -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 -run_test 'make check-single-includes' single-includes -exit_suite --continue - -end_tests diff --git a/ci/run_tests.sh b/ci/run_tests.sh index c175910da5..da72d09506 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -8,29 +8,34 @@ source "${CI_DIR}/common/build.sh" source "${CI_DIR}/common/test.sh" source "${CI_DIR}/common/suite.sh" -enter_suite build - -check_core_dumps --delete quiet - -prepare_build -build_nvim - -exit_suite --continue - -enter_suite tests - -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 - if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then - run_test run_unittests +rm -f "$END_MARKER" + +# Run all tests (with some caveats) if no input argument is given +if (($# == 0)); then + tests=('build_nvim') + + 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 + if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then + tests+=('unittests') + fi + tests+=('functionaltests') fi - run_test run_functionaltests -fi -run_test run_oldtests -run_test install_nvim + tests+=('oldtests' 'install_nvim') +else + tests=("$@") +fi -exit_suite --continue +for i in "${tests[@]}"; do + eval "$i" || fail "$i" +done end_tests + +if [[ -s "${GCOV_ERROR_FILE}" ]]; then + echo '=== Unexpected gcov errors: ===' + cat "${GCOV_ERROR_FILE}" + exit 1 +fi diff --git a/ci/script.sh b/ci/script.sh deleted file mode 100755 index 74fc4eda6c..0000000000 --- a/ci/script.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -ci/run_${CI_TARGET}.sh - -if [[ -s "${GCOV_ERROR_FILE}" ]]; then - echo '=== Unexpected gcov errors: ===' - cat "${GCOV_ERROR_FILE}" - exit 1 -fi diff --git a/ci/snap/deploy.sh b/ci/snap/deploy.sh index 8429059e22..1794fc61d9 100755 --- a/ci/snap/deploy.sh +++ b/ci/snap/deploy.sh @@ -8,7 +8,7 @@ WEBHOOK_PAYLOAD="$(cat "${SNAP_DIR}/.snapcraft_payload")" PAYLOAD_SIG="${SECRET_SNAP_SIG}" -snap_realease_needed() { +snap_release_needed() { last_committed_tag="$(git tag -l --sort=refname|head -1)" last_snap_release="$(snap info nvim | awk '$1 == "latest/edge:" { print $2 }' | perl -lpe 's/v\d.\d.\d-//g')" git fetch -f --tags @@ -33,7 +33,7 @@ trigger_snapcraft_webhook() { } -if $(snap_realease_needed); then +if $(snap_release_needed); then echo "New snap release required" trigger_snapcraft_webhook fi |