docs: document mixed-bus scanning and new i2c helper APIs #24
Workflow file for this run
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: Repository Metrics | |
| on: | |
| push: | |
| branches: | |
| - "**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| metrics: | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| shell: bash | |
| steps: | |
| # ------------------------------------------------------------------ | |
| # Checkout | |
| # ------------------------------------------------------------------ | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| # ------------------------------------------------------------------ | |
| # Setup Rust | |
| # ------------------------------------------------------------------ | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| toolchain: stable | |
| - name: Cache Rust | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install tokei | |
| run: cargo install tokei --locked | |
| # ------------------------------------------------------------------ | |
| # Install system utilities | |
| # ------------------------------------------------------------------ | |
| - name: Install utilities | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y cloc tree jq | |
| # ------------------------------------------------------------------ | |
| # Prepare output directory | |
| # ------------------------------------------------------------------ | |
| - name: Create metrics directory | |
| run: mkdir -p metrics | |
| # ------------------------------------------------------------------ | |
| # Run tokei | |
| # ------------------------------------------------------------------ | |
| - name: Run tokei (JSON + Text) | |
| run: | | |
| set -euo pipefail | |
| EXCLUDES=".git,node_modules,dist,build" | |
| tokei --exclude $EXCLUDES --output json > metrics/tokei.json | |
| tokei --exclude $EXCLUDES > metrics/tokei.txt | |
| # ------------------------------------------------------------------ | |
| # Run cloc | |
| # ------------------------------------------------------------------ | |
| - name: Run cloc | |
| run: | | |
| set -euo pipefail | |
| cloc . \ | |
| --exclude-dir=.git,node_modules,dist,build \ | |
| --json \ | |
| --out=metrics/cloc.json | |
| # ------------------------------------------------------------------ | |
| # Repository structure snapshot | |
| # ------------------------------------------------------------------ | |
| - name: Generate directory tree | |
| run: | | |
| set -euo pipefail | |
| tree -a \ | |
| -I ".git|node_modules|dist|build" \ | |
| > metrics/repo-tree.txt | |
| # ------------------------------------------------------------------ | |
| # Disk usage + largest files | |
| # ------------------------------------------------------------------ | |
| - name: Repository disk usage | |
| run: | | |
| set -euo pipefail | |
| { | |
| echo "Total repository size:" | |
| du -sh . | |
| echo "" | |
| echo "Top 20 largest files:" | |
| find . -type f -not -path "./.git/*" \ | |
| -exec du -h {} + \ | |
| | sort -rh \ | |
| | head -20 | |
| } > metrics/disk-usage.txt | |
| # ------------------------------------------------------------------ | |
| # Consolidated Markdown Report | |
| # ------------------------------------------------------------------ | |
| - name: Generate consolidated report | |
| run: | | |
| set -euo pipefail | |
| REPORT="metrics/metrics-report.md" | |
| { | |
| echo "# Repository Metrics Report" | |
| echo "" | |
| echo "Generated (UTC): $(date -u)" | |
| echo "Repository: $GITHUB_REPOSITORY" | |
| echo "Commit: $GITHUB_SHA" | |
| echo "Branch: $GITHUB_REF_NAME" | |
| echo "Runner: $RUNNER_OS" | |
| echo "" | |
| echo "---" | |
| echo "" | |
| echo "## 1. Tokei Summary" | |
| echo "" | |
| echo '```' | |
| cat metrics/tokei.txt | |
| echo '```' | |
| echo "" | |
| echo "## 2. Top Languages by Lines of Code" | |
| echo "" | |
| jq -r 'to_entries | sort_by(-.value.code) | .[:10] | .[] | "- **\(.key)**: \(.value.code) lines (\(.value.comments) comments)"' metrics/tokei.json 2>/dev/null || echo "Parse error" | |
| echo "" | |
| echo "_Full tokei.json and cloc.json available in artifact download_" | |
| echo "" | |
| echo "## 3. Disk Usage" | |
| echo "" | |
| echo '```' | |
| cat metrics/disk-usage.txt | |
| echo '```' | |
| echo "" | |
| echo "## 5. Directory Structure" | |
| echo "" | |
| echo '```' | |
| cat metrics/repo-tree.txt | |
| echo '```' | |
| echo "" | |
| echo "## 6. Repository Statistics" | |
| echo "" | |
| echo "- Total files: $(find . -type f -not -path './.git/*' | wc -l)" | |
| echo "- Total directories: $(find . -type d -not -path './.git/*' | wc -l)" | |
| echo "- Git commit count: $(git rev-list --count HEAD)" | |
| echo "" | |
| echo "---" | |
| echo "_End of Report_" | |
| } > "$REPORT" | |
| # ------------------------------------------------------------------ | |
| # Add concise summary to GitHub UI | |
| # ------------------------------------------------------------------ | |
| - name: Write summary to workflow page | |
| run: | | |
| { | |
| echo "## Repository Metrics Summary" | |
| echo "" | |
| echo "**Commit:** \`$GITHUB_SHA\`" | |
| echo "**Branch:** \`$GITHUB_REF_NAME\`" | |
| echo "" | |
| echo "### Quick Stats" | |
| TOTAL_FILES=$(find . -type f -not -path './.git/*' | wc -l) | |
| TOTAL_COMMITS=$(git rev-list --count HEAD 2>/dev/null || echo "N/A") | |
| echo "- Total files: $TOTAL_FILES" | |
| echo "- Git commits: $TOTAL_COMMITS" | |
| echo "" | |
| echo "### Top Languages" | |
| if [ -f metrics/tokei.json ]; then | |
| jq -r 'to_entries | sort_by(-.value.code) | .[:5] | .[] | "- **\(.key)**: \(.value.code) lines"' metrics/tokei.json 2>/dev/null || echo "- Parse error" | |
| else | |
| echo "- No data available" | |
| fi | |
| echo "" | |
| echo "**Download archive:** \`repository-metrics-${{ github.run_number }}\`" | |
| echo "" | |
| echo "_Archive contains: tokei.json, tokei.txt, cloc.json, disk-usage.txt, repo-tree.txt, metrics-report.md_" | |
| } >> $GITHUB_STEP_SUMMARY | |
| # ------------------------------------------------------------------ | |
| # Upload artifacts | |
| # ------------------------------------------------------------------ | |
| - name: Upload metrics artifacts | |
| if: always() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: repository-metrics-${{ github.run_number }} | |
| path: metrics/ | |
| retention-days: 30 |