Skip to content

ESP32.yml aktualisieren #75

ESP32.yml aktualisieren

ESP32.yml aktualisieren #75

Workflow file for this run

name: Build MicroPython for ESP32 Boards
on:
push:
branches:
- CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
setup-environment:
runs-on: ubuntu-24.04
steps:
# Get the latest MicroPython release
- name: Get MicroPython latest release
id: get-micropython-release
run: |
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/micropython/micropython/releases/latest" | jq -r .tag_name)
echo "LATEST_RELEASE=${LATEST_RELEASE}" >> $GITHUB_ENV
# Cache ESP-IDF dependencies and MicroPython
- name: Cache ESP-IDF and MicroPython
id: cache_esp_idf
uses: actions/cache@v4
with:
lookup-only: true
path: |
~/esp-idf/
~/.espressif/
!~/.espressif/dist/
~/.cache/pip/
~/micropython/
key: mpy-${{ env.LATEST_RELEASE }}
# Install ESP-IDF dependencies (if not cached)
- name: Install dependencies
if: steps.cache_esp_idf.outputs.cache-hit != 'true'
run: |
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0
# Clone the latest MicroPython release (if not cached)
- name: Clone MicroPython latest release
id: clone-micropython
if: steps.cache_esp_idf.outputs.cache-hit != 'true'
run: |
echo "Cloning MicroPython release: $LATEST_RELEASE"
cd ~
git clone --depth 1 --branch ${{ env.LATEST_RELEASE }} https://github.com/micropython/micropython.git
cd micropython
git submodule update --init --depth 1
cd mpy-cross
make
cd ~/micropython/ports/esp32
make submodules
echo "Micropython setup successfully"
source ~/micropython/tools/ci.sh && echo "IDF_VER=$IDF_VER" >> $GITHUB_ENV
# Download and set up ESP-IDF (if not cached)
- name: Set up ESP-IDF
id: export-idf
if: steps.cache_esp_idf.outputs.cache-hit != 'true'
run: |
cd ~
# git clone --branch release/v5.2 --recursive https://github.com/espressif/esp-idf.git
git clone --depth 1 --branch ${{ env.IDF_VER }} https://github.com/espressif/esp-idf.git
git -C esp-idf submodule update --init --recursive --filter=tree:0
cd esp-idf
./install.sh all
cd components
git clone https://github.com/espressif/esp32-camera
cd ~/esp-idf/
source ./export.sh
# Dynamically create jobs for each board
build:
needs: setup-environment
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
board:
- ESP32_GENERIC-SPIRAM
- ESP32_GENERIC_S2
- ESP32_GENERIC_S3
- ESP32_GENERIC_S3-SPIRAM_OCT
- ESP32_GENERIC_S3-FLASH_4M
steps:
# Cache ESP-IDF dependencies and MicroPython
- name: Cache ESP-IDF and MicroPython
uses: actions/cache@v4
with:
path: |
~/esp-idf/
~/.espressif/
!~/.espressif/dist/
~/.cache/pip/
~/micropython/
key: mpy-${{ env.LATEST_RELEASE }}
- name: Checkout repository
uses: actions/checkout@v4
- name: Install ESP-IDF dependencies
run: |
sudo apt-get update
sudo apt-get install -y git wget flex bison gperf python3 python3-pip python3-venv cmake ninja-build ccache libffi-dev libssl-dev dfu-util libusb-1.0-0 build-essential pkg-config
# Build MicroPython for each board
- name: Build MicroPython
run: |
cd ~/micropython/ports/esp32
source ~/esp-idf/export.sh
# Check if a variant is defined and adjust the make command
IFS='-' read -r BOARD_NAME BOARD_VARIANT <<< "${{ matrix.board }}"
if [ -n "${BOARD_VARIANT}" ]; then
make USER_C_MODULES=${{ github.workspace }}/src/micropython.cmake BOARD=$BOARD_NAME BOARD_VARIANT=$BOARD_VARIANT all
else
make USER_C_MODULES=${{ github.workspace }}/src/micropython.cmake BOARD=$BOARD_NAME all
fi
mv ~/micropython/ports/esp32/build-${{ matrix.board }}/firmware.bin ~/${{ matrix.board }}.bin
- name: Upload firmware artifact
uses: actions/upload-artifact@v4
with:
name: firmware-${{ matrix.board }}
path: ~/${{ matrix.board }}.bin
retention-days: 1