Skip to content

Commit

Permalink
Hack to work around microsoft/vscode#178241
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey committed Jun 6, 2023
1 parent 65fab51 commit a14fb68
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
29 changes: 29 additions & 0 deletions scripts/ci-test-windows.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a14fb68

Please sign in to comment.