63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: "Espressif IoT Development Framework (ESP-IDF)"
|
|
description: "This action builds your firmware for ESP32 directly in GitHub using Espressif ESP-IDF Docker image."
|
|
branding:
|
|
color: red
|
|
icon: wifi
|
|
inputs:
|
|
path:
|
|
description: "Relative path under $GITHUB_WORKSPACE containing the project"
|
|
default: "."
|
|
required: false
|
|
esp_idf_version:
|
|
default: "latest"
|
|
required: false
|
|
esp_idf_docker_image:
|
|
default: "espressif/idf"
|
|
required: false
|
|
extra_docker_args:
|
|
default: ""
|
|
required: false
|
|
target:
|
|
default: "esp32"
|
|
required: false
|
|
command:
|
|
default: "idf.py build"
|
|
required: false
|
|
|
|
runs:
|
|
using: "composite"
|
|
steps:
|
|
- shell: bash
|
|
env:
|
|
INPUT_PATH: ${{ inputs.path }}
|
|
INPUT_TARGET: ${{ inputs.target }}
|
|
INPUT_VERSION: ${{ inputs.esp_idf_version }}
|
|
INPUT_IMAGE: ${{ inputs.esp_idf_docker_image }}
|
|
INPUT_EXTRA: ${{ inputs.extra_docker_args }}
|
|
INPUT_COMMAND: ${{ inputs.command }}
|
|
run: |
|
|
set -euo pipefail
|
|
IDF_TARGET=$(echo "$INPUT_TARGET" | tr '[:upper:]' '[:lower:]' | tr -d '_-')
|
|
WORKDIR="/project/${INPUT_PATH}"
|
|
|
|
CID=$(docker create -t \
|
|
-e IDF_TARGET="$IDF_TARGET" \
|
|
-w "$WORKDIR" \
|
|
$INPUT_EXTRA \
|
|
"${INPUT_IMAGE}:${INPUT_VERSION}" \
|
|
/bin/bash -c "git config --global --add safe.directory '*' && ${INPUT_COMMAND}")
|
|
|
|
cleanup() { docker rm -f "$CID" >/dev/null 2>&1 || true; }
|
|
trap cleanup EXIT
|
|
|
|
docker cp "$GITHUB_WORKSPACE/." "$CID:/project"
|
|
|
|
status=0
|
|
docker start -a "$CID" || status=$?
|
|
|
|
# copy build output back so later steps (artifact upload etc.) can use it
|
|
mkdir -p "$GITHUB_WORKSPACE/${INPUT_PATH}"
|
|
docker cp "$CID:$WORKDIR/build/." "$GITHUB_WORKSPACE/${INPUT_PATH}/build" 2>/dev/null || true
|
|
|
|
exit $status
|