fix: resolve translation shadowing, standardize safe_print, and refac… #1293
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: "🔍 Package Discovery Demo - Omnipkg Intelligence" | |
| on: | |
| push: | |
| branches: [ development ] | |
| pull_request: | |
| branches: [ development ] | |
| workflow_dispatch: | |
| jobs: | |
| package-discovery-demo: | |
| runs-on: ubuntu-latest | |
| 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 repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.11 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.11' | |
| - name: Install system dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y redis-tools expect | |
| redis-cli --version | |
| echo "Redis CLI installed successfully" | |
| - name: Wait for Redis to be ready | |
| run: | | |
| echo "⏳ Waiting for Redis service to be ready..." | |
| for i in {1..30}; do | |
| if redis-cli -h localhost -p 6379 ping > /dev/null 2>&1; then | |
| echo "✅ Redis is ready!" | |
| break | |
| fi | |
| echo "🔄 Attempt $i/30: Redis not ready yet, waiting..." | |
| sleep 2 | |
| done | |
| # Final check | |
| redis-cli -h localhost -p 6379 ping || { | |
| echo "❌ Redis failed to start properly" | |
| exit 1 | |
| } | |
| - name: Install omnipkg | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . redis | |
| - name: Configure omnipkg for CI environment | |
| run: | | |
| python - << 'EOF' | |
| import sys | |
| import site | |
| import json | |
| from pathlib import Path | |
| import os | |
| import sysconfig | |
| try: | |
| site_packages_path = site.getsitepackages()[0] | |
| except (IndexError, AttributeError): | |
| site_packages_path = sysconfig.get_paths()['purelib'] | |
| project_root = Path(os.environ['GITHUB_WORKSPACE']) | |
| builder_script = project_root / 'src' / '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'], | |
| '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}') | |
| EOF | |
| - name: "🎯 Demo: Install TensorBoard with omnipkg" | |
| run: | | |
| echo "============================================================" | |
| echo "🚀 STEP 1: Installing TensorBoard using omnipkg" | |
| echo "============================================================" | |
| omnipkg install tensorboard | |
| echo "" | |
| echo "✅ TensorBoard installation complete!" | |
| - name: "📊 Demo: Get comprehensive package information" | |
| run: | | |
| echo "============================================================" | |
| echo "🔍 STEP 2: Discovering package intelligence with omnipkg info" | |
| echo "============================================================" | |
| # Test Redis connection first | |
| echo "🔧 Testing Redis connection..." | |
| redis-cli -h localhost -p 6379 ping || echo "Redis ping failed" | |
| # Run omnipkg info in non-interactive mode. | |
| # We don't need expect because we just want to prove the command runs | |
| # and outputs the summary data. | |
| echo "📋 Running: omnipkg info tensorboard" | |
| omnipkg info tensorboard | |
| - name: "🗄️ Demo: Direct Redis data access" | |
| run: | | |
| echo "============================================================" | |
| echo "💾 STEP 3: Raw package metadata from Redis" | |
| echo "============================================================" | |
| # Dynamically find the instance-aware key for tensorboard | |
| REDIS_KEY=$(redis-cli -h localhost -p 6379 KEYS "*tensorboard*" | grep "inst:tensorboard" | head -n 1) | |
| if [ -z "$REDIS_KEY" ]; then | |
| echo "❌ Could not find tensorboard key in Redis. Dumping all keys:" | |
| redis-cli -h localhost -p 6379 KEYS "*" | |
| exit 1 | |
| fi | |
| echo "🔑 Found dynamic Redis key: $REDIS_KEY" | |
| # Export it so subsequent steps can use it! | |
| echo "REDIS_KEY=$REDIS_KEY" >> $GITHUB_ENV | |
| echo "" | |
| VERSION=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" Version) | |
| echo "🏷️ Found version: $VERSION" | |
| echo "" | |
| echo "📦 Complete metadata for tensorboard v$VERSION:" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| redis-cli -h localhost -p 6379 HGETALL "$REDIS_KEY" | |
| - name: "🛡️ Demo: Security & Health Analysis" | |
| run: | | |
| echo "============================================================" | |
| echo "🔒 STEP 4: Package Security & Health Intelligence" | |
| echo "============================================================" | |
| echo "🔍 Security Analysis Results:" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| # Extract security information using the dynamic key | |
| SECURITY_ISSUES=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" security.issues_found) | |
| AUDIT_STATUS=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" security.audit_status) | |
| IMPORTABLE=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" health.import_check.importable) | |
| IMPORT_VERSION=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" health.import_check.version) | |
| echo "🛡️ Security Issues Found: $SECURITY_ISSUES" | |
| echo "✅ Security Audit Status: $AUDIT_STATUS" | |
| echo "📦 Package Importable: $IMPORTABLE" | |
| echo "🏷️ Import Check Version: $IMPORT_VERSION" | |
| echo "" | |
| echo "⚙️ Binary Analysis Results:" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| BINARY_EXISTS=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" health.binary_checks.tensorboard.exists 2>/dev/null || echo "N/A") | |
| BINARY_SIZE=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" health.binary_checks.tensorboard.size 2>/dev/null || echo "N/A") | |
| VALID_SHEBANG=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" health.binary_checks.tensorboard.valid_shebang 2>/dev/null || echo "N/A") | |
| echo "📁 Binary Exists: $BINARY_EXISTS" | |
| echo "📏 Binary Size: $BINARY_SIZE bytes" | |
| echo "📝 Valid Shebang: $VALID_SHEBANG" | |
| - name: "🎨 Demo: Dependency Analysis" | |
| run: | | |
| echo "============================================================" | |
| echo "🔗 STEP 5: Advanced Dependency Intelligence" | |
| echo "============================================================" | |
| echo "📋 Analyzing tensorboard dependencies..." | |
| echo "" | |
| # Get and format dependencies | |
| DEPENDENCIES=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" dependencies) | |
| echo "🔗 Runtime Dependencies:" | |
| echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" | |
| # Parse and display dependencies in a readable format | |
| echo "$DEPENDENCIES" | sed 's/\[//g' | sed 's/\]//g' | sed 's/", "/\n/g' | sed 's/"//g' | while read -r dep; do | |
| if [ ! -z "$dep" ]; then | |
| echo " 📦 $dep" | |
| fi | |
| done | |
| echo "" | |
| PYTHON_REQ=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" Requires-Python) | |
| echo "🐍 Python Version Requirement: $PYTHON_REQ" | |
| KEYWORDS=$(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" Keywords) | |
| echo "🏷️ Package Keywords: $KEYWORDS" | |
| - name: "📈 Summary: Package Intelligence Report" | |
| run: | | |
| echo "============================================================" | |
| echo "🎉 OMNIPKG PACKAGE DISCOVERY DEMO COMPLETE" | |
| echo "============================================================" | |
| echo "" | |
| echo "✨ What we discovered about tensorboard:" | |
| echo "" | |
| echo "🔍 PACKAGE OVERVIEW:" | |
| echo " • Name: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" Name)" | |
| echo " • Version: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" Version)" | |
| echo " • Author: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" Author)" | |
| echo " • License: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" License)" | |
| echo "" | |
| echo "🛡️ SECURITY & HEALTH:" | |
| echo " • Security Issues: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" security.issues_found) found" | |
| echo " • Import Status: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" health.import_check.importable)" | |
| echo " • Audit Status: $(redis-cli -h localhost -p 6379 HGET "$REDIS_KEY" security.audit_status)" | |
| echo "" | |
| echo "💾 DATA PERSISTENCE:" | |
| echo " • All metadata stored in Redis (Key: $REDIS_KEY)" | |
| echo " • Queryable via redis-cli commands" | |
| echo " • Accessible through omnipkg API" | |
| - name: Archive Demo Results | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: omnipkg-package-discovery-demo | |
| path: | | |
| /tmp/omnipkg-artifacts/ | |
| retention-days: 7 |