Skip to content

Commit

Permalink
ci: clean up the bloat action
Browse files Browse the repository at this point in the history
  • Loading branch information
Boshen committed May 30, 2024
1 parent 83a1715 commit 27db137
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 34 deletions.
13 changes: 0 additions & 13 deletions .github/workflows/bloat.tmpl

This file was deleted.

36 changes: 24 additions & 12 deletions .github/workflows/bloat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,42 @@ jobs:
name: Cargo Bloat
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: taiki-e/checkout-action@v1
- uses: taiki-e/checkout-action@v1

- name: Cache
uses: Swatinem/rust-cache@v2

- name: Install cargo-bloat
uses: taiki-e/install-action@v2
- uses: Boshen/setup-rust@main
with:
tool: cargo-bloat
cache-key: warm
tools: cargo-bloat

- name: Run
env:
RUSTFLAGS: "-C debuginfo=2 -C strip=none"
shell: bash
run: |
export CMD="cargo bloat --profile release-debug -p oxlint --features allocator"
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}"
echo $BLOAT_FUNC
# Get largest crates
export BLOAT_CRATE_CMD="${CMD} --crates -n 10"
export BLOAT_CRATE=`${BLOAT_CRATE_CMD}`
echo "${BLOAT_CRATE}"
echo $BLOAT_CRATE
# Render summary
envsubst < .github/workflows/bloat.tmpl > $GITHUB_STEP_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
11 changes: 2 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,6 @@ opt-level = 'z'
opt-level = 3
lto = "fat"
codegen-units = 1
strip = "symbols"
debug = false
strip = "symbols" # set to `false` for debug information
debug = false # set to `true` for debug information
panic = "abort" # Let it crash and force ourselves to write safe Rust.

# Use the `--profile release-debug` flag to show symbols in release mode.
# e.g. `cargo build --profile release-debug`
[profile.release-debug]
inherits = "release"
strip = false
debug = true

0 comments on commit 27db137

Please sign in to comment.