Skip to content

feat(models): Add scan, photo, and receipt models #16

feat(models): Add scan, photo, and receipt models

feat(models): Add scan, photo, and receipt models #16

name: Update Architecture Dashboard
on:
push:
branches: [main, develop]
pull_request:
branches: [main]
workflow_dispatch:
# Trigger on build workflow completion
workflow_run:
workflows: ["Build", "CI", "Test"]
types: [completed]
env:
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
jobs:
update-dashboard:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Need full history for git analysis
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install dependencies
run: |
brew install graphviz jq sourcekitten periphery
pip install requests
npm install -g vercel
- name: Download build artifacts
if: github.event_name == 'workflow_run'
uses: actions/download-artifact@v3
with:
name: build-logs
path: build-artifacts/
continue-on-error: true
- name: Extract build errors
run: |
# Look for build log files
if [ -d "build-artifacts" ]; then
echo "Found build artifacts"
cp build-artifacts/*.txt /tmp/build_errors.txt || true
else
echo "No build artifacts found, running current build analysis"
# Try to build and capture errors
make build 2>&1 | tee /tmp/build_errors.txt || true
fi
- name: Generate architecture analysis
run: |
# Create cache directory
mkdir -p .cache docs/arch/{types,calls,_thumbs,scripts}
# Copy scripts
cp scripts/*.py docs/arch/scripts/ || true
# Run analysis scripts
python3 scripts/analyze_modules.py > .cache/edges.json
python3 scripts/generate_module_graph.py > .cache/module_graph_progress.json
python3 scripts/analyze_types.py > .cache/type_graphs_progress.json
python3 scripts/generate_call_graphs.py > .cache/call_graphs_progress.json
# Run architecture analysis
python3 docs/arch/scripts/analyze_architecture_violations.py || true
# Analyze build errors if available
if [ -f "/tmp/build_errors.txt" ]; then
# Create a properly formatted build log
cat > "/tmp/formatted_build.txt" << 'EOF'
Showing All Errors Only

Check failure on line 81 in .github/workflows/update-architecture-dashboard.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/update-architecture-dashboard.yml

Invalid workflow file

You have an error in your yaml syntax on line 81
EOF
cat /tmp/build_errors.txt >> /tmp/formatted_build.txt
cp /tmp/formatted_build.txt "/Users/griffin/Downloads/Build HomeInventoryApp_2025-07-31T20-50-35.txt"
python3 docs/arch/scripts/analyze_build_errors.py || true
fi
# Git history analysis
python3 docs/arch/scripts/analyze_git_history.py || true
# Generate dashboards
python3 scripts/generate_index.py
python3 docs/arch/scripts/generate_developer_dashboard.py
python3 docs/arch/scripts/generate_quality_scorecard.py
# Add navigation
python3 docs/arch/scripts/add_navigation.py
- name: Add build timestamp
run: |
TIMESTAMP=$(date -u +"%Y-%m-%d %H:%M:%S UTC")
BUILD_STATUS="success"
if [ -f "docs/arch/build_error_report.json" ]; then
ERROR_COUNT=$(jq -r '.summary.total_errors' docs/arch/build_error_report.json)
if [ "$ERROR_COUNT" -gt 0 ]; then
BUILD_STATUS="failed"
fi
fi
# Add timestamp to dashboards
for file in docs/arch/*.html; do
sed -i '' "s|</body>|<div style='position: fixed; bottom: 10px; right: 10px; font-size: 12px; color: #999;'>Last updated: $TIMESTAMP | Build: $BUILD_STATUS</div></body>|" "$file"
done
- name: Deploy to Vercel
run: |
cd docs/arch
vercel deploy --token=$VERCEL_TOKEN --prod --yes
- name: Post deployment status
if: github.event_name == 'pull_request'
uses: actions/github-script@v6
with:
script: |
const deployment_url = process.env.VERCEL_URL || 'https://modular-inventory-dashboard.vercel.app';
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: `🏗️ Architecture Dashboard updated!\n\nView the latest analysis: ${deployment_url}\n\n- Module Dependencies\n- Build Errors: ${process.env.ERROR_COUNT || '0'}\n- Code Quality Scores\n- Git History Analysis`
});
env:
ERROR_COUNT: ${{ env.ERROR_COUNT }}