Skip to content

Commit e1243fa

Browse files
committed
Improve PyPI propagation check: enhance download verification for package availability
1 parent c5233c2 commit e1243fa

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

.github/workflows/cd.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -56,37 +56,31 @@ jobs:
5656

5757
- name: Wait for PyPI propagation
5858
run: |
59-
echo "Waiting for PyPI package to be available..."
59+
echo "Waiting for PyPI package to be downloadable..."
6060
PACKAGE_NAME="access_mopper"
6161
VERSION=$(python -c "import versioneer; print(versioneer.get_version())")
62-
# Strip 'v' prefix if present (git tags often have 'v' but PyPI versions don't)
6362
VERSION=${VERSION#v}
6463
echo "Looking for package: ${PACKAGE_NAME}==${VERSION}"
6564
66-
# Wait up to 15 minutes for the package to be available
65+
# Wait up to 15 minutes for the files to be downloadable
6766
for i in {1..90}; do
68-
echo "Attempt $i/90: Checking PyPI availability..."
69-
70-
# Try multiple methods to check package availability
71-
# Method 1: Check PyPI JSON API
72-
if curl -s "https://pypi.org/pypi/${PACKAGE_NAME}/json" | grep -q "\"${VERSION}\""; then
73-
echo "✅ Package ${PACKAGE_NAME}==${VERSION} found via PyPI API!"
67+
echo "Attempt $i/90: Trying to download wheel and sdist..."
68+
rm -rf /tmp/pypi_check_download && mkdir -p /tmp/pypi_check_download
69+
# Try to download both wheel and sdist
70+
pip download --no-deps --dest /tmp/pypi_check_download ${PACKAGE_NAME}==${VERSION} >/dev/null 2>&1
71+
WHEEL=$(ls /tmp/pypi_check_download/*.whl 2>/dev/null | head -1)
72+
SDIST=$(ls /tmp/pypi_check_download/*.tar.gz 2>/dev/null | head -1)
73+
if [[ -n "$WHEEL" && -n "$SDIST" ]]; then
74+
echo "✅ Both wheel and sdist for ${PACKAGE_NAME}==${VERSION} are downloadable!"
7475
break
7576
fi
76-
77-
# Method 2: Try pip install --dry-run (fallback)
78-
if pip install --dry-run ${PACKAGE_NAME}==${VERSION} >/dev/null 2>&1; then
79-
echo "✅ Package ${PACKAGE_NAME}==${VERSION} is installable!"
80-
break
81-
fi
82-
8377
if [ $i -eq 90 ]; then
84-
echo "❌ Package not found on PyPI after 15 minutes"
85-
echo "Available versions:"
86-
curl -s "https://pypi.org/pypi/${PACKAGE_NAME}/json" | grep -o '"[0-9][^"]*"' | head -10 || echo "Could not fetch versions"
78+
echo "❌ Could not download both wheel and sdist after 15 minutes"
79+
echo "Available files:"
80+
ls -l /tmp/pypi_check_download || echo "No files downloaded"
8781
exit 1
8882
fi
89-
echo "Package not yet available, waiting 10 seconds..."
83+
echo "Files not yet downloadable, waiting 10 seconds..."
9084
sleep 10
9185
done
9286

0 commit comments

Comments
 (0)