From a14fb6827cc7bbd3def5605cdd0bd2efc2fa195d Mon Sep 17 00:00:00 2001 From: Pokey Rule <755842+pokey@users.noreply.github.com> Date: Tue, 6 Jun 2023 14:09:38 +0100 Subject: [PATCH] Hack to work around microsoft/vscode#178241 --- .github/workflows/test.yml | 4 +++- scripts/ci-test-windows.sh | 29 +++++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 scripts/ci-test-windows.sh diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 40c5107e5cb..ee4c24837c1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,8 +40,10 @@ jobs: - run: pnpm --color --filter '!cursorless-org' --filter '!cursorless-org-*' build - run: xvfb-run -a pnpm --color test if: runner.os == 'Linux' + - run: bash scripts/ci-test-windows.sh + if: runner.os == 'Windows' - run: pnpm --color test - if: runner.os != 'Linux' + if: runner.os == 'macOS' - name: Create vscode dist that can be installed locally run: pnpm -F @cursorless/cursorless-vscode populate-dist --local-install if: runner.os == 'Linux' && matrix.vscode_version == 'stable' diff --git a/scripts/ci-test-windows.sh b/scripts/ci-test-windows.sh new file mode 100644 index 00000000000..98cfb61b1fe --- /dev/null +++ b/scripts/ci-test-windows.sh @@ -0,0 +1,29 @@ +# This script is run by GitHub Actions on Windows +# We need this script to work around a bug in the Windows GitHub Actions +# environment where VSCode sometimes becomes unresponsive during the tests. +# See https://github.com/microsoft/vscode/issues/178241 +set -euo pipefail + +test_output_path="test-output.txt" + +ret=0 +script --flush --quiet --return "$test_output_path" --command "pnpm --color test" || ret=$? + +# If the test failed, but contains the string "CodeWindow: detected unresponsive", +# then it is https://github.com/microsoft/vscode/issues/178241; try 2 more times + +for i in {1..2}; do + if [[ $ret -ne 0 ]]; then + if grep -q "CodeWindow: detected unresponsive" "$test_output_path"; then + echo "Detected unresponsive VSCode window; retrying" + script --flush --quiet --return "$test_output_path" --command "pnpm --color test" || ret=$? + else + break + fi + fi +done + +if [[ $ret -ne 0 ]]; then + echo "Test failed" + exit $ret +fi