Skip to content

Commit

Permalink
fix: apply pip patch and timeout function to fix macos CI jobs (#263)
Browse files Browse the repository at this point in the history
Originally from python-poetry/poetry#6618, python-poetry/poetry#6586.

Co-authored-by: Mathieu Kniewallner <mathieu.kniewallner@gmail.com>
Co-authored-by: Bjorn Neergaard <bjorn@neersighted.com>
  • Loading branch information
3 people authored Sep 27, 2022
1 parent a8ac0d3 commit c476914
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ jobs:
run: |
echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
# XXX: Certificates are not correctly installed for 3.11-dev -- remove when fixed.
- name: Install missing certificates on 3.11 for macOS
if: ${{ matrix.python-version == '3.11-dev' && matrix.os == 'macOS' }}
run: /Applications/Python\ 3.11/Install\ Certificates.command

- name: Install Poetry
run: |
curl -sL https://install.python-poetry.org | python - -y
Expand All @@ -61,8 +66,17 @@ jobs:
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}

- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true' && matrix.os != 'macOS'
run: timeout 10s poetry run pip --version || rm -rf .venv
if: steps.cache.outputs.cache-hit == 'true'
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
if: ${{ matrix.python-version == '3.11-dev' && matrix.os == 'macOS' }}
run: poetry run pip install git+https://github.com/pypa/pip.git@fbb7f0b293f1d9289d8c76a556540325b9a172b2

- name: Install dependencies
run: |
Expand Down

0 comments on commit c476914

Please sign in to comment.