forked from ArcadeData/arcadedb
-
Notifications
You must be signed in to change notification settings - Fork 0
210 lines (175 loc) Β· 6.18 KB
/
Copy pathrelease-python-packages.yml
File metadata and controls
210 lines (175 loc) Β· 6.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
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.