From 4e0f0ae581189c03380fd7def13b579d4c80e0d7 Mon Sep 17 00:00:00 2001 From: Boshen Date: Thu, 30 May 2024 21:18:20 +0800 Subject: [PATCH] ci: clean up the `bloat` action --- .github/workflows/bloat.tmpl | 13 ----------- .github/workflows/bloat.yml | 45 ++++++++++++++++++------------------ Cargo.toml | 11 ++------- 3 files changed, 25 insertions(+), 44 deletions(-) delete mode 100644 .github/workflows/bloat.tmpl diff --git a/.github/workflows/bloat.tmpl b/.github/workflows/bloat.tmpl deleted file mode 100644 index c334ff0dae8418..00000000000000 --- a/.github/workflows/bloat.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -# Bloat Summary - -## Largest functions - -``` -${BLOAT_FUNC} -``` - -## Largest crates - -``` -${BLOAT_CRATE} -``` diff --git a/.github/workflows/bloat.yml b/.github/workflows/bloat.yml index 0b9297fb452fac..7af8712e079ad8 100644 --- a/.github/workflows/bloat.yml +++ b/.github/workflows/bloat.yml @@ -14,30 +14,31 @@ 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" - - # 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 - envsubst < .github/workflows/bloat.tmpl > $GITHUB_STEP_SUMMARY + echo "# Bloat Summary" >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + + echo "## Largest functions" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + cargo bloat --release -p oxlint --features allocator -n 15 >> $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 + cargo bloat --release -p oxlint --features allocator --crates -n 15 >> $GITHUB_STEP_SUMMARY + echo "" >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY diff --git a/Cargo.toml b/Cargo.toml index a4f5f64f686222..2f4bf249fade75 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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