diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 80261f53..6493c61d 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -5,7 +5,6 @@ Fixes # - [ ] 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 diff --git a/.github/workflows/bloat_formatter.sh b/.github/workflows/bloat_formatter.sh index e95f63b9..b69aa310 100755 --- a/.github/workflows/bloat_formatter.sh +++ b/.github/workflows/bloat_formatter.sh @@ -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') @@ -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 diff --git a/.github/workflows/cargo_bloat.yml b/.github/workflows/cargo_bloat.yml index dee15870..f5c8db2a 100644 --- a/.github/workflows/cargo_bloat.yml +++ b/.github/workflows/cargo_bloat.yml @@ -1,5 +1,5 @@ name: Binary size report -on: workflow_dispatch # Not working at the moment, disabled +on: pull_request jobs: cargo_bloat: @@ -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 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1a256f10..8163c062 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ concurrency: jobs: runtests: + name: Continuous Integration runs-on: ubuntu-latest permissions: contents: read diff --git a/setup.sh b/setup.sh index 32a5842c..ee48889c 100755 --- a/setup.sh +++ b/setup.sh @@ -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