Skip to content

Build ESP32 Application #10

Build ESP32 Application

Build ESP32 Application #10

Workflow file for this run

name: Build ESP32 Application
on:
workflow_dispatch:
inputs:
board:
description: 'Board to build for (all or specific board name)'
required: true
default: 'all'
prefix:
description: 'Prefix for binary name'
required: true
default: 'esp32-sdl3-swift-example'
flash_size:
description: 'Size of the Flash storage'
required: true
default: '4MB'
data_partition:
description: 'Name of data partition'
required: true
default: 'assets'
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
board: [esp32_p4_function_ev_board]
fail-fast: false
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Set Target for ESP-IDF
run: |
echo "TARGET=$(case ${{ matrix.board }} in
esp-box-3) echo 'esp32s3';;
esp-box) echo 'esp32s3';;
m5stack_core_s3) echo 'esp32s3';;
esp32_p4_function_ev_board) echo 'esp32p4';;
*) echo 'Unknown target'; exit 1;;
esac)" >> $GITHUB_ENV
- name: Install pkg-config required by ESP-IDF - CMake - Swift integration
run: |
sudo apt-get update
sudo apt-get install pkg-config
# - name: Setup Swift
# uses: SwiftyLab/setup-swift@latest
# with:
# development: true
# - name: Install Swift
# run: |
# sudo mv /usr/local/bin/swift* /usr/bin/
# sudo mv /usr/local/lib/swift /usr/lib/
- name: esp-idf build and merge binaries
uses: espressif/[email protected]
env:
SWIFTC: /usr/local/bin/swift
with:
esp_idf_version: latest
target: ${{ env.TARGET }}
path: '.'
command: |
wget https://download.swift.org/development/ubuntu2204/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a-ubuntu22.04.tar.gz
tar xzf swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a-ubuntu22.04.tar.gz
export SWIFTC=`pwd`/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a-ubuntu22.04/usr/bin/swift
export PATH="$PATH:`pwd`/swift-DEVELOPMENT-SNAPSHOT-2024-10-30-a-ubuntu22.04/usr/bin/"
swiftc --version
idf.py @boards/${{ matrix.board }}.cfg build &&
cd build.${{ matrix.board }} &&
esptool.py --chip ${{ env.TARGET }} merge_bin -o ${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin "@flash_args"
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin
path: build.${{ matrix.board }}/${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin