Scheduled Extension Build #17
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: Scheduled Extension Build | |
| on: | |
| schedule: | |
| # Run every Monday at 9 AM UTC | |
| - cron: '0 9 * * 1' | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: π₯ Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: π Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: π Run Meta Analysis | |
| run: | | |
| python3 scripts/meta-analyzer.py | |
| echo "β Meta analysis complete" | |
| - name: π§ͺ Run Tests | |
| run: | | |
| echo "π§ͺ Running automated tests..." | |
| # Test 1: Verify config file exists and is valid JSON | |
| if ! jq empty data/config/utility_apps_config.json 2>/dev/null; then | |
| echo "β Config file is invalid JSON" | |
| exit 1 | |
| fi | |
| echo "β Config file is valid" | |
| # Test 2: Count apps | |
| APP_COUNT=$(jq '.apps | length' data/config/utility_apps_config.json) | |
| echo "β Found $APP_COUNT apps in config" | |
| # Test 3: Check for duplicate IDs | |
| DUPLICATE_IDS=$(jq -r '.apps[].id' data/config/utility_apps_config.json | sort | uniq -d) | |
| if [ -n "$DUPLICATE_IDS" ]; then | |
| echo "β Found duplicate IDs: $DUPLICATE_IDS" | |
| exit 1 | |
| fi | |
| echo "β No duplicate IDs found" | |
| # Test 4: Verify critical files exist | |
| CRITICAL_FILES=( | |
| "index.html" | |
| "apps/development/meta-dashboard.html" | |
| "apps/development/meta-presentation.html" | |
| "apps/games/feedShyworm4.html" | |
| ) | |
| for file in "${CRITICAL_FILES[@]}"; do | |
| if [ ! -f "$file" ]; then | |
| echo "β Critical file missing: $file" | |
| exit 1 | |
| fi | |
| done | |
| echo "β All critical files present" | |
| echo "π All tests passed!" | |
| - name: ποΈ Build Extension | |
| run: | | |
| chmod +x scripts/build-chrome-extension.sh | |
| ./scripts/build-chrome-extension.sh | |
| - name: π¦ Create ZIP | |
| run: | | |
| cd chrome-extension-build | |
| zip -r ../local-first-tools-extension.zip . | |
| cd .. | |
| - name: π Generate Health Report | |
| id: health | |
| run: | | |
| APP_COUNT=$(jq '.apps | length' data/config/utility_apps_config.json) | |
| TOTAL_SIZE=$(du -sh chrome-extension-build | cut -f1) | |
| META_APPS=$(jq '.metadata.total_apps' data/meta-analysis.json) | |
| cat > health-report.md << EOF | |
| ## π Weekly Health Report | |
| **Report Date:** $(date -u +"%Y-%m-%d %H:%M:%S UTC") | |
| **Repository:** ${{ github.repository }} | |
| ### π Metrics | |
| | Metric | Value | | |
| |--------|-------| | |
| | Apps in Config | $APP_COUNT | | |
| | Apps Analyzed | $META_APPS | | |
| | Build Size | $TOTAL_SIZE | | |
| | Build Status | β Success | | |
| ### π§ͺ Test Results | |
| - β Config validation passed | |
| - β No duplicate IDs | |
| - β All critical files present | |
| - β Extension built successfully | |
| ### π Category Distribution | |
| $(jq -r '.category_report.distribution | to_entries | map("- **\(.key)**: \(.value) apps") | join("\n")' data/meta-analysis.json) | |
| ### π Top Technologies | |
| $(jq -r '.technology_stats | to_entries | sort_by(-.value) | .[0:5] | map("- **\(.key)**: \(.value) apps") | join("\n")' data/meta-analysis.json) | |
| ### π‘ Recommendations | |
| $(jq -r '.category_report.recommendations[0:3] | map("- **\(.category)**: \(.suggestions[0])") | join("\n")' data/meta-analysis.json) | |
| --- | |
| *This report is automatically generated every Monday.* | |
| EOF | |
| cat health-report.md | |
| echo "app_count=$APP_COUNT" >> $GITHUB_OUTPUT | |
| echo "total_size=$TOTAL_SIZE" >> $GITHUB_OUTPUT | |
| - name: π€ Upload Health Report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: weekly-health-report-${{ github.run_number }} | |
| path: health-report.md | |
| retention-days: 90 | |
| - name: πΎ Update Repository | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| # Add updated meta-analysis | |
| git add data/meta-analysis.json | |
| if ! git diff --staged --quiet; then | |
| git commit -m "chore: weekly meta-analysis update | |
| - Apps: ${{ steps.health.outputs.app_count }} | |
| - Build size: ${{ steps.health.outputs.total_size }} | |
| - All tests passed β | |
| π€ Auto-generated by scheduled workflow" | |
| git push | |
| echo "β Changes committed" | |
| else | |
| echo "βΉοΈ No changes to commit" | |
| fi | |
| - name: π Summary | |
| run: | | |
| echo "### π Weekly Health Check Complete!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Apps:** ${{ steps.health.outputs.app_count }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Size:** ${{ steps.health.outputs.total_size }}" >> $GITHUB_STEP_SUMMARY | |
| echo "**Status:** β All tests passed" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "See [health report artifact](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) for full details." >> $GITHUB_STEP_SUMMARY | |
| - name: π¨ Notify on Failure | |
| if: failure() | |
| run: | | |
| echo "### β οΈ Weekly Build Failed!" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "The scheduled build encountered errors. Please review the logs." >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "**Action Required:** Check the workflow logs and fix any issues." >> $GITHUB_STEP_SUMMARY |