Skip to content

Commit 4a94efa

Browse files
committed
Remove testpy from CI
1 parent 4fb6ea9 commit 4a94efa

1 file changed

Lines changed: 0 additions & 89 deletions

File tree

.github/workflows/python-app.yaml

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -197,98 +197,9 @@ jobs:
197197
env:
198198
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
199199

200-
publish-testpypi:
201-
name: Publish to TestPyPI
202-
runs-on: ubuntu-24.04
203-
needs: [test, test-examples, create-release] # Run after tests and release creation
204-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only on tag push
205-
environment:
206-
name: testpypi
207-
url: https://test.pypi.org/p/flixopt
208-
env:
209-
SKIP_TESTPYPI_UPLOAD: "false"
210-
211-
steps:
212-
- name: Checkout repository
213-
uses: actions/checkout@v5
214-
215-
- name: Set up uv
216-
uses: astral-sh/setup-uv@v6
217-
with:
218-
version: "0.9.8"
219-
enable-cache: true
220-
221-
- name: Set up Python
222-
uses: actions/setup-python@v6
223-
with:
224-
python-version: ${{ env.PYTHON_VERSION }}
225-
226-
- name: Install dependencies
227-
run: |
228-
uv pip install --system twine
229-
230-
- name: Build the distribution
231-
run: |
232-
uv build
233-
234-
- name: Upload to TestPyPI
235-
run: |
236-
twine upload --repository-url https://test.pypi.org/legacy/ dist/* --verbose --skip-existing
237-
env:
238-
TWINE_USERNAME: __token__
239-
TWINE_PASSWORD: ${{ secrets.TEST_PYPI_API_TOKEN }}
240-
TWINE_NON_INTERACTIVE: "1"
241-
242-
- name: Test install from TestPyPI
243-
if: env.SKIP_TESTPYPI_UPLOAD != 'true'
244-
run: |
245-
set -Eeuo pipefail
246-
# Create a temporary environment to test installation
247-
uv venv test_env
248-
source test_env/bin/activate
249-
250-
# Get project name from pyproject.toml (PEP 621)
251-
PACKAGE_NAME=$(python - <<'PY'
252-
import sys, tomllib, pathlib
253-
data = tomllib.loads(pathlib.Path("pyproject.toml").read_text(encoding="utf-8"))
254-
print(data["project"]["name"])
255-
PY
256-
)
257-
258-
# Extract version from git tag
259-
VERSION=${GITHUB_REF#refs/tags/v}
260-
261-
# Wait and retry while TestPyPI indexes the package
262-
INSTALL_SUCCESS=false
263-
for d in 10 20 40 80 120; do
264-
sleep "$d"
265-
echo "Attempting to install $PACKAGE_NAME==$VERSION from TestPyPI (retry after ${d}s)..."
266-
267-
# Install specific version and verify it matches
268-
if uv pip install --index-strategy unsafe-best-match --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "$PACKAGE_NAME==$VERSION" && \
269-
python -c "from importlib.metadata import version; installed = version('$PACKAGE_NAME'); print(f'Installed: {installed}'); assert '$VERSION' == installed"; then
270-
INSTALL_SUCCESS=true
271-
break
272-
fi
273-
done
274-
275-
# Check if installation succeeded
276-
if [ "$INSTALL_SUCCESS" = "false" ]; then
277-
echo "ERROR: Failed to install $PACKAGE_NAME==$VERSION from TestPyPI after all retries"
278-
echo "This could indicate:"
279-
echo " - TestPyPI indexing issues"
280-
echo " - Package upload problems"
281-
echo " - Version mismatch between tag and package"
282-
exit 1
283-
fi
284-
285-
# Final success confirmation
286-
python -c "import flixopt; print('TestPyPI installation successful!')"
287-
288200
publish-pypi:
289201
name: Publish to PyPI
290202
runs-on: ubuntu-24.04
291-
needs: [publish-testpypi] # Only run after TestPyPI publish succeeds
292203
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') # Only on tag push
293204
environment:
294205
name: pypi

0 commit comments

Comments
 (0)