From fe7de2283a824a088edd52d464cd3572d18d10ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sat, 7 Feb 2026 10:21:32 -0800 Subject: [PATCH 1/2] Move test CI off test runner image --- .github/workflows/test.yml | 9 ++++--- bin/verify-exercises | 54 ++++++++++++++++++++++++++++++-------- 2 files changed, 49 insertions(+), 14 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 39f0f80..8e9414f 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -9,12 +9,15 @@ on: jobs: ci: runs-on: ubuntu-24.04 - container: - image: exercism/vimscript-test-runner - steps: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + - name: Checkout vader.vim + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd + with: + repository: junegunn/vader.vim + path: deps/vader + - name: Verify all exercises run: bin/verify-exercises diff --git a/bin/verify-exercises b/bin/verify-exercises index b10a541..d90ca3d 100755 --- a/bin/verify-exercises +++ b/bin/verify-exercises @@ -2,23 +2,55 @@ temp_dir_base=$(mktemp -d) +echo "Cloning vader.vim to temporary directory" +VADER_TEMP_DIR=$(mktemp -d) +trap "rm -rf '$VADER_TEMP_DIR'" EXIT + +git clone --depth 1 https://github.com/junegunn/vader.vim.git "$VADER_TEMP_DIR/vader.vim" > /dev/null 2>&1 +VADER_PATH="$VADER_TEMP_DIR/vader.vim" + run_test() { - slug=$(basename $1) + slug=${1%/} + slug=${slug##*/} temp_dir=${temp_dir_base}/${slug} mkdir -p ${temp_dir} cp -r "$1/." $temp_dir - slug_snakecase=$(echo "$slug" | tr '-' '_') - cp $temp_dir/.meta/example.vim $temp_dir/$slug_snakecase.vim - - (cd /opt/test-runner && bin/run.sh $slug $temp_dir $temp_dir) || exit 1 - - test_status="$(jq -r '.status' $temp_dir/results.json)" + slug_file=${slug//-/_} + + if [ -f "$temp_dir/.meta/exemplar.vim" ]; then + cp $temp_dir/.meta/exemplar.vim $temp_dir/$slug_file.vim + elif [ -f "$temp_dir/.meta/example.vim" ]; then + cp $temp_dir/.meta/example.vim $temp_dir/$slug_file.vim + else + echo "ERROR: Missing example/exemplar solution for $slug" + exit 1 + fi + + echo -n "Running tests for $slug: " + + start_time=$(date +%s.%N) + output=$(vim -es -Nu <(cat <&1) - if [ "$test_status" != "pass" ]; then - echo "Tests for $slug have failed:" - cat $temp_dir/results.json - exit 1 + exit_code=$? + end_time=$(date +%s.%N) + duration=$(echo "$end_time - $start_time" | bc) + + if [ $exit_code -ne 0 ]; then + echo "FAILED!" + echo "$output" | sed -n '/^Starting Vader:/,$p' + exit 1 + else + printf "ok (%.2fs)\n" "$duration" fi } From af8fd292e220f74127f0e1e83f030759a64dae61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A1s=20B=20Nagy?= <20251272+BNAndras@users.noreply.github.com> Date: Sat, 7 Feb 2026 10:23:42 -0800 Subject: [PATCH 2/2] Remove now-redundant vader install step --- .github/workflows/test.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8e9414f..5ecd543 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,11 +13,5 @@ jobs: - name: Checkout repository uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - - name: Checkout vader.vim - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd - with: - repository: junegunn/vader.vim - path: deps/vader - - name: Verify all exercises run: bin/verify-exercises