@@ -44,58 +44,120 @@ jobs:
4444 python -m pip install --upgrade pip
4545 pip install -e . redis tensorflow==2.13.0
4646
47- - name : Configure omnipkg
47+ - name : Configure omnipkg for non-interactive use
4848 run : |
49- python -c "
50- import json, os, sys, site, sysconfig
49+ python - << 'EOF'
50+ import sys
51+ import site
52+ import json
5153 from pathlib import Path
54+ import os
55+ import sysconfig
56+
57+ try:
58+ site_packages_path = site.getsitepackages()[0]
59+ except (IndexError, AttributeError):
60+ site_packages_path = sysconfig.get_paths()['purelib']
61+
62+ project_root = Path(os.environ['GITHUB_WORKSPACE'])
5263
53- site_packages = site.getsitepackages()[0] if site.getsitepackages() else sysconfig.get_paths()['purelib']
54- project_root = Path('.').resolve()
55-
56- config = {
57- 'cache_dir': str(project_root / '.omnipkg_cache'),
58- 'metadata_cache_dir': str(project_root / '.omnipkg_metadata'),
59- 'site_packages': site_packages,
64+ builder_script = project_root / 'omnipkg' / 'package_meta_builder.py'
65+ if not builder_script.exists():
66+ print(f"Error: {builder_script} does not exist")
67+ sys.exit(1)
68+
69+ config_data = {
70+ 'site_packages_path': site_packages_path,
71+ 'multiversion_base': str(Path(site_packages_path) / '.omnipkg_versions'),
6072 'python_executable': sys.executable,
61- 'redis_url': 'redis://localhost:6379',
62- 'enable_redis': True
73+ 'builder_script_path': str(builder_script),
74+ 'redis_host': 'localhost',
75+ 'redis_port': 6379,
76+ 'redis_key_prefix': 'omnipkg:pkg:',
77+ 'paths_to_index': [str(Path(sys.executable).parent), '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin'],
78+ 'auto_cleanup': True,
79+ 'cleanup_threshold_days': 30
6380 }
81+
82+ config_dir = Path.home() / '.config' / 'omnipkg'
83+ config_dir.mkdir(parents=True, exist_ok=True)
84+ config_path = config_dir / 'config.json'
6485
65- config_path = project_root / '.omnipkg' / 'config.json'
66- config_path.parent.mkdir(exist_ok=True)
67- config_path.write_text(json.dumps(config, indent=2))
68- print(f'Config written to: {config_path}')
69- "
86+ try:
87+ with open(config_path, 'w') as f:
88+ json.dump(config_data, f, indent=2)
89+ print(f'omnipkg config created at {config_path}:')
90+ print(json.dumps(config_data, indent=2))
91+ except Exception as e:
92+ print(f"Error writing config: {e}")
93+ sys.exit(1)
94+ EOF
7095
7196 - name : Test multi-version capability
7297 run : |
73- if pip install tensorflow==2.12.0 --target .omnipkg_cache/tensorflow-2.12.0 --no-deps --force-reinstall; then
74- echo "✅ Successfully installed multiple TensorFlow versions"
75- echo "OMNIPKG_TENSORFLOW=SUCCESS" >> $GITHUB_ENV
76-
77- # Verify both versions are accessible
78- python -c "
79- from omnipkg.loader import omnipkgLoader
80- from omnipkg.core import ConfigManager
98+ echo "--- Testing Multi-Version TensorFlow Capability ---"
99+ mkdir -p /tmp/omnipkg-artifacts
81100
82- config = ConfigManager().config
101+ # Test the multi-version capability directly
102+ timeout 600 python - << 'EOF' 2>&1 | tee /tmp/omnipkg-artifacts/tensorflow_test_output.txt
103+ timeout 600 python - << 'EOF' 2>&1 | tee /tmp/omnipkg-artifacts/tensorflow_test_output.txt
104+ import sys
105+ import subprocess
83106
84- # Test accessing older version
85- with omnipkgLoader('tensorflow==2.12.0', config=config):
86- import tensorflow as tf_old
87- print(f'Isolated TensorFlow: {tf_old.version}')
107+ print("=== Installing TensorFlow 2.12.0 for testing ===")
108+ try:
109+ subprocess.run([sys.executable, "-m", "pip", "install", "tensorflow==2.12.0", "--target", "/tmp/tf_2_12_0", "--no-deps", "--force-reinstall"], check=True)
110+ print("✅ TensorFlow 2.12.0 installed successfully")
111+ except subprocess.CalledProcessError as e:
112+ print(f"❌ Failed to install TensorFlow 2.12.0: {e}")
113+ sys.exit(1)
88114
89- # Main environment version
90- import tensorflow as tf_main
91- print(f'Main environment TensorFlow: {tf_main.version}')
115+ print("\n=== Testing omnipkg multi-version loading ===")
116+ try:
117+ from omnipkg.loader import omnipkgLoader
118+ from omnipkg.core import ConfigManager
119+
120+ config = ConfigManager().config
121+ print(f"✅ omnipkg config loaded: {config}")
122+
123+ # Test accessing older version
124+ print("\n--- Testing isolated TensorFlow 2.12.0 ---")
125+ with omnipkgLoader('tensorflow==2.12.0', config=config):
126+ import tensorflow as tf_old
127+ print(f'✅ Isolated TensorFlow version: {tf_old.__version__}')
128+
129+ # Main environment version
130+ print("\n--- Testing main environment TensorFlow ---")
131+ import tensorflow as tf_main
132+ print(f'✅ Main environment TensorFlow version: {tf_main.__version__}')
133+
134+ if tf_old.__version__ != tf_main.__version__:
135+ print('🎉 SUCCESS: Both TensorFlow versions accessible in same environment!')
136+ print('OMNIPKG MULTI-VERSION TEST PASSED!')
137+ else:
138+ print('❌ FAILED: Versions are the same, no isolation occurred')
139+ sys.exit(1)
140+
141+ except Exception as e:
142+ print(f"❌ omnipkg test failed: {e}")
143+ import traceback
144+ traceback.print_exc()
145+ sys.exit(1)
146+ EOF
92147
93- print('✅ Both TensorFlow versions accessible in same environment')
94- "
148+ TEST_EXIT_CODE=$?
149+
150+ echo "## TensorFlow Multi-Version Test Output" >> $GITHUB_STEP_SUMMARY
151+ echo '```' >> $GITHUB_STEP_SUMMARY
152+ cat /tmp/omnipkg-artifacts/tensorflow_test_output.txt >> $GITHUB_STEP_SUMMARY
153+ echo '```' >> $GITHUB_STEP_SUMMARY
154+
155+ if [ $TEST_EXIT_CODE -eq 0 ] && grep -q "OMNIPKG MULTI-VERSION TEST PASSED!" /tmp/omnipkg-artifacts/tensorflow_test_output.txt; then
156+ echo "✅ Multi-version test completed successfully"
157+ echo "OMNIPKG_TENSORFLOW=SUCCESS" >> $GITHUB_ENV
95158 else
96- echo "❌ Failed to install multiple TensorFlow versions "
159+ echo "❌ Multi-version test failed "
97160 echo "OMNIPKG_TENSORFLOW=FAILED" >> $GITHUB_ENV
98- fi
99161
100162 - name : Compare with standard pip behavior
101163 run : |
@@ -140,16 +202,11 @@ jobs:
140202 echo "| standard pip | TensorFlow 2.13.0 → 2.12.0 | ${{ env.PIP_TENSORFLOW }} |" >> results.md
141203 echo "| uv pip | TensorFlow 2.13.0 → 2.12.0 | ${{ env.UV_TENSORFLOW }} |" >> results.md
142204
143- - name : Update repository with results
144- run : |
145- if [[ "${{ env.OMNIPKG_TENSORFLOW }}" == "SUCCESS" ]]; then
146- git config --local user.email "action@github.com"
147- git config --local user.name "GitHub Action"
148- git add results.md
149- git commit -m "Update multi-version capability results - $(date -u '+%Y-%m-%d %H:%M UTC')"
150- git push || {
151- echo "Push failed, attempting rebase and retry..."
152- git pull --rebase origin main || true
153- git push
154- }
155- fi
205+ - name : Archive Test Output
206+ if : always()
207+ uses : actions/upload-artifact@v4
208+ with :
209+ name : omnipkg-tensorflow-test-output
210+ path : /tmp/omnipkg-artifacts/
211+ retention-days : 7
212+ compression-level : 6
0 commit comments