Skip to content

Cargo Bloat

Cargo Bloat #19

Workflow file for this run

# Run `cargo bloat` for finding out what takes most of the space in your executable.
name: Cargo Bloat
on:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
bloat:
name: Cargo Bloat
runs-on: ubuntu-latest
steps:
- uses: taiki-e/checkout-action@v1
- uses: Boshen/setup-rust@main
with:
cache-key: warm
tools: cargo-bloat
- name: Run
env:
RUSTFLAGS: "-C debuginfo=2 -C strip=none"
shell: bash
run: |
export CMD="cargo bloat -p oxlint --features allocator"
# Get largest functions
export BLOAT_FUNC_CMD="${CMD} -n 10"
export BLOAT_FUNC=`${BLOAT_FUNC_CMD}`
echo $BLOAT_FUNC
# Get largest crates
export BLOAT_CRATE_CMD="${CMD} --crates -n 10"
export BLOAT_CRATE=`${BLOAT_CRATE_CMD}`
echo $BLOAT_CRATE
# Render summary
echo "# Bloat Summary" >> $GITHUB_STEP_SUMMARY
echo "## Largest functions" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo $BLOAT_FUNC >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
echo "## Largest crates" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo $BLOAT_CRATE" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo $BLOAT_CRATE" >> $GITHUB_STEP_SUMMARY
echo "```" >> $GITHUB_STEP_SUMMARY