Skip to content

Compile All

Compile All #8

name: Compile Generics
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: Build for ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
matrix:
target:
- esp32
- esp32s2
- esp32s3
- esp32c3
- esp32c6
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- name: Cache ESP-IDF and Tools
uses: actions/cache@v3
with:
path: |
~/.espressif
~/.idf_tools
~/.cache/pip
key: ${{ runner.os }}-esp-idf-${{ matrix.target }}-${{ hashFiles('**/sdkconfig') }}
restore-keys: |
${{ runner.os }}-esp-idf-${{ matrix.target }}-
${{ runner.os }}-esp-idf-
${{ runner.os }}-
# Manual ESP-IDF Installation
- name: Install ESP-IDF
run: |
sudo apt-get update
sudo apt-get install -y wget git flex bison gperf python3-pip python3-setuptools cmake ninja-build ccache libffi-dev libssl-dev dfu-util
git clone -b v5.3.1 --depth 1 https://github.com/espressif/esp-idf.git ~/esp-idf
~/esp-idf/install.sh
- name: Set Target
run: |
. ~/esp-idf/export.sh
idf.py set-target ${{ matrix.target }}
# Use sdkconfig instead of sdkconfig.defaults
- name: Apply Base sdkconfig
run: |
. ~/esp-idf/export.sh
cp sdkconfig sdkconfig.build
- name: Override Build Options
run: |
. ~/esp-idf/export.sh
idf.py set-config FLASH_SIZE 4MB
idf.py set-config CONFIG_COMPILER_OPTIMIZATION_SIZE=y
idf.py set-config PARTITION_TABLE_CUSTOM=y
idf.py set-config PARTITION_TABLE_FILENAME "partitions.csv"
idf.py set-config CONFIG_FATFS_LFN_ENABLED=y
idf.py set-config CONFIG_FATFS_LFN_CODE_PAGE=437
idf.py set-config CONFIG_FATFS_MAX_LFN=255
if [ "${{ matrix.target }}" = "esp32s2" ]; then
idf.py set-config CONFIG_BT_ENABLED=n
idf.py set-config CONFIG_BLUEDROID_ENABLED=n
idf.py set-config CONFIG_BLUETOOTH_ENABLED=n
idf.py set-config CONFIG_BLE_ENABLED=n
idf.py set-config CONFIG_BT_NIMBLE_ENABLED=n
else
idf.py set-config CONFIG_BT_ENABLED=y
idf.py set-config CONFIG_BLUEDROID_ENABLED=y
idf.py set-config CONFIG_BLUETOOTH_ENABLED=y
idf.py set-config CONFIG_BLE_ENABLED=y
idf.py set-config CONFIG_BT_NIMBLE_ENABLED=y
fi
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_8=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_10=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_12=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_14=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_16=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_18=y
idf.py set-config CONFIG_LV_FONT_MONTSERRAT_24=y
idf.py menuconfig --disableconfig
idf.py reconfigure
- name: Clean Build Environment
run: |
. ~/esp-idf/export.sh
idf.py fullclean
- name: Build Project
run: |
. ~/esp-idf/export.sh
idf.py build
- name: Package Build Artifacts
run: |
. ~/esp-idf/export.sh
mkdir -p packaged_artifacts
BOOTLOADER_BIN=build/bootloader/bootloader.bin
PARTITION_TABLE_BIN=build/partition_table/partition-table.bin
GHOST_ESP_IDF_BIN=build/Ghost_ESP_IDF.bin
if [ ! -f "$BOOTLOADER_BIN" ]; then
echo "Error: $BOOTLOADER_BIN not found!"
exit 1
fi
if [ ! -f "$PARTITION_TABLE_BIN" ]; then
echo "Error: $PARTITION_TABLE_BIN not found!"
exit 1
fi
if [ ! -f "$GHOST_ESP_IDF_BIN" ]; then
echo "Error: $GHOST_ESP_IDF_BIN not found!"
exit 1
fi
cp "$BOOTLOADER_BIN" packaged_artifacts/
cp "$PARTITION_TABLE_BIN" packaged_artifacts/
cp "$GHOST_ESP_IDF_BIN" packaged_artifacts/
ZIP_NAME="${{ matrix.target }}-build-${{ github.run_id }}.zip"
cd packaged_artifacts
zip "$ZIP_NAME" bootloader.bin partition-table.bin Ghost_ESP_IDF.bin
cd ..
- name: Upload Build Artifacts ZIP
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}-build-${{ github.run_id }}.zip
path: packaged_artifacts/${{ matrix.target }}-build-${{ github.run_id }}.zip
- name: Archive Build Directory on Failure
if: failure()
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.target }}-build-failure-${{ github.run_id }}
path: build/
# Discord notification using curl
- name: Notify on Failure
if: failure()
run: |
curl -X POST -H "Content-Type: application/json" \
-d "{\"content\": \"🚨 **Build Failed**\n**Repository**: \`${{ github.repository }}\`\n**Target**: \`${{ matrix.target }}\`\n**Run ID**: \`${{ github.run_id }}\`\n**View Details**: [Click Here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})\"}" \
${{ secrets.DISCORD_WEBHOOK_URL }}