i3c: add initial ASPEED AST1060 I3C driver implementation #10
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
| # Licensed under the Apache-2.0 license | |
| name: Binary Size Analysis | |
| on: | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'src/**' | |
| - 'Cargo.toml' | |
| - 'Cargo.lock' | |
| jobs: | |
| size-analysis: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout PR | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install packages | |
| run: | | |
| sudo apt-get update -qy | |
| sudo apt-get install -qy build-essential curl gcc-multilib gcc-riscv64-unknown-elf git | |
| - name: Install cargo-bloat | |
| run: cargo install cargo-bloat | |
| - name: Build current branch | |
| run: | | |
| cargo build --release --target thumbv7em-none-eabihf | |
| - name: Analyze current branch size | |
| run: | | |
| # Use cargo bloat directly since xtask bloat may not be available | |
| cargo bloat --release --target thumbv7em-none-eabihf > target/pr-bloat-report.txt || echo "Bloat analysis failed" | |
| - name: Checkout main branch | |
| run: | | |
| git checkout main | |
| - name: Build main branch | |
| run: | | |
| cargo build --release --target thumbv7em-none-eabihf | |
| - name: Analyze main branch size | |
| run: | | |
| # Use cargo bloat directly since xtask bloat may not be available | |
| cargo bloat --release --target thumbv7em-none-eabihf > target/main-bloat-report.txt || echo "Bloat analysis failed" | |
| - name: Generate size comparison report | |
| id: size-comparison | |
| run: | | |
| # Create a comprehensive comparison | |
| echo "## 📊 Binary Size Analysis" > size_report.md | |
| echo "" >> size_report.md | |
| # Get binary sizes | |
| PR_SIZE=$(stat -c%s target/thumbv7em-none-eabihf/release/aspeed-ddk 2>/dev/null || echo "0") | |
| git checkout - | |
| MAIN_SIZE=$(stat -c%s target/thumbv7em-none-eabihf/release/aspeed-ddk 2>/dev/null || echo "0") | |
| # Calculate difference | |
| SIZE_DIFF=$((PR_SIZE - MAIN_SIZE)) | |
| echo "### Size Comparison" >> size_report.md | |
| echo "- **Main branch**: $(numfmt --to=iec $MAIN_SIZE)" >> size_report.md | |
| echo "- **PR branch**: $(numfmt --to=iec $PR_SIZE)" >> size_report.md | |
| echo "- **Difference**: $(numfmt --to=iec $SIZE_DIFF)" >> size_report.md | |
| echo "" >> size_report.md | |
| if [ $SIZE_DIFF -gt 10240 ]; then | |
| echo "⚠️ **Warning**: Binary size increased by more than 10KB" >> size_report.md | |
| echo "size_warning=true" >> $GITHUB_OUTPUT | |
| elif [ $SIZE_DIFF -gt 0 ]; then | |
| echo "ℹ️ Binary size increased slightly" >> size_report.md | |
| elif [ $SIZE_DIFF -lt 0 ]; then | |
| echo "✅ Binary size decreased!" >> size_report.md | |
| fi | |
| echo "" >> size_report.md | |
| echo "### Top Functions (Current PR)" >> size_report.md | |
| echo '```' >> size_report.md | |
| head -20 target/pr-bloat-report.txt >> size_report.md 2>/dev/null || echo "No function data available" >> size_report.md | |
| echo '```' >> size_report.md | |
| - name: Output size analysis to workflow summary | |
| run: | | |
| echo "## 📊 Binary Size Analysis" >> $GITHUB_STEP_SUMMARY | |
| cat size_report.md >> $GITHUB_STEP_SUMMARY | |
| - name: Output size analysis to console | |
| run: | | |
| echo "=== Binary Size Analysis ===" | |
| cat size_report.md | |
| - name: Check for significant size increase | |
| run: | | |
| # Extract size difference from the report | |
| if grep -q "⚠️ Binary size increased by more than 10KB" size_report.md; then | |
| echo "::error::Binary size increased by more than 10KB! Please review." | |
| exit 1 | |
| elif grep -q "🚨 Binary size increased significantly" size_report.md; then | |
| echo "::warning::Binary size increased significantly. Consider optimization." | |
| fi | |
| - name: Upload detailed reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: size-analysis-detailed | |
| path: | | |
| target/pr-bloat-report.txt | |
| target/main-bloat-report.txt | |
| size_report.md | |
| retention-days: 7 |