fix: resolve CI failures across all GitHub Actions workflows
- Fix ruff format issue in doc_scraper.py - Add pytest skip markers for browser renderer tests when Playwright is not installed in CI - Replace broken Python heredocs in 4 workflow YAML files (scheduled-updates, vector-db-export, quality-metrics, test-vector-dbs) with python3 -c calls to fix YAML parsing errors Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
61
.github/workflows/quality-metrics.yml
vendored
61
.github/workflows/quality-metrics.yml
vendored
@@ -88,48 +88,43 @@ jobs:
|
||||
echo "🔍 Analyzing $SKILL_NAME..."
|
||||
|
||||
# Run quality analysis
|
||||
python3 << 'EOF' "$skill_dir" "$THRESHOLD" "$SKILL_NAME"
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, 'src')
|
||||
python3 -c "
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
from skill_seekers.cli.quality_metrics import QualityAnalyzer
|
||||
from skill_seekers.cli.quality_metrics import QualityAnalyzer
|
||||
|
||||
skill_dir = Path(sys.argv[1])
|
||||
threshold = float(sys.argv[2])
|
||||
skill_name = sys.argv[3]
|
||||
skill_dir = Path('$skill_dir')
|
||||
threshold = float('$THRESHOLD')
|
||||
skill_name = '$SKILL_NAME'
|
||||
|
||||
analyzer = QualityAnalyzer(skill_dir)
|
||||
report = analyzer.generate_report()
|
||||
analyzer = QualityAnalyzer(skill_dir)
|
||||
report = analyzer.generate_report()
|
||||
|
||||
# Print formatted report
|
||||
formatted = analyzer.format_report(report)
|
||||
print(formatted)
|
||||
formatted = analyzer.format_report(report)
|
||||
print(formatted)
|
||||
|
||||
# Save individual report
|
||||
with open(f'quality_{skill_name}.txt', 'w') as f:
|
||||
f.write(formatted)
|
||||
with open(f'quality_{skill_name}.txt', 'w') as f:
|
||||
f.write(formatted)
|
||||
|
||||
# Add to summary
|
||||
score = report.overall_score.total_score
|
||||
grade = report.overall_score.grade
|
||||
status = "✅" if score >= threshold else "❌"
|
||||
score = report.overall_score.total_score
|
||||
grade = report.overall_score.grade
|
||||
status = 'PASS' if score >= threshold else 'FAIL'
|
||||
|
||||
summary_line = f"{status} **{skill_name}**: {grade} ({score:.1f}/100)"
|
||||
print(f"\n{summary_line}")
|
||||
summary_line = f'{status} **{skill_name}**: {grade} ({score:.1f}/100)'
|
||||
print(f'\n{summary_line}')
|
||||
|
||||
with open('quality_summary.md', 'a') as f:
|
||||
f.write(f"{summary_line}\n")
|
||||
with open('quality_summary.md', 'a') as f:
|
||||
f.write(f'{summary_line}\n')
|
||||
|
||||
# Set metrics as annotations
|
||||
if score < threshold:
|
||||
print(f"::error file={skill_dir}/SKILL.md::Quality score {score:.1f} is below threshold {threshold}")
|
||||
sys.exit(1)
|
||||
elif score < 80:
|
||||
print(f"::warning file={skill_dir}/SKILL.md::Quality score {score:.1f} could be improved")
|
||||
else:
|
||||
print(f"::notice file={skill_dir}/SKILL.md::Quality score {score:.1f} - Excellent!")
|
||||
EOF
|
||||
if score < threshold:
|
||||
print(f'::error file={skill_dir}/SKILL.md::Quality score {score:.1f} is below threshold {threshold}')
|
||||
sys.exit(1)
|
||||
elif score < 80:
|
||||
print(f'::warning file={skill_dir}/SKILL.md::Quality score {score:.1f} could be improved')
|
||||
else:
|
||||
print(f'::notice file={skill_dir}/SKILL.md::Quality score {score:.1f} - Excellent!')
|
||||
"
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
ALL_PASSED=false
|
||||
|
||||
70
.github/workflows/scheduled-updates.yml
vendored
70
.github/workflows/scheduled-updates.yml
vendored
@@ -86,32 +86,28 @@ jobs:
|
||||
SKILL_DIR="output/$FRAMEWORK"
|
||||
|
||||
# Detect changes using incremental updater
|
||||
python3 << 'EOF'
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, 'src')
|
||||
python3 -c "
|
||||
import sys, os
|
||||
from pathlib import Path
|
||||
|
||||
from skill_seekers.cli.incremental_updater import IncrementalUpdater
|
||||
import os
|
||||
from skill_seekers.cli.incremental_updater import IncrementalUpdater
|
||||
|
||||
framework = os.environ['FRAMEWORK']
|
||||
skill_dir = Path(f'output/{framework}')
|
||||
framework = os.environ['FRAMEWORK']
|
||||
skill_dir = Path(f'output/{framework}')
|
||||
|
||||
updater = IncrementalUpdater(skill_dir)
|
||||
changes = updater.detect_changes()
|
||||
updater = IncrementalUpdater(skill_dir)
|
||||
changes = updater.detect_changes()
|
||||
|
||||
if changes.has_changes:
|
||||
print(f"🔄 Changes detected:")
|
||||
print(f" Added: {len(changes.added)}")
|
||||
print(f" Modified: {len(changes.modified)}")
|
||||
print(f" Deleted: {len(changes.deleted)}")
|
||||
|
||||
# Save current versions for next run
|
||||
updater.current_versions = updater._scan_documents()
|
||||
updater.save_current_versions()
|
||||
else:
|
||||
print("✓ No changes detected, skill is up to date")
|
||||
EOF
|
||||
if changes.has_changes:
|
||||
print(f'Changes detected:')
|
||||
print(f' Added: {len(changes.added)}')
|
||||
print(f' Modified: {len(changes.modified)}')
|
||||
print(f' Deleted: {len(changes.deleted)}')
|
||||
updater.current_versions = updater._scan_documents()
|
||||
updater.save_current_versions()
|
||||
else:
|
||||
print('No changes detected, skill is up to date')
|
||||
"
|
||||
|
||||
- name: Full scrape (if new or manual)
|
||||
if: steps.should_update.outputs.update == 'true' && steps.check_existing.outputs.exists == 'false'
|
||||
@@ -140,26 +136,24 @@ EOF
|
||||
|
||||
echo "📊 Generating quality metrics..."
|
||||
|
||||
python3 << 'EOF'
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, 'src')
|
||||
python3 -c "
|
||||
import sys, os
|
||||
from pathlib import Path
|
||||
|
||||
from skill_seekers.cli.quality_metrics import QualityAnalyzer
|
||||
from skill_seekers.cli.quality_metrics import QualityAnalyzer
|
||||
|
||||
framework = os.environ['FRAMEWORK']
|
||||
skill_dir = Path(f'output/{framework}')
|
||||
framework = os.environ['FRAMEWORK']
|
||||
skill_dir = Path(f'output/{framework}')
|
||||
|
||||
analyzer = QualityAnalyzer(skill_dir)
|
||||
report = analyzer.generate_report()
|
||||
analyzer = QualityAnalyzer(skill_dir)
|
||||
report = analyzer.generate_report()
|
||||
|
||||
print(f"\n📊 Quality Score: {report.overall_score.grade} ({report.overall_score.total_score:.1f}/100)")
|
||||
print(f" Completeness: {report.overall_score.completeness:.1f}%")
|
||||
print(f" Accuracy: {report.overall_score.accuracy:.1f}%")
|
||||
print(f" Coverage: {report.overall_score.coverage:.1f}%")
|
||||
print(f" Health: {report.overall_score.health:.1f}%")
|
||||
EOF
|
||||
print(f'Quality Score: {report.overall_score.grade} ({report.overall_score.total_score:.1f}/100)')
|
||||
print(f' Completeness: {report.overall_score.completeness:.1f}%')
|
||||
print(f' Accuracy: {report.overall_score.accuracy:.1f}%')
|
||||
print(f' Coverage: {report.overall_score.coverage:.1f}%')
|
||||
print(f' Health: {report.overall_score.health:.1f}%')
|
||||
"
|
||||
|
||||
- name: Package for Claude
|
||||
if: steps.should_update.outputs.update == 'true'
|
||||
|
||||
28
.github/workflows/test-vector-dbs.yml
vendored
28
.github/workflows/test-vector-dbs.yml
vendored
@@ -63,23 +63,17 @@ jobs:
|
||||
echo "# Reference" > test_skill/references/ref.md
|
||||
|
||||
# Test adaptor packaging
|
||||
python3 << 'EOF'
|
||||
import sys
|
||||
import os
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, 'src')
|
||||
|
||||
from skill_seekers.cli.adaptors import get_adaptor
|
||||
|
||||
adaptor_name = os.environ['ADAPTOR_NAME']
|
||||
adaptor = get_adaptor(adaptor_name)
|
||||
package_path = adaptor.package(Path('test_skill'), Path('.'))
|
||||
print(f"✅ Package created: {package_path}")
|
||||
|
||||
# Verify package exists
|
||||
assert package_path.exists(), "Package file not created"
|
||||
print(f"📦 Package size: {package_path.stat().st_size} bytes")
|
||||
EOF
|
||||
python3 -c "
|
||||
import os
|
||||
from pathlib import Path
|
||||
from skill_seekers.cli.adaptors import get_adaptor
|
||||
adaptor_name = os.environ['ADAPTOR_NAME']
|
||||
adaptor = get_adaptor(adaptor_name)
|
||||
package_path = adaptor.package(Path('test_skill'), Path('.'))
|
||||
print(f'Package created: {package_path}')
|
||||
assert package_path.exists(), 'Package file not created'
|
||||
print(f'Package size: {package_path.stat().st_size} bytes')
|
||||
"
|
||||
|
||||
- name: Upload test package
|
||||
uses: actions/upload-artifact@v3
|
||||
|
||||
40
.github/workflows/vector-db-export.yml
vendored
40
.github/workflows/vector-db-export.yml
vendored
@@ -106,16 +106,12 @@ jobs:
|
||||
echo "🔹 Exporting to $target..."
|
||||
|
||||
# Use adaptor directly via CLI
|
||||
python -c "
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, 'src')
|
||||
|
||||
from skill_seekers.cli.adaptors import get_adaptor
|
||||
|
||||
adaptor = get_adaptor('$target')
|
||||
package_path = adaptor.package(Path('$SKILL_DIR'), Path('output'))
|
||||
print(f'✅ Exported to {package_path}')
|
||||
python3 -c "
|
||||
from pathlib import Path
|
||||
from skill_seekers.cli.adaptors import get_adaptor
|
||||
adaptor = get_adaptor('$target')
|
||||
package_path = adaptor.package(Path('$SKILL_DIR'), Path('output'))
|
||||
print(f'Exported to {package_path}')
|
||||
"
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
@@ -133,21 +129,15 @@ print(f'✅ Exported to {package_path}')
|
||||
if [ -d "$SKILL_DIR" ]; then
|
||||
echo "📊 Generating quality metrics..."
|
||||
|
||||
python -c "
|
||||
import sys
|
||||
from pathlib import Path
|
||||
sys.path.insert(0, 'src')
|
||||
|
||||
from skill_seekers.cli.quality_metrics import QualityAnalyzer
|
||||
|
||||
analyzer = QualityAnalyzer(Path('$SKILL_DIR'))
|
||||
report = analyzer.generate_report()
|
||||
formatted = analyzer.format_report(report)
|
||||
print(formatted)
|
||||
|
||||
# Save to file
|
||||
with open('quality_report_${SKILL_NAME}.txt', 'w') as f:
|
||||
f.write(formatted)
|
||||
python3 -c "
|
||||
from pathlib import Path
|
||||
from skill_seekers.cli.quality_metrics import QualityAnalyzer
|
||||
analyzer = QualityAnalyzer(Path('$SKILL_DIR'))
|
||||
report = analyzer.generate_report()
|
||||
formatted = analyzer.format_report(report)
|
||||
print(formatted)
|
||||
with open('quality_report_${SKILL_NAME}.txt', 'w') as f:
|
||||
f.write(formatted)
|
||||
"
|
||||
fi
|
||||
continue-on-error: true
|
||||
|
||||
@@ -819,9 +819,7 @@ class DocToSkillConverter:
|
||||
if self.browser_mode and not self._has_md_extension(url):
|
||||
# Use Playwright in executor (sync API in async context)
|
||||
loop = asyncio.get_event_loop()
|
||||
html = await loop.run_in_executor(
|
||||
None, self._render_with_browser, url
|
||||
)
|
||||
html = await loop.run_in_executor(None, self._render_with_browser, url)
|
||||
soup = BeautifulSoup(html, "html.parser")
|
||||
page = self.extract_content(soup, url)
|
||||
else:
|
||||
|
||||
@@ -5,13 +5,23 @@ Real end-to-end tests using actual Playwright + Chromium.
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import pytest
|
||||
|
||||
from skill_seekers.cli.browser_renderer import (
|
||||
BrowserRenderer,
|
||||
_auto_install_chromium,
|
||||
_check_playwright_available,
|
||||
)
|
||||
|
||||
# Skip all real browser tests when Playwright is not installed
|
||||
_has_playwright = _check_playwright_available()
|
||||
requires_playwright = pytest.mark.skipif(
|
||||
not _has_playwright,
|
||||
reason="Playwright not installed (pip install 'skill-seekers[browser]')",
|
||||
)
|
||||
|
||||
|
||||
@requires_playwright
|
||||
class TestPlaywrightAvailability:
|
||||
"""Test that playwright is properly detected."""
|
||||
|
||||
@@ -23,6 +33,7 @@ class TestPlaywrightAvailability:
|
||||
assert _auto_install_chromium() is True
|
||||
|
||||
|
||||
@requires_playwright
|
||||
class TestBrowserRendererReal:
|
||||
"""Real end-to-end tests with actual Chromium."""
|
||||
|
||||
@@ -113,6 +124,7 @@ class TestDocScraperBrowserIntegration:
|
||||
scraper = DocToSkillConverter(config)
|
||||
assert scraper.browser_mode is False
|
||||
|
||||
@requires_playwright
|
||||
def test_render_with_browser_returns_html(self):
|
||||
"""Test the _render_with_browser helper directly."""
|
||||
from skill_seekers.cli.doc_scraper import DocToSkillConverter
|
||||
|
||||
Reference in New Issue
Block a user