Skip to content

Commit

Permalink
Print better size
Browse files Browse the repository at this point in the history
  • Loading branch information
diondokter committed Apr 9, 2024
1 parent cfdb2c6 commit 9101f5d
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ jobs:
pull-requests: write
steps:
- uses: dtolnay/rust-toolchain@nightly
- run: rustup target add thumbv7em-none-eabihf
- run: rustup component add rust-src

- name: Check out the repo with the full git history
uses: actions/checkout@v3
with:
fetch-depth: '0'
- uses: actions/cache@v3
id: cache-cargo
with:
Expand All @@ -71,9 +64,25 @@ jobs:
~/.cargo/git/db/
./example/target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}

- if: steps.cache-cargo.outputs.cache-hit != 'true'
run: rustup target add thumbv7em-none-eabihf
- if: steps.cache-cargo.outputs.cache-hit != 'true'
run: rustup component add rust-src llvm-tools
- if: steps.cache-cargo.outputs.cache-hit != 'true'
run: cargo install cargo-binutils

- name: Check out the repo with the full git history
uses: actions/checkout@v3
with:
fetch-depth: '0'
- name: Build new binary
working-directory: ./example
run: cargo build --release
run: |
echo 'RESULT<<EOF' >> $GITHUB_OUTPUT
cargo size --release | sed 's/\\n/\n/g; s/\\t/ /; s/\\\(.\)/\1/g' >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
id: new-size
- name: Save binary
run: |
mv ./example/target/thumbv7em-none-eabihf/release/example ./example/target/thumbv7em-none-eabihf/release/original.elf
Expand All @@ -94,12 +103,12 @@ jobs:
- name: Add a PR comment with the bloaty diff
if: ${{ github.event.pull_request }}
continue-on-error: true
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: '## PR build size diff\n```\n${{ steps.bloaty-comparison.outputs.bloaty-output-encoded }}```\n'
body: '## PR build size\n ```${{ join(steps.new-size.outputs.*, '\n') }}```\n ### Diff\n```\n${{ steps.bloaty-comparison.outputs.bloaty-output-encoded }}```\n'
})

0 comments on commit 9101f5d

Please sign in to comment.