From a489bea480eaf47825632d389a447af5673d6f95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Fr=C3=B3es=20Franco?= Date: Tue, 12 May 2026 13:17:10 +0000 Subject: [PATCH] test(keymaps): hard timeouts + serialise the CI job behind `test` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit User reported the editor-keymaps CI job hung for 30 minutes before "Has been cancelled" — twice in a row. Two changes to keep that from happening again: 1. Wrap both harness invocations with `timeout` (60s Neovim, 30s Vim). A misbehaving LSP attach, a stuck `vim.defer_fn`, or ex-mode hung on stdin can no longer hold the runner indefinitely; `timeout` kills the process and the wrapper exits non-zero so CI shows the real failure shape. 2. ` --- .gitea/workflows/ci.yaml | 5 +++++ scripts/test-keymaps-vim.sh | 6 ++++-- scripts/test-keymaps.sh | 4 +++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 02d3f94..62466b7 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -59,6 +59,11 @@ jobs: keymaps: name: editor keymaps runs-on: ubuntu-latest + # Serialise behind the cargo jobs so we never compete with them + # for runners, and inherit their warm cargo cache instead of + # forcing a release build of our own. + needs: test + timeout-minutes: 10 steps: - uses: actions/checkout@v4 - uses: dtolnay/rust-toolchain@1.83 diff --git a/scripts/test-keymaps-vim.sh b/scripts/test-keymaps-vim.sh index 9231ecb..77127c8 100755 --- a/scripts/test-keymaps-vim.sh +++ b/scripts/test-keymaps-vim.sh @@ -41,9 +41,11 @@ EOF RESULTS="$TMP/results.txt" log "running harness…" +# `"$TMP/vim.log" 2>&1 || true + timeout 30 vim -e -s -u "$VIMRC" -c "edit $SEED" -c "source $REPO_ROOT/scripts/test-keymaps-vim.vim" \ + "$TMP/vim.log" 2>&1 || true if [[ ! -f "$RESULTS" ]]; then echo 'keymap test harness produced no output' >&2 diff --git a/scripts/test-keymaps.sh b/scripts/test-keymaps.sh index 6a64e3a..c38a79c 100755 --- a/scripts/test-keymaps.sh +++ b/scripts/test-keymaps.sh @@ -46,8 +46,10 @@ log "running harness…" # `nvim --headless -u init.lua FILE +luafile …` — the harness's # `vim.defer_fn` lets the LSP attach before tests fire, then writes # the results file and exits. Output path is plumbed through env. +# Wrapped in `timeout` so a hung LSP / harness fails fast instead of +# stalling CI runners indefinitely. NUWIKI_KEYMAP_RESULTS="$RESULTS" \ - nvim --clean -u "$INIT" --headless "$TMP/wiki/index.wiki" \ + timeout 60 nvim --clean -u "$INIT" --headless "$TMP/wiki/index.wiki" \ -c "luafile $REPO_ROOT/scripts/test-keymaps.lua" \ >"$TMP/nvim.log" 2>&1 || true