diff options
-rw-r--r-- | .github/actions/cache/action.yml | 4 | ||||
-rw-r--r-- | .github/workflows/ci.yml | 80 | ||||
-rwxr-xr-x | .github/workflows/env.sh | 15 | ||||
-rw-r--r-- | .github/workflows/lintcommit.yml | 2 | ||||
-rw-r--r-- | .github/workflows/release.yml | 5 | ||||
-rw-r--r-- | .github/workflows/vim-patches.yml | 2 | ||||
-rw-r--r-- | CMakeLists.txt | 2 | ||||
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rwxr-xr-x | ci/before_cache.sh | 17 | ||||
-rwxr-xr-x | ci/before_script.sh | 9 | ||||
-rw-r--r-- | ci/common/test.sh | 173 | ||||
-rwxr-xr-x | ci/run_tests.sh | 176 | ||||
-rw-r--r-- | scripts/lintcommit.lua | 20 |
13 files changed, 244 insertions, 263 deletions
diff --git a/.github/actions/cache/action.yml b/.github/actions/cache/action.yml index 858045c02a..819380f351 100644 --- a/.github/actions/cache/action.yml +++ b/.github/actions/cache/action.yml @@ -3,7 +3,7 @@ description: "This action caches neovim dependencies" runs: using: "composite" steps: - - run: echo "CACHE_KEY=${{ github.job }}-${{ github.base_ref }}" >> $GITHUB_ENV + - run: echo "CACHE_KEY=${{ github.job }}" >> $GITHUB_ENV shell: bash - if: ${{ matrix }} @@ -16,7 +16,7 @@ runs: # files to search through. - uses: actions/cache@v3 with: - path: ${{ env.CACHE_NVIM_DEPS_DIR }} + path: ${{ env.DEPS_BUILD_DIR }} key: ${{ env.CACHE_KEY }}-${{ hashFiles('cmake**', 'ci/**', '.github/workflows/ci.yml', 'CMakeLists.txt', 'runtime/CMakeLists.txt', 'src/nvim/**/CMakeLists.txt') }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d1a6b5dcaa..c27100072f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,8 +85,8 @@ jobs: - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: luacheck run: | - cmake -B $BUILD_DIR -G Ninja - cmake --build $BUILD_DIR --target lintlua-luacheck + cmake -B build -G Ninja + cmake --build build --target lintlua-luacheck - if: success() || failure() && steps.abort_job.outputs.status == 'success' name: lintsh @@ -110,9 +110,6 @@ jobs: run: | git diff --color --exit-code - - name: Cache dependencies - run: ./ci/before_cache.sh - lintc: # This job tests two things: it lints the code but also builds neovim using # system dependencies instead of bundled dependencies. This is to make sure @@ -173,9 +170,6 @@ jobs: - if: success() || failure() && steps.abort_job.outputs.status == 'success' run: cmake --build build --target clang-tidy - - name: Cache dependencies - run: ./ci/before_cache.sh - posix: name: ${{ matrix.runner }} ${{ matrix.flavor }} (cc=${{ matrix.cc }}) strategy: @@ -200,15 +194,11 @@ jobs: # functionaltest-lua is our dumping ground for non-mainline configurations. # 1. Check that the tests pass with PUC Lua instead of LuaJIT. - # 2. Use as oldest/minimum versions of dependencies/build tools we - # still explicitly support so we don't accidentally rely on - # features that is only available on later versions. - # 3. No treesitter parsers installed. + # 2. No treesitter parsers installed. - flavor: functionaltest-lua cc: gcc runner: ubuntu-22.04 os: linux - cmake: minimum_required runs-on: ${{ matrix.runner }} timeout-minutes: 45 env: @@ -224,24 +214,6 @@ jobs: if: matrix.os == 'linux' run: ./.github/scripts/install_deps_ubuntu.sh - - name: Install minimum required version of cmake - if: matrix.cmake == 'minimum_required' - env: - CMAKE_URL: 'https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh' - CMAKE_VERSION: '3.10.0' - shell: bash - run: | - curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" - mkdir -p "$HOME/.local/bin" /opt/cmake-custom - chmod a+x /tmp/cmake-installer.sh - /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license - ln -sfn /opt/cmake-custom/bin/cmake "$HOME/.local/bin/cmake" - cmake_version="$(cmake --version | head -1)" - echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || { - echo "Unexpected CMake version: $cmake_version" - exit 1 - } - - name: Install brew packages if: matrix.os == 'osx' run: | @@ -282,16 +254,52 @@ jobs: name: Install nvim run: ./ci/run_tests.sh install_nvim - - name: Cache dependencies - run: ./ci/before_cache.sh + old_cmake: + name: Test oldest supported cmake + runs-on: ubuntu-22.04 + timeout-minutes: 15 + env: + CI_OS_NAME: linux + CMAKE_URL: 'https://cmake.org/files/v3.10/cmake-3.10.0-Linux-x86_64.sh' + CMAKE_VERSION: '3.10.0' + steps: + - uses: actions/checkout@v3 + + - name: Setup common environment variables + run: ./.github/workflows/env.sh old_cmake + + - name: Install apt packages + run: ./.github/scripts/install_deps_ubuntu.sh + + - name: Install minimum required version of cmake + run: | + curl --retry 5 --silent --show-error --fail -o /tmp/cmake-installer.sh "$CMAKE_URL" + mkdir -p "$BIN_DIR" /opt/cmake-custom + chmod a+x /tmp/cmake-installer.sh + /tmp/cmake-installer.sh --prefix=/opt/cmake-custom --skip-license + ln -sfn /opt/cmake-custom/bin/cmake "$BIN_DIR/cmake" + cmake_version="$(cmake --version | head -1)" + echo "$cmake_version" | grep -qF "cmake version $CMAKE_VERSION" || { + echo "Unexpected CMake version: $cmake_version" + exit 1 + } + + - uses: ./.github/actions/cache + + - name: Build dependencies + run: make deps + + - name: Build + run: make CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -D MIN_LOG_LEVEL=3" + + - name: Install + run: make install windows: runs-on: windows-2019 timeout-minutes: 45 env: DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps - CACHE_NVIM_DEPS_DIR: ${{ github.workspace }}/nvim-deps - DEPS_PREFIX: ${{ github.workspace }}/nvim-deps/usr name: windows (MSVC_64) steps: - uses: actions/checkout@v3 @@ -308,7 +316,7 @@ jobs: - name: Build nvim run: | - cmake -B build -G Ninja -D CMAKE_BUILD_TYPE='RelWithDebInfo' -D DEPS_PREFIX="$env:DEPS_PREFIX" -D CI_BUILD=ON + cmake -B build -G Ninja -D CMAKE_BUILD_TYPE='RelWithDebInfo' -D CI_BUILD=ON cmake --build build - name: Install test deps diff --git a/.github/workflows/env.sh b/.github/workflows/env.sh index 24d85fc23c..7be26e1a72 100755 --- a/.github/workflows/env.sh +++ b/.github/workflows/env.sh @@ -4,19 +4,17 @@ set -e -u FLAVOR=${1:-} BUILD_DIR=$CI_BUILD_DIR/build -BIN_DIR=$HOME/.local/bin +BIN_DIR=$CI_BUILD_DIR/bin DEPS_BUILD_DIR=$HOME/nvim-deps -INSTALL_PREFIX=$HOME/nvim-install +INSTALL_PREFIX=$CI_BUILD_DIR/nvim-install LOG_DIR=$BUILD_DIR/log NVIM_LOG_FILE=$BUILD_DIR/.nvimlog VALGRIND_LOG=$LOG_DIR/valgrind-%p.log -CACHE_DIR=$HOME/.cache -CACHE_NVIM_DEPS_DIR=$CACHE_DIR/nvim-deps -CACHE_MARKER=$CACHE_NVIM_DEPS_DIR/.ci_cache_marker +CACHE_DIR=$CI_BUILD_DIR/.cache CACHE_UNCRUSTIFY=$CACHE_DIR/uncrustify DEPS_CMAKE_FLAGS= FUNCTIONALTEST=functionaltest -CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -D BUSTED_OUTPUT_TYPE=nvim -D DEPS_PREFIX=$DEPS_BUILD_DIR/usr -D MIN_LOG_LEVEL=3" +CMAKE_FLAGS="-D CI_BUILD=ON -D CMAKE_INSTALL_PREFIX:PATH=$INSTALL_PREFIX -D MIN_LOG_LEVEL=3" CLANG_SANITIZER= ASAN_OPTIONS= UBSAN_OPTIONS= @@ -57,6 +55,7 @@ esac cat <<EOF >> "$GITHUB_ENV" CMAKE_FLAGS=$CMAKE_FLAGS BUILD_DIR=$BUILD_DIR +BIN_DIR=$BIN_DIR DEPS_BUILD_DIR=$DEPS_BUILD_DIR DEPS_CMAKE_FLAGS=$DEPS_CMAKE_FLAGS FUNCTIONALTEST=$FUNCTIONALTEST @@ -64,9 +63,7 @@ INSTALL_PREFIX=$INSTALL_PREFIX LOG_DIR=$LOG_DIR NVIM_LOG_FILE=$NVIM_LOG_FILE VALGRIND_LOG=$VALGRIND_LOG -CACHE_DIR=$HOME/.cache -CACHE_NVIM_DEPS_DIR=$CACHE_NVIM_DEPS_DIR -CACHE_MARKER=$CACHE_MARKER +CACHE_DIR=$CACHE_DIR CACHE_UNCRUSTIFY=$CACHE_UNCRUSTIFY CLANG_SANITIZER=$CLANG_SANITIZER ASAN_OPTIONS=$ASAN_OPTIONS diff --git a/.github/workflows/lintcommit.yml b/.github/workflows/lintcommit.yml index a7a227865d..9941a01a9b 100644 --- a/.github/workflows/lintcommit.yml +++ b/.github/workflows/lintcommit.yml @@ -20,4 +20,4 @@ jobs: with: neovim: true - run: wget https://raw.githubusercontent.com/neovim/neovim/master/scripts/lintcommit.lua - - run: nvim --clean -es +"cd pr_nvim" +"lua dofile('../lintcommit.lua').main({trace=true})" + - run: nvim --clean -es +"cd pr_nvim" +"lua dofile('../lintcommit.lua').main({trace=false})" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f547e27b3b..838caf3fca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -112,8 +112,7 @@ jobs: windows: runs-on: windows-2019 env: - DEPS_BUILD_DIR: ${{ format('{0}/nvim-deps', github.workspace) }} - DEPS_PREFIX: ${{ format('{0}/nvim-deps/usr', github.workspace) }} + DEPS_BUILD_DIR: ${{ github.workspace }}/nvim-deps CMAKE_BUILD_TYPE: "RelWithDebInfo" name: windows (MSVC_64) steps: @@ -128,7 +127,7 @@ jobs: cmake --build $env:DEPS_BUILD_DIR - name: build package run: | - cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' -DDEPS_PREFIX="$env:DEPS_PREFIX" + cmake -B build -G Ninja -DCMAKE_BUILD_TYPE='RelWithDebInfo' cmake --build build --target package - uses: actions/upload-artifact@v3 with: diff --git a/.github/workflows/vim-patches.yml b/.github/workflows/vim-patches.yml index 159eb09e7c..305f8019f1 100644 --- a/.github/workflows/vim-patches.yml +++ b/.github/workflows/vim-patches.yml @@ -11,7 +11,7 @@ jobs: contents: write pull-requests: write env: - VIM_SOURCE_DIR: ${{ format('{0}/vim-src', github.workspace) }} + VIM_SOURCE_DIR: ${{ github.workspace }}/vim-src VERSION_BRANCH: marvim/ci-version-update GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index 7abbff3471..d12b71a651 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -276,8 +276,6 @@ add_glob_target( GLOB_PAT *.sh EXCLUDE scripts/pvscheck.sh - ci/common - ci/snap TOUCH_STRATEGY SINGLE) add_custom_target(lintcommit diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f1c7ca1cb3..98c823ea9c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -98,7 +98,7 @@ the VCS/git logs more valuable. The general structure of a commit message is: ``` - Prefix the commit subject with one of these [_types_](https://github.com/commitizen/conventional-commit-types/blob/master/index.json): - - `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `test`, `vim-patch`, `dist` + - `build`, `ci`, `docs`, `feat`, `fix`, `perf`, `refactor`, `revert`, `test`, `vim-patch` - You can **ignore this for "fixup" commits** or any commits you expect to be squashed. - Append optional scope to _type_ such as `(lsp)`, `(treesitter)`, `(float)`, … - _Description_ shouldn't start with a capital letter or end in a period. diff --git a/ci/before_cache.sh b/ci/before_cache.sh deleted file mode 100755 index 94c18bd2cf..0000000000 --- a/ci/before_cache.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -mkdir -p "$CACHE_DIR" - -# Update the third-party dependency cache only if the build was successful. -if [ -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}" - mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}" - - touch "${CACHE_MARKER}" - echo "Updated third-party dependencies." -fi diff --git a/ci/before_script.sh b/ci/before_script.sh index 3e8adcfb15..9797d3ae30 100755 --- a/ci/before_script.sh +++ b/ci/before_script.sh @@ -14,15 +14,6 @@ if test "${FUNCTIONALTEST}" = "functionaltest-lua" ; then fi mkdir -p "${DEPS_BUILD_DIR}" - -# Use cached dependencies if $CACHE_MARKER exists. -if test -f "${CACHE_MARKER}"; then - echo "Using third-party dependencies from cache." - cp -a "${CACHE_NVIM_DEPS_DIR}"/. "${DEPS_BUILD_DIR}" -fi - -# Even if we're using cached dependencies, run CMake and make to -# update CMake configuration and update to newer deps versions. cd "${DEPS_BUILD_DIR}" echo "Configuring with '${DEPS_CMAKE_FLAGS}'." # shellcheck disable=SC2086 diff --git a/ci/common/test.sh b/ci/common/test.sh deleted file mode 100644 index 5ef7dc4024..0000000000 --- a/ci/common/test.sh +++ /dev/null @@ -1,173 +0,0 @@ -fail() { - local test_name="$1" - local message="$2" - - : "${message:=Test $test_name failed}" - - local full_msg="$test_name :: $message" - echo "Failed: $full_msg" - exit 1 -} - -print_core() { - local app="$1" - local core="$2" - if test "$app" = quiet ; then - echo "Found core $core" - return 0 - fi - echo "======= Core file $core =======" - if test "${CI_OS_NAME}" = osx ; then - lldb -Q -o "bt all" -f "${app}" -c "${core}" - else - gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}" - fi -} - -check_core_dumps() { - local del= - if test "$1" = "--delete" ; then - del=1 - shift - fi - local app="${1:-${BUILD_DIR}/bin/nvim}" - local cores - if test "${CI_OS_NAME}" = osx ; then - cores="$(find /cores/ -type f -print)" - local _sudo='sudo' - else - cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)" - local _sudo= - fi - - if test -z "${cores}" ; then - return - fi - local core - for core in $cores; do - if test "$del" = "1" ; then - print_core "$app" "$core" >&2 - "$_sudo" rm "$core" - else - print_core "$app" "$core" - fi - done - if test "$app" != quiet ; then - fail 'cores' 'Core dumps found' - fi -} - -check_logs() { - # Iterate through each log to remove an useless warning. - # shellcheck disable=SC2044 - for log in $(find "${1}" -type f -name "${2}"); do - sed -i "${log}" \ - -e '/Warning: noted but unhandled ioctl/d' \ - -e '/could cause spurious value errors to appear/d' \ - -e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d' - done - - # Now do it again, but only consider files with size > 0. - local err="" - # shellcheck disable=SC2044 - for log in $(find "${1}" -type f -name "${2}" -size +0); do - cat "${log}" - err=1 - rm "${log}" - done - if test -n "${err}" ; then - fail 'logs' 'Runtime errors detected.' - fi -} - -valgrind_check() { - check_logs "${1}" "valgrind-*" -} - -check_sanitizer() { - if test -n "${CLANG_SANITIZER}"; then - check_logs "${1}" "*san.*" | cat - fi -} - -unittests() {( - ulimit -c unlimited || true - if ! ninja -C "${BUILD_DIR}" unittest; then - fail 'unittests' 'Unit tests failed' - fi - check_core_dumps "$(command -v luajit)" -)} - -functionaltests() {( - ulimit -c unlimited || true - if ! ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}"; then - fail 'functionaltests' 'Functional tests failed' - fi - check_sanitizer "${LOG_DIR}" - valgrind_check "${LOG_DIR}" - check_core_dumps -)} - -oldtests() {( - ulimit -c unlimited || true - if ! make oldtest; then - reset - fail 'oldtests' 'Legacy tests failed' - fi - check_sanitizer "${LOG_DIR}" - valgrind_check "${LOG_DIR}" - check_core_dumps -)} - -check_runtime_files() {( - local test_name="$1" ; shift - local message="$1" ; shift - local tst="$1" ; shift - - cd runtime || exit - for file in $(git ls-files "$@") ; do - # Check that test is not trying to work with files with spaces/etc - # Prefer failing the build over using more robust construct because files - # with IFS are not welcome. - if ! test -e "$file" ; then - 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" "$(printf "%s%s" "$message" "$file")" - fi - done -)} - -install_nvim() {( - if ! ninja -C "${BUILD_DIR}" install; then - fail 'install' 'make install failed' - 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' 'Failed running :help' - fi - - # Check that all runtime files were installed - check_runtime_files \ - 'runtime-install' \ - 'It appears that %s is not installed.' \ - -e \ - '*.vim' '*.ps' '*.dict' '*.py' '*.tutor' - - # Check that some runtime files are installed and are executables - check_runtime_files \ - 'not-exe' \ - 'It appears that %s is not installed or is not executable.' \ - -x \ - '*.awk' '*.sh' '*.bat' - - # Check that generated syntax file has function names, #5060. - 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' "It appears that $genvimsynf does not contain $gpat." - fi -)} diff --git a/ci/run_tests.sh b/ci/run_tests.sh index f777026ac2..22ed4a4332 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -3,9 +3,179 @@ set -e set -o pipefail -CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/test.sh" +fail() { + local test_name="$1" + local message="$2" + + : "${message:=Test $test_name failed}" + + local full_msg="$test_name :: $message" + echo "Failed: $full_msg" + exit 1 +} + +print_core() { + local app="$1" + local core="$2" + if test "$app" = quiet ; then + echo "Found core $core" + return 0 + fi + echo "======= Core file $core =======" + if test "${CI_OS_NAME}" = osx ; then + lldb -Q -o "bt all" -f "${app}" -c "${core}" + else + gdb -n -batch -ex 'thread apply all bt full' "${app}" -c "${core}" + fi +} + +check_core_dumps() { + local del= + if test "$1" = "--delete" ; then + del=1 + shift + fi + local app="${1:-${BUILD_DIR}/bin/nvim}" + local cores + if test "${CI_OS_NAME}" = osx ; then + cores="$(find /cores/ -type f -print)" + local _sudo='sudo' + else + cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)" + local _sudo= + fi + + if test -z "${cores}" ; then + return + fi + local core + for core in $cores; do + if test "$del" = "1" ; then + print_core "$app" "$core" >&2 + "$_sudo" rm "$core" + else + print_core "$app" "$core" + fi + done + if test "$app" != quiet ; then + fail 'cores' 'Core dumps found' + fi +} + +check_logs() { + # Iterate through each log to remove an useless warning. + # shellcheck disable=SC2044 + for log in $(find "${1}" -type f -name "${2}"); do + sed -i "${log}" \ + -e '/Warning: noted but unhandled ioctl/d' \ + -e '/could cause spurious value errors to appear/d' \ + -e '/See README_MISSING_SYSCALL_OR_IOCTL for guidance/d' + done + + # Now do it again, but only consider files with size > 0. + local err="" + # shellcheck disable=SC2044 + for log in $(find "${1}" -type f -name "${2}" -size +0); do + cat "${log}" + err=1 + rm "${log}" + done + if test -n "${err}" ; then + fail 'logs' 'Runtime errors detected.' + fi +} + +valgrind_check() { + check_logs "${1}" "valgrind-*" +} + +check_sanitizer() { + if test -n "${CLANG_SANITIZER}"; then + check_logs "${1}" "*san.*" | cat + fi +} + +unittests() {( + ulimit -c unlimited || true + if ! ninja -C "${BUILD_DIR}" unittest; then + fail 'unittests' 'Unit tests failed' + fi + check_core_dumps "$(command -v luajit)" +)} + +functionaltests() {( + ulimit -c unlimited || true + if ! ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}"; then + fail 'functionaltests' 'Functional tests failed' + fi + check_sanitizer "${LOG_DIR}" + valgrind_check "${LOG_DIR}" + check_core_dumps +)} + +oldtests() {( + ulimit -c unlimited || true + if ! make oldtest; then + reset + fail 'oldtests' 'Legacy tests failed' + fi + check_sanitizer "${LOG_DIR}" + valgrind_check "${LOG_DIR}" + check_core_dumps +)} + +check_runtime_files() {( + local test_name="$1" ; shift + local message="$1" ; shift + local tst="$1" ; shift + + cd runtime || exit + for file in $(git ls-files "$@") ; do + # Check that test is not trying to work with files with spaces/etc + # Prefer failing the build over using more robust construct because files + # with IFS are not welcome. + if ! test -e "$file" ; then + 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" "$(printf "%s%s" "$message" "$file")" + fi + done +)} + +install_nvim() {( + if ! ninja -C "${BUILD_DIR}" install; then + fail 'install' 'make install failed' + 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' 'Failed running :help' + fi + + # Check that all runtime files were installed + check_runtime_files \ + 'runtime-install' \ + 'It appears that %s is not installed.' \ + -e \ + '*.vim' '*.ps' '*.dict' '*.py' '*.tutor' + + # Check that some runtime files are installed and are executables + check_runtime_files \ + 'not-exe' \ + 'It appears that %s is not installed or is not executable.' \ + -x \ + '*.awk' '*.sh' '*.bat' + + # Check that generated syntax file has function names, #5060. + 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' "It appears that $genvimsynf does not contain $gpat." + fi +)} build_nvim() { check_core_dumps --delete quiet diff --git a/scripts/lintcommit.lua b/scripts/lintcommit.lua index 87a8e62503..71796a5e02 100644 --- a/scripts/lintcommit.lua +++ b/scripts/lintcommit.lua @@ -78,10 +78,12 @@ local function validate_commit(commit_message) -- Check if type is correct local type = vim.split(before_colon, "%(")[1] - local allowed_types = {'build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'test', 'dist', 'vim-patch'} + local allowed_types = {'build', 'ci', 'docs', 'feat', 'fix', 'perf', 'refactor', 'revert', 'test', 'vim-patch'} if not vim.tbl_contains(allowed_types, type) then return string.format( - 'Invalid commit type "%s". Allowed types are:\n %s', + [[Invalid commit type "%s". Allowed types are: + %s. + If none of these seem appropriate then use "fix"]], type, vim.inspect(allowed_types)) end @@ -164,13 +166,16 @@ function M.main(opt) local invalid_msg = validate_commit(msg) if invalid_msg then failed = failed + 1 + + -- Some breathing room + if failed == 1 then + p('\n') + end + p(string.format([[ Invalid commit message: "%s" Commit: %s %s - See also: - https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages - https://www.conventionalcommits.org/en/v1.0.0/ ]], msg, commit_id, @@ -180,6 +185,10 @@ Invalid commit message: "%s" end if failed > 0 then + p([[ +See also: + https://github.com/neovim/neovim/blob/master/CONTRIBUTING.md#commit-messages +]]) die() -- Exit with error. else p('') @@ -198,7 +207,6 @@ function M._test() ['refactor: normal message'] = true, ['revert: normal message'] = true, ['test: normal message'] = true, - ['dist: normal message'] = true, ['ci(window): message with scope'] = true, ['ci!: message with breaking change'] = true, ['ci(tui)!: message with scope and breaking change'] = true, |