Skip to content

Commit 4746290

Browse files
authored
Update rich-module-switching-test.yml
1 parent 36ac879 commit 4746290

1 file changed

Lines changed: 76 additions & 30 deletions

File tree

.github/workflows/rich-module-switching-test.yml

Lines changed: 76 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
1-
# .github/workflows/rich-module-switching-test.yml
21
name: 🧪 Rich Module Switching Test
32

43
on:
5-
workflow_dispatch: # Allows manual triggering
4+
workflow_dispatch:
65
push:
7-
branches: ['main'] # Runs on pushes to main
6+
branches: ['main']
87

98
jobs:
109
run-rich-test:
1110
runs-on: ubuntu-latest
1211
permissions:
13-
contents: write # Needed for checkout and uploading artifacts
14-
# id-token: write # Only if connecting to PyPI or other OIDC providers
15-
12+
contents: write
1613
services:
1714
redis:
1815
image: redis:7
@@ -33,10 +30,10 @@ jobs:
3330
with:
3431
python-version: '3.11'
3532

36-
- name: 📦 Install omnipkg (editable) and Redis client
33+
- name: 📦 Install dependencies
3734
run: |
3835
python -m pip install --upgrade pip
39-
pip install -e . redis # -e . installs in editable mode, pulling deps from pyproject.toml
36+
pip install -e . redis rich==13.7.1
4037
4138
- name: ⚙️ Configure omnipkg for non-interactive use
4239
run: |
@@ -46,19 +43,14 @@ jobs:
4643
import json
4744
from pathlib import Path
4845
import os
49-
import sysconfig # Added for robust site-packages path
46+
import sysconfig
5047
51-
# Get site-packages path safely
5248
try:
5349
site_packages_path = site.getsitepackages()[0]
5450
except (IndexError, AttributeError):
55-
# Fallback for some CI environments or unusual setups
5651
site_packages_path = sysconfig.get_paths()['purelib']
5752
58-
# Determine project root (where pyproject.toml is)
5953
project_root = Path(os.environ['GITHUB_WORKSPACE'])
60-
61-
# Verify builder script exists
6254
builder_script = project_root / 'omnipkg' / 'package_meta_builder.py'
6355
if not builder_script.exists():
6456
print(f"Error: {builder_script} does not exist")
@@ -91,48 +83,102 @@ jobs:
9183
sys.exit(1)
9284
EOF
9385
94-
- name: 🧪 Run the Demo: Rich Test (Python Module Switching)
86+
- name: 🧪 Run the Demo - Rich Test (Python Module Switching)
9587
id: run_demo
9688
run: |
9789
echo "--- Running Omnipkg Demo for Rich Test (Python Module Switching) ---"
9890
mkdir -p /tmp/omnipkg-artifacts
9991
100-
# Simulate user input '1' for Rich test, capture output, and limit runtime
101-
timeout 300 bash -c 'echo "1" | omnipkg demo 2>&1 | tee /tmp/omnipkg-artifacts/demo_output.txt'
92+
timeout 300 bash -c 'echo "1" | omnipkg demo 2>&1 | tee /tmp/omnipkg-artifacts/rich_demo_output.txt'
10293
DEMO_EXIT_CODE=$?
10394
10495
echo "## Rich Demo Output" >> $GITHUB_STEP_SUMMARY
10596
echo '```' >> $GITHUB_STEP_SUMMARY
106-
cat /tmp/omnipkg-artifacts/demo_output.txt >> $GITHUB_STEP_SUMMARY
97+
cat /tmp/omnipkg-artifacts/rich_demo_output.txt >> $GITHUB_STEP_SUMMARY
10798
echo '```' >> $GITHUB_STEP_SUMMARY
10899
109100
if [ $DEMO_EXIT_CODE -eq 0 ]; then
110101
echo "Demo completed successfully."
111102
echo "demo_outcome=success" >> $GITHUB_OUTPUT
112-
# Verify key Rich demo outputs
113-
if grep -q "ALL TESTS PASSED!" /tmp/omnipkg-artifacts/demo_output.txt && \
114-
grep -q "Imported and verified version 13.7.1" /tmp/omnipkg-artifacts/demo_output.txt && \
115-
grep -q "Testing Bubble (rich==13.5.3)" /tmp/omnipkg-artifacts/demo_output.txt && \
116-
grep -q "Testing Bubble (rich==13.4.2)" /tmp/omnipkg-artifacts/demo_output.txt; then
117-
echo "Rich demo verified: All tests passed, including main env and bubbles for 13.5.3 and 13.4.2."
103+
if grep -q "rich==13.7.1" /tmp/omnipkg-artifacts/rich_demo_output.txt && \
104+
grep -q "rich==13.5.3" /tmp/omnipkg-artifacts/rich_demo_output.txt && \
105+
grep -q "rich==13.4.2" /tmp/omnipkg-artifacts/rich_demo_output.txt && \
106+
grep -q "ALL TESTS PASSED!" /tmp/omnipkg-artifacts/rich_demo_output.txt; then
107+
echo "Rich demo verified: rich==13.7.1 (main), 13.5.3, 13.4.2 (bubbles), and all tests passed!"
118108
else
119109
echo "Error: Expected Rich demo output not found."
120-
echo "Missing one of: 'ALL TESTS PASSED!', 'Imported and verified version 13.7.1', 'Testing Bubble (rich==13.5.3)', or 'Testing Bubble (rich==13.4.2)'"
121-
cat /tmp/omnipkg-artifacts/demo_output.txt
110+
echo "Missing one of: 'rich==13.7.1', 'rich==13.5.3', 'rich==13.4.2', or 'ALL TESTS PASSED!'"
111+
cat /tmp/omnipkg-artifacts/rich_demo_output.txt
122112
exit 1
123113
fi
124114
else
125115
echo "Demo failed with exit code $DEMO_EXIT_CODE."
126116
echo "demo_outcome=failure" >> $GITHUB_OUTPUT
127-
cat /tmp/omnipkg-artifacts/demo_output.txt
117+
cat /tmp/omnipkg-artifacts/rich_demo_output.txt
118+
exit 1
119+
fi
120+
121+
- name: 📊 Check Omnipkg Status
122+
id: check_status
123+
run: |
124+
echo "--- Checking Omnipkg Status ---"
125+
mkdir -p /tmp/omnipkg-artifacts
126+
omnipkg status > /tmp/omnipkg-artifacts/status_output.txt
127+
echo "## Omnipkg Status Output" >> $GITHUB_STEP_SUMMARY
128+
echo '```' >> $GITHUB_STEP_SUMMARY
129+
cat /tmp/omnipkg-artifacts/status_output.txt >> $GITHUB_STEP_SUMMARY
130+
echo '```' >> $GITHUB_STEP_SUMMARY
131+
132+
if grep -q "rich-13.5.3" /tmp/omnipkg-artifacts/status_output.txt && \
133+
grep -q "rich-13.4.2" /tmp/omnipkg-artifacts/status_output.txt; then
134+
echo "Status verified: Rich bubbles found!"
135+
else
136+
echo "Error: Expected Rich bubbles not found in status output."
137+
cat /tmp/omnipkg-artifacts/status_output.txt
128138
exit 1
129139
fi
130140
131-
- name: 📦 Archive Demo Output
141+
- name: 📊 Generate Report
142+
if: always()
143+
run: |
144+
REPORT_FILE="/tmp/omnipkg-artifacts/rich_test_report.md"
145+
echo "# 🧪 Rich Module Switching Test Report" > $REPORT_FILE
146+
echo "" >> $REPORT_FILE
147+
echo "**Workflow Run:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $REPORT_FILE
148+
echo "**Test Status:** \`${{ job.status }}\`" >> $REPORT_FILE
149+
echo "" >> $REPORT_FILE
150+
151+
echo "## Demo Execution Output" >> $REPORT_FILE
152+
echo "\`\`\`" >> $REPORT_FILE
153+
cat /tmp/omnipkg-artifacts/rich_demo_output.txt 2>/dev/null || echo 'N/A: Demo output missing.' >> $REPORT_FILE
154+
echo "\`\`\`" >> $REPORT_FILE
155+
echo "" >> $REPORT_FILE
156+
157+
echo "## Omnipkg Status Output" >> $REPORT_FILE
158+
echo "\`\`\`" >> $REPORT_FILE
159+
cat /tmp/omnipkg-artifacts/status_output.txt 2>/dev/null || echo 'N/A: Status output missing.' >> $REPORT_FILE
160+
echo "\`\`\`" >> $REPORT_FILE
161+
echo "" >> $REPORT_FILE
162+
163+
echo "## Conclusion" >> $REPORT_FILE
164+
if [ "${{ steps.run_demo.outputs.demo_outcome }}" == "success" ]; then
165+
echo "✅ **omnipkg successfully demonstrated seamless version switching for Python module packages (Rich).** This test confirms omnipkg's ability to handle pure Python module dependencies with high integrity." >> $REPORT_FILE
166+
else
167+
echo "❌ The Rich Module Switching Test failed. Review workflow logs for detailed output and errors." >> $REPORT_FILE
168+
fi
169+
echo "" >> $REPORT_FILE
170+
171+
- name: 🧹 Clean Up Redis
172+
if: always()
173+
run: |
174+
echo "--- Cleaning Up Redis ---"
175+
redis-cli -h localhost -p 6379 KEYS "omnipkg:pkg:*" | xargs -r redis-cli -h localhost -p 6379 DEL
176+
177+
- name: 📦 Upload Artifacts
132178
if: always()
133179
uses: actions/upload-artifact@v4
134180
with:
135-
name: omnipkg-rich-demo-output
181+
name: omnipkg-rich-outputs
136182
path: /tmp/omnipkg-artifacts/
137-
retention-days: 7
183+
retention-days: 30
138184
compression-level: 6

0 commit comments

Comments
 (0)