Update rich-module-switching-test.yml #14
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 🧠 TensorFlow Complex Dependency Switching Test | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ['main'] | |
| jobs: | |
| run-tensorflow-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| services: | |
| redis: | |
| image: redis:7 | |
| options: >- | |
| --health-cmd "redis-cli ping" | |
| --health-interval 10s | |
| --health-timeout 5s | |
| --health-retries 5 | |
| ports: | |
| - 6379:6379 | |
| steps: | |
| - name: 🏁 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🐍 Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: 📦 Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . redis tensorflow==2.13.0 | |
| - name: ⚙️ Configure omnipkg for non-interactive use | |
| run: | | |
| python - << 'EOF' | |
| import sys | |
| import site | |
| import json | |
| from pathlib import Path | |
| import os | |
| import sysconfig | |
| # Get site-packages path safely | |
| try: | |
| site_packages_path = site.getsitepackages()[0] | |
| except (IndexError, AttributeError): | |
| site_packages_path = sysconfig.get_paths()['purelib'] | |
| # Determine project root (where pyproject.toml is) | |
| project_root = Path(os.environ['GITHUB_WORKSPACE']) | |
| # Verify builder script exists | |
| builder_script = project_root / 'omnipkg' / 'package_meta_builder.py' | |
| if not builder_script.exists(): | |
| print(f"Error: {builder_script} does not exist") | |
| sys.exit(1) | |
| config_data = { | |
| 'site_packages_path': site_packages_path, | |
| 'multiversion_base': str(Path(site_packages_path) / '.omnipkg_versions'), | |
| 'python_executable': sys.executable, | |
| 'builder_script_path': str(builder_script), | |
| 'redis_host': 'localhost', | |
| 'redis_port': 6379, | |
| 'redis_key_prefix': 'omnipkg:pkg:', | |
| 'paths_to_index': [str(Path(sys.executable).parent), '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin'], | |
| 'auto_cleanup': True, | |
| 'cleanup_threshold_days': 30 | |
| } | |
| config_dir = Path.home() / '.config' / 'omnipkg' | |
| config_dir.mkdir(parents=True, exist_ok=True) | |
| config_path = config_dir / 'config.json' | |
| try: | |
| with open(config_path, 'w') as f: | |
| json.dump(config_data, f, indent=2) | |
| print(f'omnipkg config created at {config_path}:') | |
| print(json.dumps(config_data, indent=2)) | |
| except Exception as e: | |
| print(f"Error writing config: {e}") | |
| sys.exit(1) | |
| EOF | |
| - name: 🧪 Run the Demo - TensorFlow Test (Complex Dependencies) | |
| id: run_demo | |
| run: | | |
| echo "--- Running Omnipkg Demo for TensorFlow Test (Complex Dependencies) ---" | |
| mkdir -p /tmp/omnipkg-artifacts | |
| timeout 600 bash -c 'echo "4" | omnipkg demo 2>&1 | tee /tmp/omnipkg-artifacts/tensorflow_demo_output.txt' | |
| DEMO_EXIT_CODE=$? | |
| echo "## TensorFlow Demo Output" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/omnipkg-artifacts/tensorflow_demo_output.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| if [ $DEMO_EXIT_CODE -eq 0 ]; then | |
| echo "Demo completed successfully." | |
| echo "demo_outcome=success" >> $GITHUB_OUTPUT | |
| if grep -q "tensorflow==2.13.0" /tmp/omnipkg-artifacts/tensorflow_demo_output.txt && \ | |
| grep -q "typing_extensions==4.5.0" /tmp/omnipkg-artifacts/tensorflow_demo_output.txt && \ | |
| grep -q "ALL TENSORFLOW TESTS PASSED" /tmp/omnipkg-artifacts/tensorflow_demo_output.txt; then | |
| echo "TensorFlow demo verified: tensorflow==2.13.0, typing_extensions==4.5.0, and all tests passed!" | |
| else | |
| echo "Error: Expected TensorFlow demo output not found." | |
| echo "Missing one of: 'tensorflow==2.13.0', 'typing_extensions==4.5.0', or 'ALL TENSORFLOW TESTS PASSED'" | |
| cat /tmp/omnipkg-artifacts/tensorflow_demo_output.txt | |
| exit 1 | |
| fi | |
| else | |
| echo "Demo failed with exit code $DEMO_EXIT_CODE." | |
| echo "demo_outcome=failure" >> $GITHUB_OUTPUT | |
| cat /tmp/omnipkg-artifacts/tensorflow_demo_output.txt | |
| exit 1 | |
| fi | |
| - name: 📊 Check Omnipkg Status | |
| id: check_status | |
| run: | | |
| echo "--- Checking Omnipkg Status ---" | |
| mkdir -p /tmp/omnipkg-artifacts | |
| omnipkg status > /tmp/omnipkg-artifacts/status_output.txt | |
| echo "## Omnipkg Status Output" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| cat /tmp/omnipkg-artifacts/status_output.txt >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| if grep -q "tensorflow-2.13.0" /tmp/omnipkg-artifacts/status_output.txt && \ | |
| grep -q "typing_extensions-4.5.0" /tmp/omnipkg-artifacts/status_output.txt; then | |
| echo "Status verified: TensorFlow bubbles found!" | |
| else | |
| echo "Error: Expected TensorFlow bubbles not found in status output." | |
| cat /tmp/omnipkg-artifacts/status_output.txt | |
| exit 1 | |
| fi | |
| - name: 📊 Generate Report | |
| if: always() | |
| run: | | |
| REPORT_FILE="/tmp/omnipkg-artifacts/tensorflow_test_report.md" | |
| echo "# 🧠 TensorFlow Complex Dependency Switching Test Report" > $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "**Workflow Run:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $REPORT_FILE | |
| echo "**Test Status:** \`${{ job.status }}\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "## Demo Execution Output" >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| cat /tmp/omnipkg-artifacts/tensorflow_demo_output.txt 2>/dev/null || echo 'N/A: Demo output missing.' >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "## Omnipkg Status Output" >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| cat /tmp/omnipkg-artifacts/status_output.txt 2>/dev/null || echo 'N/A: Status output missing.' >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "## Conclusion" >> $REPORT_FILE | |
| if [ "${{ steps.run_demo.outputs.demo_outcome }}" == "success" ]; then | |
| echo "✅ **omnipkg successfully demonstrated seamless version switching for complex dependency packages (TensorFlow).** This test confirms omnipkg's ability to manage large, interconnected dependency graphs with high integrity." >> $REPORT_FILE | |
| else | |
| echo "❌ The TensorFlow Complex Dependency Switching Test failed. Review workflow logs for detailed output and errors." >> $REPORT_FILE | |
| fi | |
| echo "" >> $REPORT_FILE | |
| - name: 🧹 Clean Up Redis | |
| if: always() | |
| run: | | |
| echo "--- Cleaning Up Redis ---" | |
| redis-cli -h localhost -p 6379 KEYS "omnipkg:pkg:*" | xargs -r redis-cli -h localhost -p 6379 DEL | |
| - name: 📦 Upload Artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: omnipkg-tensorflow-outputs | |
| path: /tmp/omnipkg-artifacts/ | |
| retention-days: 30 | |
| compression-level: 6 |