Build ESP32 Application #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, esp32_c3_lcdkit, esp32_c6_devkit] | |
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';; | |
esp32_c3_lcdkit) echo 'esp32c3';; | |
esp32_c6_devkit) echo 'esp32c6';; | |
*) 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: esp-idf build and merge binaries | |
uses: espressif/esp-idf-ci-action@v1.1.0 | |
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 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 |