name: Firmware CI on: push: paths: - 'firmware/**' - '.github/workflows/firmware-ci.yml' pull_request: paths: - 'firmware/**' - '.github/workflows/firmware-ci.yml' jobs: build: name: Build ESP32-S3 Firmware runs-on: ubuntu-latest container: image: espressif/idf:v5.4 steps: - uses: actions/checkout@v4 - name: Build firmware working-directory: firmware/esp32-csi-node run: | . $IDF_PATH/export.sh idf.py set-target esp32s3 idf.py build - name: Verify binary size (< 1100 KB gate) working-directory: firmware/esp32-csi-node run: | BIN=build/esp32-csi-node.bin SIZE=$(stat -c%s "$BIN") MAX=$((1100 * 1024)) echo "Binary size: $SIZE bytes ($(( SIZE / 1024 )) KB)" echo "Size limit: $MAX bytes (1100 KB — includes WASM runtime + HTTP client for Seed swarm bridge)" if [ "$SIZE" -gt "$MAX" ]; then echo "::error::Firmware binary exceeds 1100 KB size gate ($SIZE > $MAX)" exit 1 fi echo "Binary size OK: $SIZE <= $MAX" - name: Verify flash image integrity working-directory: firmware/esp32-csi-node run: | ERRORS=0 BIN=build/esp32-csi-node.bin # Check binary exists and is non-empty. if [ ! -s "$BIN" ]; then echo "::error::Binary not found or empty" exit 1 fi # Check partition table magic (0xAA50 at offset 0). # Use od instead of xxd (xxd not available in espressif/idf container). PT=build/partition_table/partition-table.bin if [ -f "$PT" ]; then MAGIC=$(od -A n -t x1 -N 2 "$PT" | tr -d ' ') if [ "$MAGIC" != "aa50" ]; then echo "::warning::Partition table magic mismatch: $MAGIC (expected aa50)" ERRORS=$((ERRORS + 1)) fi fi # Check bootloader exists. BL=build/bootloader/bootloader.bin if [ ! -s "$BL" ]; then echo "::warning::Bootloader binary missing or empty" ERRORS=$((ERRORS + 1)) fi # Verify non-zero data in binary (not all 0xFF padding). NONZERO=$(od -A n -t x1 -N 1024 "$BIN" | tr -d ' f\n' | wc -c) if [ "$NONZERO" -lt 100 ]; then echo "::error::Binary appears to be mostly padding (non-zero chars: $NONZERO)" ERRORS=$((ERRORS + 1)) fi if [ "$ERRORS" -gt 0 ]; then echo "::warning::Flash image verification completed with $ERRORS warning(s)" else echo "Flash image integrity verified" fi - name: Check QEMU ESP32-S3 support status run: | echo "::notice::ESP32-S3 QEMU support is experimental in ESP-IDF v5.4. " echo "Full smoke testing requires QEMU 8.2+ with xtensa-esp32s3 target." echo "See: https://github.com/espressif/qemu/wiki" - name: Upload firmware artifact uses: actions/upload-artifact@v4 with: name: esp32-csi-node-firmware path: | firmware/esp32-csi-node/build/esp32-csi-node.bin firmware/esp32-csi-node/build/bootloader/bootloader.bin firmware/esp32-csi-node/build/partition_table/partition-table.bin firmware/esp32-csi-node/build/ota_data_initial.bin retention-days: 90