From aee025ea9c15036b3034f0bc48873ca6234bcae2 Mon Sep 17 00:00:00 2001 From: Mathieu Kniewallner Date: Sat, 24 Sep 2022 16:21:00 +0200 Subject: [PATCH] ci: define `timeout` on macOS Co-authored-by: Bjorn Neergaard --- .github/workflows/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1dfde2f1c3f..54ad26285a8 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -81,7 +81,12 @@ jobs: - name: Ensure cache is healthy if: steps.cache.outputs.cache-hit == 'true' - run: timeout 10s poetry run pip --version || rm -rf .venv + run: | + # `timeout` is not available on macOS, so we define a custom function. + [ "$(command -v timeout)" ] || function timeout() { perl -e 'alarm shift; exec @ARGV' "$@"; } + + # Using `timeout` is a safeguard against the Poetry command hanging for some reason. + timeout 10s poetry run pip --version || rm -rf .venv # XXX: https://github.com/pypa/pip/issues/11352 causes random failures -- remove once fixed in a release. - name: Upgrade pip on 3.11 for macOS