Skip to content

Commit b58503a

Browse files
committed
fork: reapply python and fork-owned customizations on upstream main
1 parent 7ea811e commit b58503a

165 files changed

Lines changed: 53836 additions & 660 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
# Deploy docs when a version tag is pushed (e.g., 25.10.1, 25.10.1.post0)
5+
push:
6+
tags:
7+
- '[0-9]+.[0-9]+.[0-9]+*'
8+
9+
# Allow manual trigger for testing
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: 'Version to deploy (e.g., 25.10.1, 25.10.1.post0)'
14+
required: true
15+
set_latest:
16+
description: 'Set as latest version?'
17+
required: true
18+
type: boolean
19+
default: true
20+
21+
permissions:
22+
contents: read
23+
24+
# Allow only one concurrent deployment
25+
concurrency:
26+
group: "pages"
27+
cancel-in-progress: false
28+
29+
jobs:
30+
deploy:
31+
runs-on: ubuntu-latest
32+
environment:
33+
name: github-pages
34+
url: https://docs.humem.ai/arcadedb/
35+
env:
36+
DOCS_REPO: humemai/humemai-docs
37+
DOCS_BRANCH: main
38+
39+
steps:
40+
- name: Checkout repository
41+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
42+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
43+
with:
44+
fetch-depth: 0 # Full history for mike versioning
45+
token: ${{ secrets.GITHUB_TOKEN }}
46+
persist-credentials: false
47+
48+
- name: Set up Python
49+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
50+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
51+
with:
52+
python-version: '3.12'
53+
54+
- name: Setup UV package manager
55+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
56+
run: |
57+
curl -LsSf https://astral.sh/uv/install.sh | sh
58+
uv --version
59+
60+
- name: Install dependencies
61+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
62+
working-directory: bindings/python
63+
run: |
64+
uv pip install --system mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-macros-plugin mike
65+
66+
- name: Validate docs token
67+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
68+
run: |
69+
if [ -z "${{ secrets.HUMEMAI_DOCS_TOKEN }}" ]; then
70+
echo "HUMEMAI_DOCS_TOKEN is missing"
71+
exit 1
72+
fi
73+
74+
- name: Extract version from tag or input
75+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
76+
id: version
77+
run: |
78+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
79+
VERSION="${{ github.event.inputs.version }}"
80+
SET_LATEST="${{ github.event.inputs.set_latest }}"
81+
else
82+
# Extract version from tag (e.g., 25.10.1, 25.10.1.post0)
83+
VERSION="${{ github.ref_name }}"
84+
SET_LATEST="true"
85+
fi
86+
echo "version=$VERSION" >> $GITHUB_OUTPUT
87+
echo "set_latest=$SET_LATEST" >> $GITHUB_OUTPUT
88+
echo "📦 Deploying documentation version: $VERSION"
89+
90+
- name: Checkout humemai-docs
91+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
92+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
93+
with:
94+
repository: ${{ env.DOCS_REPO }}
95+
ref: ${{ env.DOCS_BRANCH }}
96+
token: ${{ secrets.HUMEMAI_DOCS_TOKEN }}
97+
path: humemai-docs
98+
99+
- name: Configure Git (humemai-docs)
100+
if: github.event_name == 'workflow_dispatch' || github.event_name == 'push'
101+
run: |
102+
git -C humemai-docs config user.name "github-actions[bot]"
103+
git -C humemai-docs config user.email "github-actions[bot]@users.noreply.github.com"
104+
105+
- name: Deploy with mike (set as latest)
106+
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && steps.version.outputs.set_latest == 'true'
107+
working-directory: humemai-docs
108+
env:
109+
MIKE_VERSION: ${{ steps.version.outputs.version }}
110+
run: |
111+
mike deploy --update-aliases \
112+
--deploy-prefix arcadedb \
113+
--branch ${{ env.DOCS_BRANCH }} \
114+
--push \
115+
--config-file ../bindings/python/mkdocs.yml \
116+
${{ steps.version.outputs.version }} latest \
117+
--title "${{ steps.version.outputs.version }}"
118+
mike set-default \
119+
--deploy-prefix arcadedb \
120+
--branch ${{ env.DOCS_BRANCH }} \
121+
--push \
122+
--config-file ../bindings/python/mkdocs.yml \
123+
latest
124+
125+
- name: Deploy with mike (not latest)
126+
if: (github.event_name == 'workflow_dispatch' || github.event_name == 'push') && steps.version.outputs.set_latest != 'true'
127+
working-directory: humemai-docs
128+
env:
129+
MIKE_VERSION: ${{ steps.version.outputs.version }}
130+
run: |
131+
mike deploy \
132+
--deploy-prefix arcadedb \
133+
--branch ${{ env.DOCS_BRANCH }} \
134+
--push \
135+
--config-file ../bindings/python/mkdocs.yml \
136+
${{ steps.version.outputs.version }} \
137+
--title "${{ steps.version.outputs.version }}"
Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
name: Build and Release Python Packages to PyPI
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+*' # Matches: 25.10.1, 25.10.1.dev0, 25.10.1.post1, etc.
7+
8+
jobs:
9+
# Validate version compatibility between tag and pom.xml
10+
validate-version:
11+
name: Validate Version Compatibility
12+
runs-on: ubuntu-24.04
13+
outputs:
14+
python-version: ${{ steps.validate.outputs.python-version }}
15+
base-version: ${{ steps.validate.outputs.base-version }}
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
22+
with:
23+
python-version: '3.12'
24+
25+
- name: Validate version compatibility
26+
id: validate
27+
run: |
28+
cd bindings/python
29+
30+
# Get version from git tag
31+
TAG_VERSION="${{ github.ref_name }}"
32+
echo "📌 Git tag version: $TAG_VERSION"
33+
34+
# Extract base version from tag (remove .dev0, .post1, etc.)
35+
TAG_BASE=$(echo "$TAG_VERSION" | sed -E 's/\.(dev|post|rc|a|b)[0-9]+$//')
36+
echo "📌 Tag base version: $TAG_BASE"
37+
38+
# Get version from pom.xml
39+
POM_VERSION=$(python3 extract_version.py --format=docker)
40+
echo "📌 pom.xml version: $POM_VERSION"
41+
42+
# Extract base version from pom.xml (remove -SNAPSHOT, etc.)
43+
POM_BASE=$(echo "$POM_VERSION" | sed 's/-SNAPSHOT$//' | sed 's/-RC.*//')
44+
echo "📌 pom.xml base version: $POM_BASE"
45+
46+
# Compare base versions
47+
if [ "$TAG_BASE" != "$POM_BASE" ]; then
48+
echo "❌ Version mismatch!"
49+
echo " Tag base version: $TAG_BASE"
50+
echo " pom.xml base version: $POM_BASE"
51+
echo ""
52+
echo "This prevents accidentally releasing the wrong version."
53+
echo "For example, tagging 25.9.1.dev0 when pom.xml says 25.10.1-SNAPSHOT"
54+
exit 1
55+
fi
56+
57+
echo "✅ Version compatibility check passed!"
58+
echo " Base version: $TAG_BASE"
59+
echo " Full tag version: $TAG_VERSION"
60+
61+
# Output for later jobs
62+
echo "python-version=$TAG_VERSION" >> $GITHUB_OUTPUT
63+
echo "base-version=$TAG_BASE" >> $GITHUB_OUTPUT
64+
65+
# Run example tests before building (workflow_call)
66+
test-examples:
67+
name: Run Example Tests
68+
needs: validate-version
69+
uses: ./.github/workflows/test-python-examples.yml
70+
with:
71+
build-version: ${{ needs.validate-version.outputs.python-version }}
72+
secrets: inherit
73+
74+
# Run unit tests before building
75+
test:
76+
name: Run Unit Tests
77+
needs: validate-version
78+
uses: ./.github/workflows/test-python-bindings.yml
79+
with:
80+
build-version: ${{ needs.validate-version.outputs.python-version }}
81+
secrets: inherit
82+
83+
publish:
84+
name: Publish arcadedb-embedded to PyPI (4 platforms)
85+
needs: [validate-version, test, test-examples]
86+
runs-on: ubuntu-latest
87+
continue-on-error: true # Don't block GitHub Release if PyPI upload fails (size limit)
88+
environment: pypi
89+
permissions:
90+
id-token: write
91+
steps:
92+
- name: Download wheels for all tested Python versions
93+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
94+
with:
95+
pattern: wheel-*-py*
96+
path: dist/
97+
merge-multiple: true
98+
99+
- name: Verify wheels
100+
run: |
101+
ls -lh dist/
102+
echo "📦 Wheels for PyPI (current platforms):"
103+
ls dist/*.whl
104+
105+
# Count wheels (should be 20: 4 platforms x 5 Python versions)
106+
WHEEL_COUNT=$(ls dist/*.whl | wc -l)
107+
echo "📊 Wheel count: $WHEEL_COUNT (expected: 20)"
108+
109+
echo ""
110+
echo "ℹ️ Current PyPI platforms: linux x86_64, linux arm64, macOS Apple Silicon, windows x86_64"
111+
112+
if [ "$WHEEL_COUNT" -ne 20 ]; then
113+
echo "❌ Expected 20 wheels (4 platforms x 5 Python versions), got $WHEEL_COUNT"
114+
exit 1
115+
fi
116+
117+
# Show checksums to verify wheels are different
118+
echo ""
119+
echo "🔐 Wheel checksums (SHA256):"
120+
sha256sum dist/*.whl
121+
122+
# Report wheel sizes with actual component breakdown
123+
echo "" >> $GITHUB_STEP_SUMMARY
124+
echo "## 📦 Built Wheels" >> $GITHUB_STEP_SUMMARY
125+
echo "" >> $GITHUB_STEP_SUMMARY
126+
echo "| Platform | Wheel Size | JRE Size | JARs Size | Installed Size | SHA256 (first 8 chars) |" >> $GITHUB_STEP_SUMMARY
127+
echo "|----------|------------|----------|-----------|----------------|------------------------|" >> $GITHUB_STEP_SUMMARY
128+
129+
for WHEEL_FILE in dist/*.whl; do
130+
WHEEL_NAME=$(basename "$WHEEL_FILE")
131+
WHEEL_SIZE_BYTES=$(stat -c%s "$WHEEL_FILE")
132+
WHEEL_SIZE_MB=$(echo "scale=1; $WHEEL_SIZE_BYTES / 1024 / 1024" | bc)
133+
134+
# Extract platform from filename
135+
if [[ "$WHEEL_NAME" == *"manylinux"*"x86_64"* ]]; then
136+
PLATFORM="linux/amd64"
137+
elif [[ "$WHEEL_NAME" == *"manylinux"*"aarch64"* ]]; then
138+
PLATFORM="linux/arm64"
139+
elif [[ "$WHEEL_NAME" == *"macosx"*"arm64"* ]]; then
140+
PLATFORM="darwin/arm64"
141+
# elif [[ "$WHEEL_NAME" == *"macosx"*"x86_64"* ]]; then
142+
# PLATFORM="darwin/amd64"
143+
elif [[ "$WHEEL_NAME" == *"win_amd64"* ]]; then
144+
PLATFORM="windows/amd64"
145+
else
146+
PLATFORM="unknown"
147+
fi
148+
149+
# Analyze wheel contents
150+
TEMP_DIR=$(mktemp -d)
151+
unzip -q "$WHEEL_FILE" -d "$TEMP_DIR"
152+
153+
# Calculate component sizes (find jre directory anywhere)
154+
JRE_DIR=$(find "$TEMP_DIR" -type d -name "jre" | head -n1)
155+
if [ -n "$JRE_DIR" ] && [ -d "$JRE_DIR" ]; then
156+
JRE_SIZE_BYTES=$(du -sb "$JRE_DIR" | cut -f1)
157+
JRE_SIZE_MB=$(echo "scale=1; $JRE_SIZE_BYTES / 1024 / 1024" | bc)
158+
else
159+
JRE_SIZE_MB="N/A"
160+
fi
161+
162+
JAR_SIZE_BYTES=$(find "$TEMP_DIR" -name "*.jar" -exec du -cb {} + 2>/dev/null | tail -1 | cut -f1)
163+
if [ -n "$JAR_SIZE_BYTES" ] && [ "$JAR_SIZE_BYTES" != "0" ]; then
164+
JAR_SIZE_MB=$(echo "scale=1; $JAR_SIZE_BYTES / 1024 / 1024" | bc)
165+
else
166+
JAR_SIZE_MB="N/A"
167+
fi
168+
169+
INSTALLED_SIZE_BYTES=$(du -sb "$TEMP_DIR" | cut -f1)
170+
INSTALLED_SIZE_MB=$(echo "scale=0; $INSTALLED_SIZE_BYTES / 1024 / 1024" | bc)
171+
172+
# Calculate SHA256 checksum
173+
CHECKSUM=$(sha256sum "$WHEEL_FILE" | cut -d' ' -f1 | cut -c1-8)
174+
175+
rm -rf "$TEMP_DIR"
176+
177+
echo "| $PLATFORM | ${WHEEL_SIZE_MB}M | ${JRE_SIZE_MB}M | ${JAR_SIZE_MB}M | ~${INSTALLED_SIZE_MB}M | \`$CHECKSUM\` |" >> $GITHUB_STEP_SUMMARY
178+
done
179+
180+
echo "" >> $GITHUB_STEP_SUMMARY
181+
echo "**Note**: Sizes are uncompressed except for Wheel Size (compressed)" >> $GITHUB_STEP_SUMMARY
182+
echo "" >> $GITHUB_STEP_SUMMARY
183+
184+
- name: Verify wheel versions
185+
run: |
186+
TAG_VERSION="${{ needs.validate-version.outputs.python-version }}"
187+
EXPECTED_VERSION="$TAG_VERSION"
188+
189+
for WHEEL_FILE in dist/*.whl; do
190+
echo "📦 Checking: $WHEEL_FILE"
191+
# Extract version from wheel filename
192+
WHEEL_VERSION=$(echo "$WHEEL_FILE" | grep -oP '\d+\.\d+\.\d+(\.(dev|post|rc|a|b)\d+)?')
193+
echo " Version: $WHEEL_VERSION"
194+
195+
if [ "$WHEEL_VERSION" != "$EXPECTED_VERSION" ]; then
196+
echo "❌ Wheel version mismatch in $WHEEL_FILE!"
197+
echo " Expected: $EXPECTED_VERSION"
198+
exit 1
199+
fi
200+
done
201+
echo "✅ All wheel versions match expected version ($EXPECTED_VERSION)"
202+
203+
- name: Publish to PyPI
204+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1

0 commit comments

Comments
 (0)