Skip to content

test: Temporary simplified workflow for PyPI environment approval (0.… #31

test: Temporary simplified workflow for PyPI environment approval (0.…

test: Temporary simplified workflow for PyPI environment approval (0.… #31

name: Build and Release Python Packages to PyPI (Dummy for Testing)
on:
push:
tags:
- '0.0.*' # Only matches 0.0.x versions for testing
jobs:
# Simple version validation
validate-version:
name: Validate Version
runs-on: ubuntu-24.04
outputs:
python-version: ${{ steps.validate.outputs.python-version }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set version from tag
id: validate
run: |
TAG_VERSION="${{ github.ref_name }}"
echo "📌 Git tag version: $TAG_VERSION"
echo "python-version=$TAG_VERSION" >> $GITHUB_OUTPUT
# Build minimal dummy wheels
build-dummy-wheels:
needs: validate-version
name: Build Dummy Wheel (${{ matrix.platform }})
runs-on: ubuntu-latest
strategy:
matrix:
platform:
- linux-amd64
- linux-arm64
- darwin-amd64
- darwin-arm64
- windows-amd64
- windows-arm64
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Build minimal dummy wheel
env:
VERSION: ${{ needs.validate-version.outputs.python-version }}
PLATFORM: ${{ matrix.platform }}
run: |
cd bindings/python
mkdir -p dist
# Platform to wheel tag mapping
case "$PLATFORM" in
linux-amd64) WHEEL_TAG="manylinux_2_35_x86_64" ;;
linux-arm64) WHEEL_TAG="manylinux_2_35_aarch64" ;;
darwin-amd64) WHEEL_TAG="macosx_10_9_x86_64" ;;
darwin-arm64) WHEEL_TAG="macosx_11_0_arm64" ;;
windows-amd64) WHEEL_TAG="win_amd64" ;;
windows-arm64) WHEEL_TAG="win_arm64" ;;
esac
export WHEEL_TAG
# Create minimal wheel structure
python3 << 'PYEOF'
import os
import sys
import tempfile
import zipfile
from pathlib import Path
version = os.environ['VERSION']
platform = os.environ['PLATFORM']
wheel_tag = os.environ['WHEEL_TAG']
py_tag = f"cp{sys.version_info.major}{sys.version_info.minor}"
wheel_filename = f"arcadedb_embedded-{version}-{py_tag}-none-{wheel_tag}.whl"
wheel_path = Path("dist") / wheel_filename
with tempfile.TemporaryDirectory() as temp_dir:
temp_path = Path(temp_dir)
# Create package
pkg_dir = temp_path / "arcadedb_embedded"
pkg_dir.mkdir()
(pkg_dir / "__init__.py").write_text(f'''"""Dummy test wheel.
Version: {version}
Platform: {platform}
"""
__version__ = "{version}"
''')
# Create metadata
dist_info = temp_path / f"arcadedb_embedded-{version}.dist-info"
dist_info.mkdir()
(dist_info / "WHEEL").write_text(f"""Wheel-Version: 1.0
Generator: dummy-builder
Root-Is-Purelib: false
Tag: {py_tag}-none-{wheel_tag}
""")
(dist_info / "METADATA").write_text(f"""Metadata-Version: 2.1
Name: arcadedb-embedded
Version: {version}
Summary: Dummy test wheel for PyPI environment approval
Home-page: https://github.com/humemai/arcadedb-embedded-python
Author: Test
License: Apache-2.0
""")
(dist_info / "RECORD").write_text("")
(dist_info / "top_level.txt").write_text("arcadedb_embedded\n")
# Create wheel
with zipfile.ZipFile(wheel_path, 'w', zipfile.ZIP_DEFLATED) as whl:
for root, _, files in os.walk(temp_path):
for file in files:
file_path = Path(root) / file
arcname = file_path.relative_to(temp_path)
whl.write(file_path, arcname)
print(f"✅ Created: {wheel_path.name}")
PYEOF
ls -lh dist/
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheel-${{ matrix.platform }}
path: bindings/python/dist/*.whl
retention-days: 5
# Publish to PyPI
publish:
name: Publish to PyPI (Test)
needs: [validate-version, build-dummy-wheels]
runs-on: ubuntu-latest
environment: pypi-base
permissions:
id-token: write
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: wheels-temp/
merge-multiple: false
- name: Collect wheels
run: |
mkdir -p dist
find wheels-temp -name "*.whl" -exec cp {} dist/ \;
echo "📦 Collected wheels:"
ls -lh dist/
- name: Verify wheels
run: |
WHEEL_COUNT=$(ls dist/*.whl | wc -l)
echo "📊 Wheel count: $WHEEL_COUNT"
if [ "$WHEEL_COUNT" -ne 6 ]; then
echo "❌ Expected 6 wheels, got $WHEEL_COUNT"
exit 1
fi
echo "✅ All 6 wheels present"
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
# Create GitHub Release
github-release:
name: Create GitHub Release
needs: [validate-version, build-dummy-wheels]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download all wheels
uses: actions/download-artifact@v4
with:
pattern: wheel-*
path: dist/
merge-multiple: true
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*.whl
generate_release_notes: false
draft: false
prerelease: true
body: |
## 🧪 Test Release v${{ needs.validate-version.outputs.python-version }}
**This is a dummy test release for PyPI environment approval.**
These wheels contain minimal dummy code and should NOT be used in production.
Purpose: Trigger PyPI `pypi-base` environment approval in GitHub Actions.