Implementation of OpenProt owned digest API for ASPEED HACE controller #1
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: | |
| pull-requests: write | |
| 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: | | |
| cargo xtask bloat --release --report --output-dir target/pr-bloat-reports | |
| - 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: | | |
| cargo xtask bloat --release --report --output-dir target/main-bloat-reports | |
| - 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-reports/bloat_functions.txt >> size_report.md 2>/dev/null || echo "No function data available" >> size_report.md | |
| echo '```' >> size_report.md | |
| - name: Comment PR with size analysis | |
| uses: thollander/actions-comment-pull-request@v2 | |
| with: | |
| filePath: size_report.md | |
| comment_tag: size-analysis | |
| - name: Upload detailed reports | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: size-analysis-detailed | |
| path: | | |
| target/pr-bloat-reports/ | |
| target/main-bloat-reports/ | |
| size_report.md | |
| retention-days: 7 |