Skip to content

Commit ffbeaf7

Browse files
committed
Add comprehensive tests for ArcadeDB Python bindings
- Implement Gremlin query and traversal tests in `test_gremlin.py` - Add data import tests for CSV, JSON, and JSONL formats in `test_importer.py` - Create server-related tests including server creation, database operations, and custom configurations in `test_server.py` - Introduce tests for server access patterns and thread safety in `test_server_patterns.py` - Add a script to write version information to `_version.py` during build Add GitHub Actions workflow for deploying MkDocs to GitHub Pages Remove GitHub Actions workflow for deploying MkDocs to GitHub Pages feat: add support for Python-specific patch versioning in version extraction fix: update permissions for GitHub Actions and enhance version extraction regex Add Python example for ArcadeDB usage and update documentation - Created a new example script `basic.py` demonstrating database creation, schema definition, data insertion, and querying using ArcadeDB Python bindings. - Added a `.gitignore` file in the examples directory to exclude test databases. - Updated `mkdocs.yml` to reflect changes in the documentation structure and added links to new testing documentation. - Revised the README in the tests directory to provide a concise overview of the test suite, including quick stats, test categories, and running instructions. feat: enhance Python release workflows with tag validation and testing Fix python docs Refactor Docker build process for Python bindings and enhance version extraction Enhance Python test suite for ArcadeDB bindings - Updated README.md to reflect the addition of new tests, increasing total from 41 to 42. - Improved temporary directory creation in conftest.py with a new factory fixture for better cleanup management. - Refactored cleanup_db fixture in test_concurrency.py to create temporary databases with unique prefixes. - Enhanced server and studio tests in test_server.py with detailed comments on Java API usage and server operations. - Expanded test_server_patterns.py to include HTTP API access pattern tests, demonstrating remote access capabilities and performance comparisons with Java API. - Increased the complexity of performance tests in test_embedded_performance_comparison.py by adding more realistic data and queries. Update Python bindings test workflow and improve server documentation formatting Refactor descriptions in Dockerfile and pyproject.toml to use "bindings" terminology; update module docstring for consistency Update GitHub Actions to use latest action versions for Python and Docker setup Update GitHub Actions to use specific commit version for PyPI publish action Clean up whitespace in write_version.py for improved readability Refactor test files to remove unnecessary whitespace and improve readability - Cleaned up whitespace in test_gremlin.py, test_importer.py, test_server.py, and test_server_patterns.py. - Ensured consistent formatting across test files for better maintainability. - No functional changes were made; only formatting adjustments to enhance code clarity. Fix formatting inconsistencies and ensure newline at end of files in documentation and test package Ensure newline at end of file in .gitignore for consistency Remove trailing whitespace from documentation and test files for improved consistency and readability Clean up whitespace in build-all.sh for improved readability
1 parent 732d083 commit ffbeaf7

68 files changed

