diff options
author | Dundar Göc <gocdundar@gmail.com> | 2022-03-05 18:07:46 +0100 |
---|---|---|
committer | Dundar Göc <gocdundar@gmail.com> | 2022-03-10 09:21:41 +0100 |
commit | 815ba835a3486e103b0718e722c5cb5bf633a864 (patch) | |
tree | a71ab4a09579a79176997813390ec522726a827f | |
parent | d47714d87c0ea082568fb9f59a579381253bf179 (diff) | |
download | rneovim-815ba835a3486e103b0718e722c5cb5bf633a864.tar.gz rneovim-815ba835a3486e103b0718e722c5cb5bf633a864.tar.bz2 rneovim-815ba835a3486e103b0718e722c5cb5bf633a864.zip |
ci: refactor and simplify CI process
-rw-r--r-- | .github/workflows/ci.yml | 12 | ||||
-rw-r--r-- | ci/common/test.sh | 6 | ||||
-rwxr-xr-x | ci/run_lint.sh | 39 | ||||
-rwxr-xr-x | ci/run_tests.sh | 41 |
4 files changed, 32 insertions, 66 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41a22af538..ea3185d2a1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,11 +80,11 @@ jobs: run: ./ci/before_script.sh - name: Build nvim - run: ./ci/run_tests.sh build + run: ./ci/run_tests.sh build_nvim - if: "!cancelled()" - name: clint - run: ./ci/run_lint.sh clint + name: clint-full + run: ./ci/run_lint.sh clint-full - if: "!cancelled()" name: lualint @@ -99,8 +99,8 @@ jobs: run: ./ci/run_lint.sh shlint - if: "!cancelled()" - name: single-includes - run: ./ci/run_lint.sh single-includes + name: check-single-includes + run: ./ci/run_lint.sh check-single-includes - name: Cache dependencies run: ./ci/before_cache.sh @@ -201,7 +201,7 @@ jobs: run: ./ci/before_script.sh - name: Build - run: ./ci/run_tests.sh build + run: ./ci/run_tests.sh build_nvim - if: matrix.flavor != 'tsan' && matrix.flavor != 'functionaltest-lua' && !cancelled() name: Unittests diff --git a/ci/common/test.sh b/ci/common/test.sh index 3df24cf3b0..7db39a0e5f 100644 --- a/ci/common/test.sh +++ b/ci/common/test.sh @@ -86,7 +86,7 @@ check_sanitizer() { fi } -run_unittests() {( +unittests() {( ulimit -c unlimited || true if ! build_make unittest ; then fail 'unittests' 'Unit tests failed' @@ -95,7 +95,7 @@ run_unittests() {( check_core_dumps "$(command -v luajit)" )} -run_functionaltests() {( +functionaltests() {( ulimit -c unlimited || true if ! build_make ${FUNCTIONALTEST}; then fail 'functionaltests' 'Functional tests failed' @@ -106,7 +106,7 @@ run_functionaltests() {( check_core_dumps )} -run_oldtests() {( +oldtests() {( ulimit -c unlimited || true if ! make oldtest; then reset diff --git a/ci/run_lint.sh b/ci/run_lint.sh index d9869c2756..3a524b4ed6 100755 --- a/ci/run_lint.sh +++ b/ci/run_lint.sh @@ -10,34 +10,15 @@ source "${CI_DIR}/common/suite.sh" rm -f "$END_MARKER" -if [[ "$GITHUB_ACTIONS" != "true" ]]; then - make clint-full || fail 'clint' - make lualint || fail 'lualint' - make pylint || fail 'pylint' - make shlint || fail 'shlint' - make check-single-includes || fail 'single-includes' - - end_tests +# Run all tests if no input argument is given +if (($# == 0)); then + tests=('clint-full' 'lualint' 'pylint' 'shlint' 'check-single-includes') else - case "$1" in - clint) - make clint-full || fail 'clint' - ;; - lualint) - make lualint || fail 'lualint' - ;; - pylint) - make pylint || fail 'pylint' - ;; - shlint) - make shlint || fail 'shlint' - ;; - single-includes) - make check-single-includes || fail 'single-includes' - ;; - *) - :;; - esac - - end_tests + tests=("$@") fi + +for i in "${tests[@]}"; do + make "$i" || fail "$i" +done + +end_tests diff --git a/ci/run_tests.sh b/ci/run_tests.sh index a121d28902..23460b682e 100755 --- a/ci/run_tests.sh +++ b/ci/run_tests.sh @@ -10,41 +10,26 @@ source "${CI_DIR}/common/suite.sh" rm -f "$END_MARKER" -if [[ "$GITHUB_ACTIONS" != "true" ]]; then - build_nvim || fail 'build' +# 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 - run_unittests || fail 'unittests' + tests+=('unittests') fi - run_functionaltests || fail 'functionaltests' + tests+=('functionaltests') fi - run_oldtests || fail 'oldtests' - install_nvim || fail 'install_nvim' - end_tests + tests+=('oldtests' 'install_nvim') else - case "$1" in - build) - build_nvim || fail 'build' - ;; - unittests) - run_unittests || fail 'unittests' - ;; - functionaltests) - run_functionaltests || fail 'functionaltests' - ;; - oldtests) - run_oldtests || fail 'oldtests' - ;; - install_nvim) - install_nvim || fail 'install_nvim' - ;; - *) - :;; - esac - - end_tests + tests=("$@") fi + +for i in "${tests[@]}"; do + eval "$i" || fail "$i" +done + +end_tests |