From aa04efcf574ac9b8b6868a6c6793b3ec937ce263 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 6 Feb 2023 23:14:41 +0100 Subject: ci: remove unhelpful helper functions for make (#22148) --- ci/common/build.sh | 21 +++------------------ ci/common/test.sh | 6 +++--- 2 files changed, 6 insertions(+), 21 deletions(-) (limited to 'ci') diff --git a/ci/common/build.sh b/ci/common/build.sh index 95972aab13..8b91af69b3 100644 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -6,15 +6,6 @@ _stat() { fi } -top_make() { - printf '%78s\n' ' ' | tr ' ' '=' - ninja "$@" -} - -build_make() { - top_make -C "${BUILD_DIR}" "$@" -} - build_deps() { if test "${FUNCTIONALTEST}" = "functionaltest-lua" ; then DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" @@ -35,9 +26,7 @@ build_deps() { # shellcheck disable=SC2086 CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/cmake.deps/" - if ! top_make; then - exit 1 - fi + ninja || exit 1 cd "${CI_BUILD_DIR}" } @@ -56,15 +45,11 @@ build_nvim() { cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}" echo "Building nvim." - if ! top_make nvim ; then - exit 1 - fi + ninja nvim || exit 1 if test "$CLANG_SANITIZER" != "TSAN" ; then echo "Building libnvim." - if ! top_make libnvim ; then - exit 1 - fi + ninja libnvim || exit 1 fi # Invoke nvim to trigger *San early. diff --git a/ci/common/test.sh b/ci/common/test.sh index 326ec162c3..03d85067be 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -90,7 +90,7 @@ check_sanitizer() { unittests() {( ulimit -c unlimited || true - if ! build_make unittest ; then + if ! ninja -C "${BUILD_DIR}" unittest; then fail 'unittests' 'Unit tests failed' fi submit_coverage unittest @@ -99,7 +99,7 @@ unittests() {( functionaltests() {( ulimit -c unlimited || true - if ! build_make "${FUNCTIONALTEST}"; then + if ! ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}"; then fail 'functionaltests' 'Functional tests failed' fi submit_coverage functionaltest @@ -140,7 +140,7 @@ check_runtime_files() {( )} install_nvim() {( - if ! build_make install ; then + if ! ninja -C "${BUILD_DIR}" install; then fail 'install' 'make install failed' exit 1 fi -- cgit From 3170e05d5743c5b46b14058f3c0702b4d7a43320 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Mon, 6 Feb 2023 23:42:03 +0100 Subject: build: don't build libnvim when running the CI (#22149) It shouldn't be sneakily run alongside the nvim build. If it's to be used it should be done in a separate step. --- ci/common/build.sh | 5 ----- 1 file changed, 5 deletions(-) (limited to 'ci') diff --git a/ci/common/build.sh b/ci/common/build.sh index 8b91af69b3..b1ea2270c0 100644 --- a/ci/common/build.sh +++ b/ci/common/build.sh @@ -47,11 +47,6 @@ build_nvim() { echo "Building nvim." ninja nvim || exit 1 - if test "$CLANG_SANITIZER" != "TSAN" ; then - echo "Building libnvim." - ninja libnvim || exit 1 - fi - # Invoke nvim to trigger *San early. if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then check_sanitizer "${LOG_DIR}" -- cgit From adae075fcffe0b5d1a790c41c083b78db27ba80b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:27:51 +0100 Subject: ci: remove unnecessary variables and functions (#22150) --- ci/before_cache.sh | 4 +--- ci/before_script.sh | 30 ++++++++++++++++++--------- ci/common/build.sh | 58 ----------------------------------------------------- ci/common/suite.sh | 5 ----- ci/common/test.sh | 3 +-- ci/run_tests.sh | 31 +++++++++++++++++++++++++--- 6 files changed, 51 insertions(+), 80 deletions(-) delete mode 100644 ci/common/build.sh (limited to 'ci') diff --git a/ci/before_cache.sh b/ci/before_cache.sh index 3daeb04793..d7405bab19 100755 --- a/ci/before_cache.sh +++ b/ci/before_cache.sh @@ -5,8 +5,6 @@ set -o pipefail CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/build.sh" -# shellcheck source-path=SCRIPTDIR source "${CI_DIR}/common/suite.sh" mkdir -p "${HOME}/.cache" @@ -22,5 +20,5 @@ if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then mv "${DEPS_BUILD_DIR}" "${CACHE_NVIM_DEPS_DIR}" touch "${CACHE_MARKER}" - echo "Updated third-party dependencies (timestamp: $(_stat "${CACHE_MARKER}"))." + echo "Updated third-party dependencies." fi diff --git a/ci/before_script.sh b/ci/before_script.sh index 066789af36..4a95e5a60f 100755 --- a/ci/before_script.sh +++ b/ci/before_script.sh @@ -3,22 +3,34 @@ set -e set -o pipefail -CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/build.sh" - # Test some of the configuration variables. if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then echo "\$GCOV: '${GCOV}' is not executable." exit 1 fi -if [[ -n "${LLVM_SYMBOLIZER}" ]] && [[ ! $(type -P "${LLVM_SYMBOLIZER}") ]]; then - echo "\$LLVM_SYMBOLIZER: '${LLVM_SYMBOLIZER}' is not executable." - exit 1 + +if test "${FUNCTIONALTEST}" = "functionaltest-lua" ; then + DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" +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 -# Compile dependencies. -build_deps +# 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 +cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/cmake.deps/" + +ninja || exit 1 + +cd "${CI_BUILD_DIR}" # Install cluacov for Lua coverage. if [[ "$USE_LUACOV" == 1 ]]; then diff --git a/ci/common/build.sh b/ci/common/build.sh deleted file mode 100644 index b1ea2270c0..0000000000 --- a/ci/common/build.sh +++ /dev/null @@ -1,58 +0,0 @@ -_stat() { - if test "${CI_OS_NAME}" = osx ; then - stat -f %Sm "${@}" - else - stat -c %y "${@}" - fi -} - -build_deps() { - if test "${FUNCTIONALTEST}" = "functionaltest-lua" ; then - DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" - 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 (last update: $(_stat "${CACHE_MARKER}"))." - 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 - CC= cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/cmake.deps/" - - ninja || exit 1 - - cd "${CI_BUILD_DIR}" -} - -build_nvim() { - check_core_dumps --delete quiet - - if test -n "${CLANG_SANITIZER}" ; then - CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" - fi - - mkdir -p "${BUILD_DIR}" - cd "${BUILD_DIR}" - echo "Configuring with '${CMAKE_FLAGS} $*'." - # shellcheck disable=SC2086 - cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}" - - echo "Building nvim." - ninja nvim || exit 1 - - # Invoke nvim to trigger *San early. - if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then - check_sanitizer "${LOG_DIR}" - exit 1 - fi - check_sanitizer "${LOG_DIR}" - - cd "${CI_BUILD_DIR}" -} diff --git a/ci/common/suite.sh b/ci/common/suite.sh index c81261d2e7..9c3056baaf 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -34,8 +34,3 @@ ended_successfully() { fi return 0 } - -end_tests() { - touch "${END_MARKER}" - ended_successfully -} diff --git a/ci/common/test.sh b/ci/common/test.sh index 03d85067be..c3b8d45b9f 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -1,4 +1,3 @@ -. "${CI_DIR}/common/build.sh" . "${CI_DIR}/common/suite.sh" submit_coverage() { @@ -84,7 +83,7 @@ valgrind_check() { check_sanitizer() { if test -n "${CLANG_SANITIZER}"; then - check_logs "${1}" "*san.*" | ${SYMBOLIZER:-cat} + check_logs "${1}" "*san.*" | cat fi } diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 0ef7080628..c692d859d7 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -5,12 +5,36 @@ set -o pipefail CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/build.sh" -# shellcheck source-path=SCRIPTDIR source "${CI_DIR}/common/test.sh" # shellcheck source-path=SCRIPTDIR source "${CI_DIR}/common/suite.sh" +build_nvim() { + check_core_dumps --delete quiet + + if test -n "${CLANG_SANITIZER}" ; then + CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" + fi + + mkdir -p "${BUILD_DIR}" + cd "${BUILD_DIR}" + echo "Configuring with '${CMAKE_FLAGS} $*'." + # shellcheck disable=SC2086 + cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}" + + echo "Building nvim." + ninja nvim || exit 1 + + # Invoke nvim to trigger *San early. + if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then + check_sanitizer "${LOG_DIR}" + exit 1 + fi + check_sanitizer "${LOG_DIR}" + + cd "${CI_BUILD_DIR}" +} + rm -f "$END_MARKER" # Run all tests (with some caveats) if no input argument is given @@ -34,7 +58,8 @@ for i in "${tests[@]}"; do eval "$i" || fail "$i" done -end_tests +touch "${END_MARKER}" +ended_successfully if [[ -s "${GCOV_ERROR_FILE}" ]]; then echo '=== Unexpected gcov errors: ===' -- cgit From c1d76363ac72a7a17b657eaa99df4533d169a40b Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 7 Feb 2023 14:43:45 +0100 Subject: ci: simplify how environment variables are used (#22067) Having a clear separation between when we manipulate variables and when we export them to GITHUB_ENV makes it less error-prone. --- ci/before_cache.sh | 5 +---- ci/before_script.sh | 2 +- ci/install.sh | 2 +- ci/run_tests.sh | 2 +- 4 files changed, 4 insertions(+), 7 deletions(-) (limited to 'ci') diff --git a/ci/before_cache.sh b/ci/before_cache.sh index d7405bab19..7bf66221ae 100755 --- a/ci/before_cache.sh +++ b/ci/before_cache.sh @@ -7,10 +7,7 @@ CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source-path=SCRIPTDIR 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 +mkdir -p "$CACHE_DIR" # Update the third-party dependency cache only if the build was successful. if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then diff --git a/ci/before_script.sh b/ci/before_script.sh index 4a95e5a60f..3e8adcfb15 100755 --- a/ci/before_script.sh +++ b/ci/before_script.sh @@ -10,7 +10,7 @@ if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then fi if test "${FUNCTIONALTEST}" = "functionaltest-lua" ; then - DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -DUSE_BUNDLED_LUA=ON" + DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -D USE_BUNDLED_LUA=ON" fi mkdir -p "${DEPS_BUILD_DIR}" diff --git a/ci/install.sh b/ci/install.sh index 5925cc7b02..d65c86032b 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -8,7 +8,7 @@ echo "Install neovim module for Python." CC=cc python3 -m pip -q install --user --upgrade pynvim echo "Install neovim RubyGem." -gem install --no-document --bindir "$HOME/.local/bin" --user-install --pre neovim +gem install --no-document --bindir "$BIN_DIR" --user-install --pre neovim echo "Install neovim npm package" npm install -g neovim diff --git a/ci/run_tests.sh b/ci/run_tests.sh index c692d859d7..0d39627dac 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -13,7 +13,7 @@ build_nvim() { check_core_dumps --delete quiet if test -n "${CLANG_SANITIZER}" ; then - CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON" + CMAKE_FLAGS="${CMAKE_FLAGS} -D CLANG_${CLANG_SANITIZER}=ON" fi mkdir -p "${BUILD_DIR}" -- cgit From 0fc9a232e09d1b246b2d6bb5b862e63aa623e825 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 8 Feb 2023 16:21:50 +0100 Subject: ci: remove unnecessary END_MARKER variable (#22171) --- ci/common/suite.sh | 12 +++--------- ci/run_tests.sh | 3 --- 2 files changed, 3 insertions(+), 12 deletions(-) (limited to 'ci') diff --git a/ci/common/suite.sh b/ci/common/suite.sh index 9c3056baaf..d13546823b 100644 --- a/ci/common/suite.sh +++ b/ci/common/suite.sh @@ -1,8 +1,6 @@ -# 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 -# successful if tests ended without any of them failing. -END_MARKER="$BUILD_DIR/.tests_finished" +# If FAIL_SUMMARY_FILE exists we know that some tests failed, this file will +# contain information about failed tests. Build is considered successful if +# tests ended without any of them failing. FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors" fail() { @@ -28,9 +26,5 @@ ended_successfully() { return 1 fi - if ! test -f "${END_MARKER}" ; then - echo 'ended_successfully called before end marker was touched' - return 1 - fi return 0 } diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 0d39627dac..f04165d37a 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -35,8 +35,6 @@ build_nvim() { cd "${CI_BUILD_DIR}" } -rm -f "$END_MARKER" - # Run all tests (with some caveats) if no input argument is given if (($# == 0)); then tests=('build_nvim') @@ -58,7 +56,6 @@ for i in "${tests[@]}"; do eval "$i" || fail "$i" done -touch "${END_MARKER}" ended_successfully if [[ -s "${GCOV_ERROR_FILE}" ]]; then -- cgit From 2294210660056df2f8abb277776cfd68f3fb1156 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 8 Feb 2023 18:32:17 +0100 Subject: ci: remove fail summary (#22174) The tests already have a summary at the end, there's no need for an additional fail summary wrapper. --- ci/before_cache.sh | 6 +----- ci/common/suite.sh | 30 ------------------------------ ci/common/test.sh | 14 +++++++++++--- ci/run_tests.sh | 6 +----- 4 files changed, 13 insertions(+), 43 deletions(-) delete mode 100644 ci/common/suite.sh (limited to 'ci') diff --git a/ci/before_cache.sh b/ci/before_cache.sh index 7bf66221ae..94c18bd2cf 100755 --- a/ci/before_cache.sh +++ b/ci/before_cache.sh @@ -3,14 +3,10 @@ set -e set -o pipefail -CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -# shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/suite.sh" - mkdir -p "$CACHE_DIR" # Update the third-party dependency cache only if the build was successful. -if ended_successfully && [ -d "${DEPS_BUILD_DIR}" ]; then +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}" diff --git a/ci/common/suite.sh b/ci/common/suite.sh deleted file mode 100644 index d13546823b..0000000000 --- a/ci/common/suite.sh +++ /dev/null @@ -1,30 +0,0 @@ -# If FAIL_SUMMARY_FILE exists we know that some tests failed, this file will -# contain information about failed tests. Build is considered successful if -# tests ended without any of them failing. -FAIL_SUMMARY_FILE="$BUILD_DIR/.test_errors" - -fail() { - local test_name="$1" - local message="$2" - - : "${message:=Test $test_name failed}" - - local full_msg="$test_name :: $message" - echo "${full_msg}" >> "${FAIL_SUMMARY_FILE}" - echo "Failed: $full_msg" - export FAILED=1 -} - -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 - return 0 -} diff --git a/ci/common/test.sh b/ci/common/test.sh index c3b8d45b9f..f6e20d8f59 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -1,4 +1,13 @@ -. "${CI_DIR}/common/suite.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 +} submit_coverage() { if [ -n "${GCOV}" ]; then @@ -124,7 +133,7 @@ check_runtime_files() {( local message="$1" ; shift local tst="$1" ; shift - cd runtime + 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 @@ -141,7 +150,6 @@ check_runtime_files() {( install_nvim() {( if ! ninja -C "${BUILD_DIR}" install; then fail 'install' 'make install failed' - exit 1 fi "${INSTALL_PREFIX}/bin/nvim" --version diff --git a/ci/run_tests.sh b/ci/run_tests.sh index f04165d37a..f777026ac2 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -6,8 +6,6 @@ set -o pipefail CI_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # shellcheck source-path=SCRIPTDIR source "${CI_DIR}/common/test.sh" -# shellcheck source-path=SCRIPTDIR -source "${CI_DIR}/common/suite.sh" build_nvim() { check_core_dumps --delete quiet @@ -53,11 +51,9 @@ else fi for i in "${tests[@]}"; do - eval "$i" || fail "$i" + eval "$i" || exit done -ended_successfully - if [[ -s "${GCOV_ERROR_FILE}" ]]; then echo '=== Unexpected gcov errors: ===' cat "${GCOV_ERROR_FILE}" -- cgit From ad00b034261dac70f728012339bd05fc89f8e90e Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 9 Feb 2023 11:04:02 +0100 Subject: build: remove codecov related files (#20859) These aren't needed as we don't use codecov anymore. --- ci/common/submit_coverage.sh | 56 -------------------------------------------- ci/common/test.sh | 9 ------- 2 files changed, 65 deletions(-) delete mode 100755 ci/common/submit_coverage.sh (limited to 'ci') diff --git a/ci/common/submit_coverage.sh b/ci/common/submit_coverage.sh deleted file mode 100755 index f781ca8e5e..0000000000 --- a/ci/common/submit_coverage.sh +++ /dev/null @@ -1,56 +0,0 @@ -#!/bin/sh -# Collect and submit coverage reports. -# -# Args: -# $1: Flag(s) for codecov, separated by comma. - -set -e - -# Change to grandparent dir (POSIXly). -CDPATH='' cd -P -- "$(dirname -- "$0")/../.." || exit - -echo "=== running submit_coverage in $PWD: $* ===" -"$GCOV" --version - -# Download/install codecov-bash and gcovr once. -codecov_sh="${TEMP:-/tmp}/codecov.bash" -if ! [ -f "$codecov_sh" ]; then - curl --retry 5 --silent --fail -o "$codecov_sh" https://codecov.io/bash - chmod +x "$codecov_sh" - - python -m pip install --quiet --user gcovr -fi - -( - cd build - python -m gcovr --branches --exclude-unreachable-branches --print-summary -j 2 --exclude '.*/auto/.*' --root .. --delete -o ../coverage.xml --xml -) - -# Upload to codecov. -# -X gcov: disable gcov, done manually above. -# -X fix: disable fixing of reports (not necessary, rather slow) -# -Z: exit non-zero on failure -# -F: flag(s) -# NOTE: ignoring flags for now, since this causes timeouts on codecov.io then, -# which they know about for about a year already... -# Flags must match pattern ^[\w\,]+$ ("," as separator). -codecov_flags="$(uname -s),${1}" -codecov_flags=$(echo "$codecov_flags" | sed 's/[^,_a-zA-Z0-9]/_/g') -if ! "$codecov_sh" -f coverage.xml -X gcov -X fix -Z -F "${codecov_flags}"; then - echo "codecov upload failed." -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/common/test.sh b/ci/common/test.sh index f6e20d8f59..5ef7dc4024 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -9,12 +9,6 @@ fail() { exit 1 } -submit_coverage() { - if [ -n "${GCOV}" ]; then - "${CI_DIR}/common/submit_coverage.sh" "$@" || echo 'codecov upload failed.' - fi -} - print_core() { local app="$1" local core="$2" @@ -101,7 +95,6 @@ unittests() {( if ! ninja -C "${BUILD_DIR}" unittest; then fail 'unittests' 'Unit tests failed' fi - submit_coverage unittest check_core_dumps "$(command -v luajit)" )} @@ -110,7 +103,6 @@ functionaltests() {( if ! ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}"; then fail 'functionaltests' 'Functional tests failed' fi - submit_coverage functionaltest check_sanitizer "${LOG_DIR}" valgrind_check "${LOG_DIR}" check_core_dumps @@ -122,7 +114,6 @@ oldtests() {( reset fail 'oldtests' 'Legacy tests failed' fi - submit_coverage oldtest check_sanitizer "${LOG_DIR}" valgrind_check "${LOG_DIR}" check_core_dumps -- cgit From ec932961cc5596009f3179edd620bc778a1503d7 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Thu, 9 Feb 2023 21:13:03 +0100 Subject: ci: inline internal caching script to Github actions (#22192) I don't think it's possible to meaningfully abstract away caching on multiple providers, as each provider has different mechanisms on how they work. --- ci/before_cache.sh | 17 ----------------- ci/before_script.sh | 9 --------- 2 files changed, 26 deletions(-) delete mode 100755 ci/before_cache.sh (limited to 'ci') 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 -- cgit From fe1e6b82f4f3ff3d919d1243f37e9216781bb786 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Fri, 10 Feb 2023 00:42:37 +0100 Subject: ci: inline test.sh to run_tests.sh (#22198) This will get rid of the common/ directory. --- ci/common/test.sh | 173 ----------------------------------------------------- ci/run_tests.sh | 176 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 173 insertions(+), 176 deletions(-) delete mode 100644 ci/common/test.sh (limited to 'ci') 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 -- cgit From 883ec20d9f91bde9c348bfcc0e1fcc3e3533cd89 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 13:27:43 +0100 Subject: ci: inline build commands and remove before_script.sh (#22202) Abstracting the build commands to a separate script makes it more difficult to reason about it and more error-prone. --- ci/before_script.sh | 32 ------------- ci/run_tests.sh | 127 +++++++++++++++------------------------------------- 2 files changed, 36 insertions(+), 123 deletions(-) delete mode 100755 ci/before_script.sh (limited to 'ci') diff --git a/ci/before_script.sh b/ci/before_script.sh deleted file mode 100755 index 9797d3ae30..0000000000 --- a/ci/before_script.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -# Test some of the configuration variables. -if [[ -n "${GCOV}" ]] && [[ ! $(type -P "${GCOV}") ]]; then - echo "\$GCOV: '${GCOV}' is not executable." - exit 1 -fi - -if test "${FUNCTIONALTEST}" = "functionaltest-lua" ; then - DEPS_CMAKE_FLAGS="${DEPS_CMAKE_FLAGS} -D USE_BUNDLED_LUA=ON" -fi - -mkdir -p "${DEPS_BUILD_DIR}" -cd "${DEPS_BUILD_DIR}" -echo "Configuring with '${DEPS_CMAKE_FLAGS}'." -# shellcheck disable=SC2086 -cmake -G Ninja ${DEPS_CMAKE_FLAGS} "${CI_BUILD_DIR}/cmake.deps/" - -ninja || exit 1 - -cd "${CI_BUILD_DIR}" - -# 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/run_tests.sh b/ci/run_tests.sh index 22ed4a4332..ddd364ae86 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -3,26 +3,15 @@ set -e set -o pipefail -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 + if test "$app" = quiet; then echo "Found core $core" return 0 fi echo "======= Core file $core =======" - if test "${CI_OS_NAME}" = osx ; then + 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}" @@ -31,13 +20,13 @@ print_core() { check_core_dumps() { local del= - if test "$1" = "--delete" ; then + 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 + if test "${CI_OS_NAME}" = osx; then cores="$(find /cores/ -type f -print)" local _sudo='sudo' else @@ -45,20 +34,21 @@ check_core_dumps() { local _sudo= fi - if test -z "${cores}" ; then + if test -z "${cores}"; then return fi local core for core in $cores; do - if test "$del" = "1" ; then + 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' + if test "$app" != quiet; then + echo 'Core dumps found' + exit 1 fi } @@ -80,8 +70,9 @@ check_logs() { err=1 rm "${log}" done - if test -n "${err}" ; then - fail 'logs' 'Runtime errors detected.' + if test -n "${err}"; then + echo 'Runtime errors detected.' + exit 1 fi } @@ -97,17 +88,13 @@ check_sanitizer() { unittests() {( ulimit -c unlimited || true - if ! ninja -C "${BUILD_DIR}" unittest; then - fail 'unittests' 'Unit tests failed' - fi + ninja -C "${BUILD_DIR}" unittest || exit check_core_dumps "$(command -v luajit)" )} functionaltests() {( ulimit -c unlimited || true - if ! ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}"; then - fail 'functionaltests' 'Functional tests failed' - fi + ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}" || exit check_sanitizer "${LOG_DIR}" valgrind_check "${LOG_DIR}" check_core_dumps @@ -117,7 +104,7 @@ oldtests() {( ulimit -c unlimited || true if ! make oldtest; then reset - fail 'oldtests' 'Legacy tests failed' + exit 1 fi check_sanitizer "${LOG_DIR}" valgrind_check "${LOG_DIR}" @@ -125,46 +112,41 @@ oldtests() {( )} check_runtime_files() {( - local test_name="$1" ; shift - local message="$1" ; shift - local tst="$1" ; shift + local message="$1"; shift + local tst="$1"; shift - cd runtime || exit - for file in $(git ls-files "$@") ; do + for file in $(git -C runtime 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" + if ! test -e "$file"; then + echo "It appears that $file is only a part of the file name" + exit 1 fi - if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file" ; then - fail "$test_name" "$(printf "%s%s" "$message" "$file")" + if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file"; then + printf "%s%s" "$message" "$file" + exit 1 fi done )} -install_nvim() {( - if ! ninja -C "${BUILD_DIR}" install; then - fail 'install' 'make install failed' - fi - +installtests() {( "${INSTALL_PREFIX}/bin/nvim" --version - if ! "${INSTALL_PREFIX}/bin/nvim" -u NONE -e -c ':help' -c ':qall' ; then + 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' + echo 'Failed running :help' + exit 1 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' @@ -172,60 +154,23 @@ install_nvim() {( # 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." + if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf"; then + echo "It appears that $genvimsynf does not contain $gpat." + exit 1 fi )} -build_nvim() { +prepare_sanitizer() { check_core_dumps --delete quiet - - if test -n "${CLANG_SANITIZER}" ; then - CMAKE_FLAGS="${CMAKE_FLAGS} -D CLANG_${CLANG_SANITIZER}=ON" - fi - - mkdir -p "${BUILD_DIR}" - cd "${BUILD_DIR}" - echo "Configuring with '${CMAKE_FLAGS} $*'." - # shellcheck disable=SC2086 - cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}" - - echo "Building nvim." - ninja nvim || exit 1 - # Invoke nvim to trigger *San early. - if ! (bin/nvim --version && bin/nvim -u NONE -e -cq | cat -vet) ; then + if ! ("${BUILD_DIR}"/bin/nvim --version && "${BUILD_DIR}"/bin/nvim -u NONE -e -cq | cat -vet); then check_sanitizer "${LOG_DIR}" exit 1 fi check_sanitizer "${LOG_DIR}" - - cd "${CI_BUILD_DIR}" } -# Run all tests (with some caveats) if no input argument is given -if (($# == 0)); then - tests=('build_nvim') - - # Additional threads aren't created in the unit/old tests - if test "$CLANG_SANITIZER" != "TSAN"; then - if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then - tests+=('unittests') - fi - tests+=('oldtests') - fi - - tests+=('functionaltests' 'install_nvim') -else - tests=("$@") -fi - -for i in "${tests[@]}"; do - eval "$i" || exit -done +rm -rf "${LOG_DIR}" +mkdir -p "${LOG_DIR}" -if [[ -s "${GCOV_ERROR_FILE}" ]]; then - echo '=== Unexpected gcov errors: ===' - cat "${GCOV_ERROR_FILE}" - exit 1 -fi +eval "$*" || exit -- cgit From 24ec0aaa7a1589fd4b67dc44f201842900d81c89 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 14:51:41 +0100 Subject: ci: don't delete core dumps at the start of the run (#22223) There shouldn't be any core dumps before we have started testing. --- ci/run_tests.sh | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'ci') diff --git a/ci/run_tests.sh b/ci/run_tests.sh index ddd364ae86..6899054e15 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -6,10 +6,6 @@ set -o pipefail 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}" @@ -19,11 +15,6 @@ print_core() { } 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 @@ -39,17 +30,10 @@ check_core_dumps() { 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 + print_core "$app" "$core" done - if test "$app" != quiet; then - echo 'Core dumps found' - exit 1 - fi + echo 'Core dumps found' + exit 1 } check_logs() { @@ -161,7 +145,6 @@ installtests() {( )} prepare_sanitizer() { - check_core_dumps --delete quiet # Invoke nvim to trigger *San early. if ! ("${BUILD_DIR}"/bin/nvim --version && "${BUILD_DIR}"/bin/nvim -u NONE -e -cq | cat -vet); then check_sanitizer "${LOG_DIR}" -- cgit From 3a5dddf24f9d4d8959194b0cd3c6a7dd0cbd73ae Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sat, 11 Feb 2023 18:16:04 +0100 Subject: ci: show all logs at the end of a run (#22226) * ci: show all logs at the end of a run The current CI won't show the logs on error due to early exit. This will at least show the logs, although for all tests at once. --- ci/run_tests.sh | 52 ---------------------------------------------------- 1 file changed, 52 deletions(-) (limited to 'ci') diff --git a/ci/run_tests.sh b/ci/run_tests.sh index 6899054e15..8bdc164295 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -19,10 +19,8 @@ check_core_dumps() { 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 @@ -36,40 +34,6 @@ check_core_dumps() { exit 1 } -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 - echo 'Runtime errors detected.' - exit 1 - 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 ninja -C "${BUILD_DIR}" unittest || exit @@ -79,8 +43,6 @@ unittests() {( functionaltests() {( ulimit -c unlimited || true ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}" || exit - check_sanitizer "${LOG_DIR}" - valgrind_check "${LOG_DIR}" check_core_dumps )} @@ -90,8 +52,6 @@ oldtests() {( reset exit 1 fi - check_sanitizer "${LOG_DIR}" - valgrind_check "${LOG_DIR}" check_core_dumps )} @@ -144,16 +104,4 @@ installtests() {( fi )} -prepare_sanitizer() { - # Invoke nvim to trigger *San early. - if ! ("${BUILD_DIR}"/bin/nvim --version && "${BUILD_DIR}"/bin/nvim -u NONE -e -cq | cat -vet); then - check_sanitizer "${LOG_DIR}" - exit 1 - fi - check_sanitizer "${LOG_DIR}" -} - -rm -rf "${LOG_DIR}" -mkdir -p "${LOG_DIR}" - eval "$*" || exit -- cgit From e81b4274fc18de4be753c07db642111129ff84ee Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 12 Feb 2023 11:50:08 +0100 Subject: ci: delete ci/ (#22227) Having CI scripts that is separate from the build system causes tremendous amounts of problems, headaches and bugs. Testing the validity of the scripts locally become near impossible as time goes on as they're only vetted if it works on whatever CI provider we happened to have at the time, with their own quirks and behavior. The extra indirection between "cmake <-> general CI scripts <-> GHA" is also a frequent source of problems, as the orchestration needs to be done with environment variables, cmake flags and github actions matrix strategy. This combination has turned out to be exceptionally fragile. Examples: https://github.com/neovim/neovim/commit/15394b6855c3b17be06bf2bfbac7797d9c3ebf1d https://github.com/neovim/neovim/commit/13aa23b62af4df3e7f10687b76fe8c04efa2a598 https://github.com/neovim/neovim/pull/22072#discussion_r1094390713 A lot of the code was inlined to .github/workflows/ci.yml without further modifications. While this in itself doesn't integrate with our build system any more than the current situation, it does 1. remove a level of indirection, and more importantly 2. allow us to slowly start integrating the CI into our build system now that all the relevant code is in one place. --- ci/install.sh | 20 ----------- ci/run_tests.sh | 107 -------------------------------------------------------- 2 files changed, 127 deletions(-) delete mode 100755 ci/install.sh delete mode 100755 ci/run_tests.sh (limited to 'ci') diff --git a/ci/install.sh b/ci/install.sh deleted file mode 100755 index d65c86032b..0000000000 --- a/ci/install.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -# Use default CC to avoid compilation problems when installing Python modules. -echo "Install neovim module for Python." -CC=cc python3 -m pip -q install --user --upgrade pynvim - -echo "Install neovim RubyGem." -gem install --no-document --bindir "$BIN_DIR" --user-install --pre neovim - -echo "Install neovim npm package" -npm install -g neovim -npm link neovim - -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_tests.sh b/ci/run_tests.sh deleted file mode 100755 index 8bdc164295..0000000000 --- a/ci/run_tests.sh +++ /dev/null @@ -1,107 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -o pipefail - -print_core() { - local app="$1" - local core="$2" - 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 app="${1:-${BUILD_DIR}/bin/nvim}" - local cores - if test "${CI_OS_NAME}" = osx; then - cores="$(find /cores/ -type f -print)" - else - cores="$(find ./ -type f \( -name 'core.*' -o -name core -o -name nvim.core \) -print)" - fi - - if test -z "${cores}"; then - return - fi - local core - for core in $cores; do - print_core "$app" "$core" - done - echo 'Core dumps found' - exit 1 -} - -unittests() {( - ulimit -c unlimited || true - ninja -C "${BUILD_DIR}" unittest || exit - check_core_dumps "$(command -v luajit)" -)} - -functionaltests() {( - ulimit -c unlimited || true - ninja -C "${BUILD_DIR}" "${FUNCTIONALTEST}" || exit - check_core_dumps -)} - -oldtests() {( - ulimit -c unlimited || true - if ! make oldtest; then - reset - exit 1 - fi - check_core_dumps -)} - -check_runtime_files() {( - local message="$1"; shift - local tst="$1"; shift - - for file in $(git -C runtime 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 - echo "It appears that $file is only a part of the file name" - exit 1 - fi - if ! test "$tst" "$INSTALL_PREFIX/share/nvim/runtime/$file"; then - printf "%s%s" "$message" "$file" - exit 1 - fi - done -)} - -installtests() {( - "${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." - echo 'Failed running :help' - exit 1 - fi - - # Check that all runtime files were installed - check_runtime_files \ - '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 \ - '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 - echo "It appears that $genvimsynf does not contain $gpat." - exit 1 - fi -)} - -eval "$*" || exit -- cgit From 7d0479c55810af9bf9f115ba69d1419ea81ec41e Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Wed, 26 Apr 2023 23:22:12 +0200 Subject: ci: containerize the external dependencies test Cirrus ci automatically pushes/caches docker images, which makes containerization much simpler to handle. Moving this job to cirrus ci shortens the job by a minute, and reduces github actions CI usage by two minutes per PR. --- ci/Dockerfile.external_deps | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 ci/Dockerfile.external_deps (limited to 'ci') diff --git a/ci/Dockerfile.external_deps b/ci/Dockerfile.external_deps new file mode 100644 index 0000000000..0d2a55dd19 --- /dev/null +++ b/ci/Dockerfile.external_deps @@ -0,0 +1,22 @@ +FROM ubuntu:22.04 + +RUN apt-get update && \ + apt-get install -y software-properties-common && \ + add-apt-repository ppa:neovim-ppa/stable && \ + apt-get install -y ninja-build \ + gettext \ + cmake \ + unzip \ + curl \ + git \ + libluajit-5.1-dev \ + libmsgpack-dev \ + libtermkey-dev \ + libunibilium-dev \ + libuv1-dev \ + lua-filesystem \ + lua-lpeg \ + luajit \ + lua-luv-dev \ + libtree-sitter-dev \ + libvterm-dev -- cgit From 3bf2839dec09a7a8ad38b164eb06e193c107181a Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Sun, 3 Sep 2023 12:06:32 +0200 Subject: ci: move external_deps job from cirrus-ci back to github actions This partially reverts commit 7d0479c55810af9bf9f115ba69d1419ea81ec41e. The job has been particularly unstable when used with docker on cirrus-ci, which is especially bad as it's meant to be a non-flaky and simple test. --- ci/Dockerfile.external_deps | 22 ---------------------- 1 file changed, 22 deletions(-) delete mode 100644 ci/Dockerfile.external_deps (limited to 'ci') diff --git a/ci/Dockerfile.external_deps b/ci/Dockerfile.external_deps deleted file mode 100644 index 0d2a55dd19..0000000000 --- a/ci/Dockerfile.external_deps +++ /dev/null @@ -1,22 +0,0 @@ -FROM ubuntu:22.04 - -RUN apt-get update && \ - apt-get install -y software-properties-common && \ - add-apt-repository ppa:neovim-ppa/stable && \ - apt-get install -y ninja-build \ - gettext \ - cmake \ - unzip \ - curl \ - git \ - libluajit-5.1-dev \ - libmsgpack-dev \ - libtermkey-dev \ - libunibilium-dev \ - libuv1-dev \ - lua-filesystem \ - lua-lpeg \ - luajit \ - lua-luv-dev \ - libtree-sitter-dev \ - libvterm-dev -- cgit