Lines changed: 23220 additions & 1 deletion

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Deploy MkDocs to GitHub Pages
2+
3+
on:
4+
release:
5+
types: [published] # Trigger when GitHub Release is published
6+
# Release tag should contain 'python' (case-insensitive, e.g., v25.9.1-python, v1.0.0-Python)
7+
8+
# Allow manual trigger for testing
9+
workflow_dispatch:
10+
inputs:
11+
version:
12+
description: 'Version to deploy (e.g., 25.9.1 or dev)'
13+
required: true
14+
default: 'dev'
15+
set_latest:
16+
description: 'Set as latest version?'
17+
required: true
18+
type: boolean
19+
default: true
20+
21+
permissions:
22+
contents: write # Need write to push to gh-pages branch
23+
pages: write
24+
id-token: write
25+
26+
# Allow only one concurrent deployment
27+
concurrency:
28+
group: "pages"
29+
cancel-in-progress: false
30+
31+
jobs:
32+
deploy:
33+
runs-on: ubuntu-latest
34+
environment:
35+
name: github-pages
36+
url: https://humemai.github.io/arcadedb/
37+
38+
steps:
39+
- name: Check if this is a Python release
40+
if: github.event_name == 'release'
41+
id: check-python-release
42+
run: |
43+
TAG_NAME="${{ github.event.release.tag_name }}"
44+
TAG_LOWER=$(echo "$TAG_NAME" | tr '[:upper:]' '[:lower:]')
45+
46+
if [[ "$TAG_LOWER" == *"python"* ]]; then
47+
echo "✅ This is a Python release: $TAG_NAME"
48+
echo "is-python-release=true" >> $GITHUB_OUTPUT
49+
else
50+
echo "⏭️ Not a Python release (tag: $TAG_NAME), skipping docs deployment"
51+
echo "is-python-release=false" >> $GITHUB_OUTPUT
52+
exit 0
53+
fi
54+
55+
- name: Skip workflow for non-Python releases
56+
if: github.event_name == 'release' && steps.check-python-release.outputs.is-python-release != 'true'
57+
run: |
58+
echo "This is not a Python release, exiting gracefully"
59+
exit 0
60+
61+
- name: Checkout repository
62+
if: github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true'
63+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
64+
with:
65+
fetch-depth: 0 # Full history for mike versioning
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Set up Python
69+
if: github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true'
70+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
71+
with:
72+
python-version: '3.11'
73+
cache: 'pip'
74+
75+
- name: Install dependencies
76+
if: github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true'
77+
working-directory: bindings/python
78+
run: |
79+
pip install --upgrade pip
80+
pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mike
81+
82+
- name: Configure Git
83+
if: github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true'
84+
run: |
85+
git config user.name "github-actions[bot]"
86+
git config user.email "github-actions[bot]@users.noreply.github.com"
87+
88+
- name: Extract version from release tag or input
89+
if: github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true'
90+
id: version
91+
run: |
92+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
93+
VERSION="${{ github.event.inputs.version }}"
94+
SET_LATEST="${{ github.event.inputs.set_latest }}"
95+
else
96+
# Extract version from release tag (v25.9.1-python -> 25.9.1 or v25.9.1.1-python -> 25.9.1.1)
97+
TAG_NAME="${{ github.event.release.tag_name }}"
98+
TAG_LOWER=$(echo "$TAG_NAME" | tr '[:upper:]' '[:lower:]')
99+
100+
# Verify tag contains 'python' (case-insensitive)
101+
if [[ ! "$TAG_LOWER" == *"python"* ]]; then
102+
echo "❌ Release tag should contain 'python' (case-insensitive), got: $TAG_NAME"
103+
exit 1
104+
fi
105+
106+
# Strip 'v' prefix and remove everything after and including '-python' or '-Python', etc.
107+
VERSION="${TAG_NAME#v}" # Remove 'v' prefix
108+
VERSION="${VERSION%%-[Pp][Yy][Tt][Hh][Oo][Nn]*}" # Remove '-python' suffix (case-insensitive)
109+
SET_LATEST="true"
110+
fi
111+
echo "version=$VERSION" >> $GITHUB_OUTPUT
112+
echo "set_latest=$SET_LATEST" >> $GITHUB_OUTPUT
113+
echo "📦 Deploying documentation version: $VERSION"
114+
115+
- name: Deploy with mike (set as latest)
116+
if: (github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true') && steps.version.outputs.set_latest == 'true'
117+
working-directory: bindings/python
118+
run: |
119+
mike deploy --push --update-aliases \
120+
${{ steps.version.outputs.version }} latest \
121+
--title "${{ steps.version.outputs.version }} (latest)"
122+
mike set-default --push latest
123+
124+
- name: Deploy with mike (not latest)
125+
if: (github.event_name != 'release' || steps.check-python-release.outputs.is-python-release == 'true') && steps.version.outputs.set_latest != 'true'
126+
working-directory: bindings/python
127+
run: |
128+
mike deploy --push \
129+
${{ steps.version.outputs.version }} \
130+
--title "${{ steps.version.outputs.version }}"
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
name: Build and Release Python Packages to PyPI
2+
3+
on:
4+
release:
5+
types: [published] # Trigger when GitHub Release is published
6+
# Release tag must match 'v*-python' (e.g., v3.0.5-python)
7+
8+
jobs:
9+
# Check if this is a Python release
10+
check-release:
11+
name: Validate Python Release Tag
12+
runs-on: ubuntu-latest
13+
outputs:
14+
is-python-release: ${{ steps.check.outputs.is-python-release }}
15+
steps:
16+
- name: Check if release tag contains 'python' (case-insensitive)
17+
id: check
18+
run: |
19+
TAG_NAME="${{ github.event.release.tag_name }}"
20+
TAG_LOWER=$(echo "$TAG_NAME" | tr '[:upper:]' '[:lower:]')
21+
22+
if [[ "$TAG_LOWER" == *"python"* ]]; then
23+
echo "✅ This is a Python release: $TAG_NAME"
24+
echo "is-python-release=true" >> $GITHUB_OUTPUT
25+
else
26+
echo "⏭️ Not a Python release (tag: $TAG_NAME), skipping workflow"
27+
echo "is-python-release=false" >> $GITHUB_OUTPUT
28+
fi
29+
30+
# Run tests first to ensure quality
31+
test:
32+
name: Run Tests Before Release
33+
needs: check-release
34+
if: needs.check-release.outputs.is-python-release == 'true'
35+
uses: ./.github/workflows/test-python-bindings.yml
36+
secrets: inherit
37+
38+
build:
39+
needs: test # Wait for tests to pass
40+
name: Build Python Distribution (${{ matrix.distribution }})
41+
runs-on: ubuntu-latest
42+
strategy:
43+
matrix:
44+
distribution: [headless, minimal, full]
45+
include:
46+
- distribution: headless
47+
environment: pypi-headless
48+
- distribution: minimal
49+
environment: pypi-minimal
50+
- distribution: full
51+
environment: pypi-full
52+
53+
steps:
54+
- name: Checkout code
55+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
56+
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
59+
60+
- name: Build ${{ matrix.distribution }} distribution
61+
run: |
62+
cd bindings/python
63+
./build-all.sh ${{ matrix.distribution }}
64+
65+
- name: Upload wheel artifact
66+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
67+
with:
68+
name: wheel-${{ matrix.distribution }}
69+
path: bindings/python/dist/*.whl
70+
retention-days: 5
71+
72+
publish-headless:
73+
name: Publish arcadedb-embedded-headless to PyPI
74+
needs: [check-release, build]
75+
if: needs.check-release.outputs.is-python-release == 'true'
76+
runs-on: ubuntu-latest
77+
environment: pypi-headless
78+
permissions:
79+
id-token: write
80+
steps:
81+
- name: Download headless wheel
82+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
83+
with:
84+
name: wheel-headless
85+
path: dist/
86+
- name: Publish to PyPI
87+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
88+
89+
publish-minimal:
90+
name: Publish arcadedb-embedded-minimal to PyPI
91+
needs: [check-release, build]
92+
if: needs.check-release.outputs.is-python-release == 'true'
93+
runs-on: ubuntu-latest
94+
environment: pypi-minimal
95+
permissions:
96+
id-token: write
97+
steps:
98+
- name: Download minimal wheel
99+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
100+
with:
101+
name: wheel-minimal
102+
path: dist/
103+
- name: Publish to PyPI
104+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1
105+
106+
publish-full:
107+
name: Publish arcadedb-embedded to PyPI
108+
needs: [check-release, build]
109+
if: needs.check-release.outputs.is-python-release == 'true'
110+
runs-on: ubuntu-latest
111+
environment: pypi-full
112+
permissions:
113+
id-token: write
114+
steps:
115+
- name: Download full wheel
116+
uses: actions/download-artifact@634f93cb2916e3fdff6788551b99b062d0335ce0 # v5.0.0
117+
with:
118+
name: wheel-full
119+
path: dist/
120+
- name: Publish to PyPI
121+
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e # release/v1

0 commit comments

Comments
 (0)