Skip to content

Fix CI/CD issues: artifact names and Docker cross-compilation #53

Fix CI/CD issues: artifact names and Docker cross-compilation

Fix CI/CD issues: artifact names and Docker cross-compilation #53

name: Test Python Bindings
on:
# Run on any push to any branch
push:
# Run on any pull request
pull_request:
# Allow being called by other workflows (e.g., release workflow)
workflow_call:
# Allow manual trigger
workflow_dispatch:
jobs:
test:
name: Test arcadedb-embedded (${{ matrix.platform }})
runs-on: ubuntu-latest
strategy:
# Don't cancel other matrix jobs if one fails
fail-fast: false
matrix:
platform: [linux/amd64, linux/arm64, darwin/amd64, darwin/arm64, windows/amd64]
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- name: Set up QEMU (for ARM64 emulation)
if: matrix.platform == 'linux/arm64'
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
- name: Build and test arcadedb-embedded (${{ matrix.platform }})
run: |
cd bindings/python
echo "πŸ”¨ Building arcadedb-embedded for ${{ matrix.platform }}..."
./build.sh ${{ matrix.platform }}
- name: Extract wheel for additional testing
run: |
cd bindings/python
mkdir -p test-install
cp dist/*.whl test-install/
- name: Set up Python for host testing
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
with:
python-version: '3.11'
# Note: Java is NOT required for arcadedb-embedded (JRE is bundled)
# This package works without any external Java installation!
- name: Install wheel and test dependencies
run: |
cd bindings/python
pip install test-install/*.whl pytest pytest-cov requests
- name: Run pytest on host
id: pytest
run: |
cd bindings/python
echo "πŸ§ͺ Testing arcadedb-embedded (with bundled JRE)..."
# Run pytest with verbose output
pytest tests/ -v --tb=short --color=yes 2>&1 | tee pytest-output.txt
# Check results
if grep -q "failed" pytest-output.txt; then
echo "❌ Tests FAILED"
exit 1
elif grep -q "passed" pytest-output.txt || grep -q "skipped" pytest-output.txt; then
echo "βœ… Tests PASSED"
# Count results
PASSED=$(grep -oP '\d+(?= passed)' pytest-output.txt || echo "0")
SKIPPED=$(grep -oP '\d+(?= skipped)' pytest-output.txt || echo "0")
FAILED=$(grep -oP '\d+(?= failed)' pytest-output.txt || echo "0")
echo "passed=$PASSED" >> $GITHUB_OUTPUT
echo "skipped=$SKIPPED" >> $GITHUB_OUTPUT
echo "failed=$FAILED" >> $GITHUB_OUTPUT
# Exit with error if any failures
if [ "$FAILED" != "0" ]; then
exit 1
fi
else
echo "⚠️ Unexpected test output"
exit 1
fi
- name: Generate test summary
if: always()
run: |
cd bindings/python
echo "## πŸ§ͺ Test Results: arcadedb-embedded (${{ matrix.platform }})" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ steps.pytest.outcome }}" = "success" ]; then
echo "βœ… **Status**: PASSED" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Status**: FAILED" >> $GITHUB_STEP_SUMMARY
fi
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Metric | Count |" >> $GITHUB_STEP_SUMMARY
echo "|--------|-------|" >> $GITHUB_STEP_SUMMARY
echo "| βœ… Passed | ${{ steps.pytest.outputs.passed || 'N/A' }} |" >> $GITHUB_STEP_SUMMARY
echo "| ⏭️ Skipped | ${{ steps.pytest.outputs.skipped || 'N/A' }} |" >> $GITHUB_STEP_SUMMARY
echo "| ❌ Failed | ${{ steps.pytest.outputs.failed || 'N/A' }} |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Package Info:" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- **Package**: arcadedb-embedded (~160MB)" >> $GITHUB_STEP_SUMMARY
echo "- **JRE**: Bundled (no Java installation required)" >> $GITHUB_STEP_SUMMARY
echo "- **Features**: All ArcadeDB features except gRPC wire protocol" >> $GITHUB_STEP_SUMMARY
- name: Upload test results
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: test-results-${{ matrix.platform == 'linux/amd64' && 'linux-amd64' || matrix.platform == 'linux/arm64' && 'linux-arm64' || matrix.platform == 'darwin/amd64' && 'darwin-amd64' || matrix.platform == 'darwin/arm64' && 'darwin-arm64' || 'windows-amd64' }}
path: |
bindings/python/pytest-output.txt
bindings/python/.coverage
retention-days: 7
- name: Upload wheel artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: wheel-${{ matrix.platform }}-test
path: bindings/python/dist/*.whl
retention-days: 7
# Summary job that checks all platforms
test-summary:
name: Test Summary
needs: test
runs-on: ubuntu-latest
if: always()
steps:
- name: Check test results
run: |
echo "## 🎯 Overall Test Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
if [ "${{ needs.test.result }}" = "success" ]; then
echo "βœ… **All platforms passed testing!**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The arcadedb-embedded package has been successfully built and tested." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Package**: arcadedb-embedded (~160MB with bundled JRE)" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Some platforms failed testing**" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Please check the individual test jobs for details." >> $GITHUB_STEP_SUMMARY
exit 1
fi