Create test-tensorflow-switching.yml #1
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
| # .github/workflows/test-tensorflow-switching.yml | ||
| name: 🧠 TensorFlow Complex Dependency Switching Test | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: ['main'] | ||
| jobs: | ||
| run-tensorflow-test: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: write | ||
| 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 Redis for omnipkg | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y redis-server | ||
| sudo systemctl start redis-server | ||
| redis-cli ping | ||
| - name: 📦 Install omnipkg (editable) | ||
| run: | | ||
| python -m pip install --upgrade pip | ||
| pip install -e . | ||
| - name: ⚙️ Configure omnipkg for non-interactive use | ||
| run: | | ||
| python - << 'EOF' | ||
| import sys | ||
| import site | ||
| import json | ||
| from pathlib import Path | ||
| import os | ||
| site_packages_path = site.getsitepackages()[0] | ||
| project_root = Path(os.environ['GITHUB_WORKSPACE']) | ||
| 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(project_root / 'omnipkg' / 'package_meta_builder.py'), | ||
| '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' | ||
| 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)) | ||
| EOF | ||
| - name: 🧪 Run the Demo: TensorFlow Test (Complex Dependencies) | ||
| id: run_demo | ||
| run: | | ||
| echo "--- Running Omnipkg Demo for TensorFlow Test (Complex Dependencies) ---" | ||
| # Simulate user input '4' for TensorFlow test | ||
| DEMO_OUTPUT=$(echo "4" | omnipkg demo 2>&1) | ||
| DEMO_EXIT_CODE=$? | ||
| echo "$DEMO_OUTPUT" > /tmp/demo_output.txt | ||
| if [ $DEMO_EXIT_CODE -eq 0 ]; then | ||
| echo "demo_outcome=success" >> $GITHUB_OUTPUT | ||
| echo "Demo completed successfully." | ||
| else | ||
| echo "demo_outcome=failure" >> $GITHUB_OUTPUT | ||
| echo "Demo failed with exit code $DEMO_EXIT_CODE." | ||
| echo "$DEMO_OUTPUT" # Output to job log on failure | ||
| exit 1 | ||
| fi | ||
| - name: 📊 Generate Report | ||
| if: always() | ||
| run: | | ||
| REPORT_FILE="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/demo_output.txt 2>/dev/null || echo 'N/A: Demo 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: 📤 Upload Report Artifact | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: tensorflow-test-report | ||
| path: tensorflow_test_report.md | ||
| retention-days: 30 | ||