77 description : " Pull request number to analyze"
88 required : true
99 type : string
10+ example_name :
11+ description : " Example directory name to analyze (e.g., embassy_dhcp)"
12+ required : true
13+ type : string
1014
1115jobs :
1216 binary-size :
@@ -22,16 +26,10 @@ jobs:
2226 target :
2327 - soc : esp32c3
2428 rust-target : riscv32imc-unknown-none-elf
25- dir-qa : ./qa-test
26- dir-dhcp : ./examples/wifi/embassy_dhcp
2729 - soc : esp32c6
2830 rust-target : riscv32imac-unknown-none-elf
29- dir-qa : ./qa-test
30- dir-dhcp : ./examples/wifi/embassy_dhcp
3131 - soc : esp32
3232 rust-target : xtensa-esp32-none-elf
33- dir-qa : ./qa-test
34- dir-dhcp : ./examples/wifi/embassy_dhcp
3533
3634 steps :
3735 - name : Setup Rust
@@ -82,45 +80,82 @@ jobs:
8280 cd $HOME
8381 mkdir results
8482
85- - name : Build PR QA Binary
86- working-directory : ${{ matrix.target.dir-qa }}
83+ - name : Build PR example
8784 run : |
88- cargo build --release --bin sleep_timer --features ${{ matrix.target.soc }} --target ${{ matrix.target.rust-target }}
89- cp target/${{ matrix.target.rust-target }}/release/sleep_timer $HOME/results/pr_qa_build_${{ matrix.target.soc }}.elf
85+ set -euo pipefail
86+
87+ RAW_INPUT="${{ github.event.inputs.example_name }}"
88+ cargo xtask build examples $RAW_INPUT --chip "${{ matrix.target.soc }}"
89+
90+ EXAMPLE_NAME=$(echo "$RAW_INPUT" | awk '{print $1}')
91+ BIN_NAME=$(echo "$EXAMPLE_NAME" | tr '_' '-')
92+
93+ BIN=$(
94+ find target qa-test/target examples -type f \
95+ -path "*/release/${BIN_NAME}" \
96+ -executable \
97+ 2>/dev/null | head -n 1 || true
98+ )
99+
100+ # Fallback to `_` instead of `-`
101+ if [ -z "$BIN" ]; then
102+ BIN=$(find target qa-test/target examples -type f \
103+ -path "*/release/${EXAMPLE_NAME}" \
104+ -executable \
105+ 2>/dev/null | head -n 1 || true)
106+ fi
90107
91- - name : Build PR DHCP Binary
92- working-directory : ${{ matrix.target.dir-dhcp }}
93- run : |
94- # Build
95- cargo build --release --features ${{ matrix.target.soc }} --target ${{ matrix.target.rust-target }}
96- # Copy PR binary to parent directory (outside workspace)
97- cp target/${{ matrix.target.rust-target }}/release/embassy-dhcp $HOME/results/pr_dhcp_build_${{ matrix.target.soc }}.elf
108+ if [ -z "$BIN" ]; then
109+ echo "Error: Built PR binary not found"
110+ exit 1
111+ fi
98112
99- # Checkout base (current default branch HEAD) for comparison
113+ cp "$BIN" $HOME/results/pr_qa_build_${{ matrix.target.soc }}.elf
114+
115+ # Checkout base
100116 - name : Checkout Base Commit
101117 uses : actions/checkout@v6
102118 with :
103119 fetch-depth : 0
104120
105- - name : Build Base QA Binary
106- working-directory : ${{ matrix.target.dir-qa }}
121+ - name : Build Base example
107122 run : |
108- cargo build --release --bin sleep_timer --features ${{ matrix.target.soc }} --target ${{ matrix.target.rust-target }}
109- cp target/${{ matrix.target.rust-target }}/release/sleep_timer $HOME/results/base_qa_build_${{ matrix.target.soc }}.elf
123+ set -euo pipefail
124+ cargo clean
125+
126+ RAW_INPUT="${{ github.event.inputs.example_name }}"
127+ cargo xtask build examples $RAW_INPUT --chip "${{ matrix.target.soc }}"
128+
129+ EXAMPLE_NAME=$(echo "$RAW_INPUT" | awk '{print $1}')
130+ BIN_NAME=$(echo "$EXAMPLE_NAME" | tr '_' '-')
131+
132+ BIN=$(
133+ find target qa-test/target examples -type f \
134+ -path "*/release/${BIN_NAME}" \
135+ -executable \
136+ 2>/dev/null | head -n 1 || true
137+ )
138+
139+ # Fallback to `_` instead of `-`
140+ if [ -z "$BIN" ]; then
141+ BIN=$(find target qa-test/target examples -type f \
142+ -path "*/release/${EXAMPLE_NAME}" \
143+ -executable \
144+ 2>/dev/null | head -n 1 || true)
145+ fi
110146
111- - name : Build Base DHCP Binary
112- working-directory : ${{ matrix.target.dir-dhcp }}
113- run : |
114- cargo build --release --features ${{ matrix.target.soc }} --target ${{ matrix.target.rust-target }}
115- cp target/${{ matrix.target.rust-target }}/release/embassy-dhcp $HOME/results/base_dhcp_build_${{ matrix.target.soc }}.elf
147+ if [ -z "$BIN" ]; then
148+ echo "Error: Built BASE binary not found"
149+ exit 1
150+ fi
151+
152+ cp "$BIN" $HOME/results/base_qa_build_${{ matrix.target.soc }}.elf
116153
117154 - name : Copy binaries to workspace for Bloaty
118155 run : |
119156 # Copy files from $HOME/results to current workspace
120157 cp $HOME/results/base_qa_build_${{ matrix.target.soc }}.elf ./
121158 cp $HOME/results/pr_qa_build_${{ matrix.target.soc }}.elf ./
122- cp $HOME/results/base_dhcp_build_${{ matrix.target.soc }}.elf ./
123- cp $HOME/results/pr_dhcp_build_${{ matrix.target.soc }}.elf ./
124159 ls -la *.elf
125160
126161 # Diffs and Artifacts
@@ -140,23 +175,6 @@ jobs:
140175 echo "\`\`\`" >> result-pr-${{ matrix.target.soc }}.txt
141176 echo "EOF" >> result-pr-${{ matrix.target.soc }}.txt
142177
143- - name : Run Bloaty DHCP Diff
144- id : bloaty-dhcp
145- uses : carlosperate/bloaty-action@v1
146- with :
147- bloaty-args : -d sections --domain vm --source-filter "^.text$|^.data|^.bss|^.rwdata|^.rwtext" base_dhcp_build_${{ matrix.target.soc }}.elf -- pr_dhcp_build_${{ matrix.target.soc }}.elf
148- output-to-summary : false
149- continue-on-error : true
150-
151- - name : Save Bloaty DHCP output
152- run : |
153- echo "DHCP_DIFF<<EOF" >> result-pr-${{ matrix.target.soc }}.txt
154- echo "\`\`\`" >> result-pr-${{ matrix.target.soc }}.txt
155- echo "${{ steps.bloaty-dhcp.outputs.bloaty-output || 'N/A' }}" >> result-pr-${{ matrix.target.soc }}.txt
156- echo "\`\`\`" >> result-pr-${{ matrix.target.soc }}.txt
157- echo "EOF" >> result-pr-${{ matrix.target.soc }}.txt
158- cat result-pr-${{ matrix.target.soc }}.txt
159-
160178 - name : Upload Result Artifact
161179 uses : actions/upload-artifact@v6
162180 with :
0 commit comments