Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Fixes #<issue_number_goes_here>
- [ ] Local tests pass (running `run_desktop_tests.sh`)
- [ ] Tested against boards
- [ ] Nordic nRF52840 DK
- [ ] Nordic nRF52840 Dongle (JTAG programmed)
- [ ] Nordic nRF52840 Dongle (DFU programmed)
- [ ] Nordic nRF52840 Dongle
- [ ] Makerdiary nRF52840 MDK USB Dongle
- [ ] Appropriate changes to README are included in PR
15 changes: 8 additions & 7 deletions .github/workflows/bloat_formatter.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ cd "$(dirname "$0")"

# New output file is $1
# Old output file is $2
TMP=comment.md
WARNING="Note: numbers above are a result of guesswork. They are not 100% correct and never will be."
# Optional output file is $3
TMP="${3:-bloat_comment.md}"
WARNING="never will be"
NEW_SIZE=$(cat "$1" | sed -nr 's/.*100.0% (.*)KiB .text.*/\1/p')
OLD_SIZE=$(cat "$2" | sed -nr 's/.*100.0% (.*)KiB .text.*/\1/p')
Comment thread
kaczmarczyck marked this conversation as resolved.

Expand All @@ -32,15 +33,15 @@ Output of cargo bloat
" >> "$TMP"

echo "Including PR" >> "$TMP"
cat "$1" >> "$TMP"
sed -n '/File .text/,$p' "$1" | grep -v "$WARNING" >> "$TMP"
echo "Base branch" >> "$TMP"
cat "$2" >> "$TMP"
sed -n '/File .text/,$p' "$2" | grep -v "$WARNING" >> "$TMP"

COMMENT="$(cat $TMP | sed "s/$WARNING//g" | sed 's/%/%25/g' | sed -z 's/\n/%0A/g')"
COMMENT=$(cat "$TMP" | sed 's/%/%25/g' | sed -z 's/\n/%0A/g')
# No output for equality is intentional.
if (( $(echo "$NEW_SIZE > $OLD_SIZE" | bc -l) )); then
echo "::warning file=.github/workflows/cargo_bloat.yml,title=Binary size::$COMMENT"
echo "::warning file=.github/workflows/cargo_bloat.yml,line=1,title=Binary size::$COMMENT"
fi
if (( $(echo "$NEW_SIZE < $OLD_SIZE" | bc -l) )); then
echo "::notice file=.github/workflows/cargo_bloat.yml,title=Binary size::$COMMENT"
echo "::notice file=.github/workflows/cargo_bloat.yml,line=1,title=Binary size::$COMMENT"
fi
16 changes: 10 additions & 6 deletions .github/workflows/cargo_bloat.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Binary size report
on: workflow_dispatch # Not working at the moment, disabled
on: pull_request

jobs:
cargo_bloat:
Expand All @@ -26,9 +26,10 @@ jobs:
- name: Set up OpenSK
run: ./setup.sh
- name: Run bloat on the PR
run: RUSTFLAGS="-C link-arg=-icf=all -C force-frame-pointers=no" cargo bloat --release --target=thumbv7em-none-eabi --features=config-command,ctap1 --crates >> .github/workflows/bloat_output_new.txt
working-directory: ./third_party/wasefire
run: cargo xtask --release --native applet rust ../.. --opt-level=z --features=ctap1,config-command runner nordic --opt-level=z --features=usb-ctap --features=software-crypto-aes256-cbc,software-crypto-hmac-sha256 --features=software-crypto-p256-ecdh,software-crypto-p256-ecdsa --measure-bloat >> "$GITHUB_WORKSPACE/.github/workflows/bloat_output_new.txt"

# Second run: PR
# Second run: HEAD
- uses: actions/checkout@v4
with:
submodules: true
Expand All @@ -38,8 +39,11 @@ jobs:
working-directory: ./OpenSK_base
run: ./setup.sh
- name: Run bloat on base
working-directory: ./OpenSK_base
run: RUSTFLAGS="-C link-arg=-icf=all -C force-frame-pointers=no" cargo bloat --release --target=thumbv7em-none-eabi --features=config-command,ctap1 --crates >> "$GITHUB_WORKSPACE/.github/workflows/bloat_output_old.txt"
working-directory: ./OpenSK_base/third_party/wasefire
run: cargo xtask --release --native applet rust ../.. --opt-level=z --features=ctap1,config-command runner nordic --opt-level=z --features=usb-ctap --features=software-crypto-aes256-cbc,software-crypto-hmac-sha256 --features=software-crypto-p256-ecdh,software-crypto-p256-ecdsa --measure-bloat >> "$GITHUB_WORKSPACE/.github/workflows/bloat_output_old.txt"

- name: Run output formatter to echo workflow command
run: ./.github/workflows/bloat_formatter.sh bloat_output_new.txt bloat_output_old.txt bloat_comment.md
run: .github/workflows/bloat_formatter.sh bloat_output_new.txt bloat_output_old.txt bloat_comment.md

- name: Add summary
run: cat .github/workflows/bloat_comment.md >> $GITHUB_STEP_SUMMARY
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ concurrency:

jobs:
runtests:
name: Continuous Integration
runs-on: ubuntu-latest
permissions:
contents: read
Expand Down
6 changes: 6 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ done_text="$(tput bold)DONE.$(tput sgr0)"

set -e

# Installs uv for OSS-Fuzz
if [[ -n "${CI}" ]] && ! command -v uv &> /dev/null; then
curl -LsSf "https://astral.sh/uv/install.sh" | sh
export PATH="${HOME}/.local/bin:${HOME}/.cargo/bin:${PATH}"
fi

# Check that rustup and pip3 are installed
check_command () {
if ! which "$1" >/dev/null
Expand Down
Loading