From 6808e7d32df20af38fad2fadd7e216213025b093 Mon Sep 17 00:00:00 2001 From: Jens Keiner Date: Thu, 17 Aug 2023 14:11:03 +0200 Subject: [PATCH] Attempt at fixing wait for new package appearing in PyPI index. --- .github/workflows/publish-rc.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish-rc.yml b/.github/workflows/publish-rc.yml index 86411ad..77d8ae3 100644 --- a/.github/workflows/publish-rc.yml +++ b/.github/workflows/publish-rc.yml @@ -53,8 +53,17 @@ jobs: - name: Install from testpypi and import. run: | i=0 - while (($i<120)) && [[ ! $(curl --max-time 120 -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -r '.releases | keys[]') =~ (^|[[:space:]])${{ env.VERSION }}($|[[:space:]]) ]];\ - do echo waiting for package to appear in test index, sleeping 5s; sleep 5s; let i++; done + n=60 + exists=0 + while [ $i -lt $n ] && [ $exists -eq 0 ]; do + if curl -s https://test.pypi.org/pypi/${{ env.PACKAGE_NAME }}/json | jq -e '.releases | has("${{ env.VERSION }}")' &> /dev/null; then + exists=1 + else + ((i++)) + echo "$i/$n Waiting for package to appear in test index, sleeping 5s. + sleep 5s + fi + done pip install --no-cache-dir --index-url https://test.pypi.org/simple ${{ env.PACKAGE_NAME }}==${{ env.VERSION }} --no-deps pip install -r requirements.txt python -c 'import ${{ env.MODULE_NAME }};print(${{ env.MODULE_NAME }}.__version__)'