diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e61708e6..1e768976 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -50,6 +50,9 @@ env: OPENBLAS_NUM_THREADS: '1' MKL_NUM_THREADS: '1' NUMEXPR_NUM_THREADS: '1' + # Ride out slow or dropped PyPI downloads (Poetry's defaults: 15s, 0 retries). + POETRY_REQUESTS_TIMEOUT: '60' + POETRY_REQUESTS_MAX_RETRIES: '3' concurrency: # Label-triggered runs must not cancel the regular pull-request checks. @@ -154,7 +157,13 @@ jobs: INSTALL_JUPYTER=0 ./setup/ubuntu/24.04/install_prereqs.sh sudo -H -u runner python3 -m pip install --user --break-system-packages poetry==2.5.1 sudo -H -u runner python3 -m poetry config virtualenvs.in-project true - sudo -H -u runner python3 -m poetry install --all-extras --with dev + # sudo resets the environment, so pass the Poetry network settings through. + for attempt in 1 2 3; do + sudo --preserve-env=POETRY_REQUESTS_TIMEOUT,POETRY_REQUESTS_MAX_RETRIES -H -u runner \ + python3 -m poetry install --all-extras --with dev && break + if [[ $attempt == 3 ]]; then exit 1; fi + echo "poetry install failed (attempt $attempt); retrying in 30s"; sleep 30 + done rm -rf /var/cache/apt/archives/*.deb /var/cache/apt/archives/partial/*.deb /var/cache/apt/*.bin /var/lib/apt/lists/* /var/log/apt/* shell: bash @@ -323,6 +332,14 @@ jobs: with: python-version: '3.13' + - name: cache poetry downloads + uses: actions/cache@v4 + with: + path: ~/Library/Caches/pypoetry + key: poetry-${{ runner.os }}-${{ runner.arch }}-py3.13-${{ hashFiles('poetry.lock') }} + restore-keys: | + poetry-${{ runner.os }}-${{ runner.arch }}-py3.13- + - name: checkout solutions env: SOLUTIONS_TOKEN: ${{ secrets.SOLUTIONS_TOKEN }} @@ -342,7 +359,11 @@ jobs: python -m pip install --user poetry==2.5.1 python -m poetry config virtualenvs.in-project true python -m poetry env use "$(python -c 'import sys; print(sys.executable)')" - python -m poetry install --all-extras --with dev + for attempt in 1 2 3; do + python -m poetry install --all-extras --with dev && break + if [[ $attempt == 3 ]]; then exit 1; fi + echo "poetry install failed (attempt $attempt); retrying in 30s"; sleep 30 + done shell: zsh -efuo pipefail {0} - name: configure LCM multicast loopback