Skip to content

build esp32 merged image #251

build esp32 merged image

build esp32 merged image #251

Workflow file for this run

name: platformio
on:
push:
branches: [ '*' ]
tags: [ 'v*' ]
pull_request:
branches: [ '*' ]
jobs:
test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Run PlatformIO Test
run: platformio test -e native
build:
needs: test
runs-on: ubuntu-22.04
strategy:
matrix:
target: ['d1_mini', 'lolin32', 'pico']
steps:
- uses: actions/checkout@v3
- name: Extract Version
run: |
echo "build_name=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
echo "build_branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
echo "build_tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "build_sha=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
- name: Make Version
run: |
echo "build_file_devel=espfc_${{ env.build_sha }}_${{ matrix.target }}.bin" >> $GITHUB_ENV
echo "build_file_release=espfc_${{ env.build_tag }}_${{ matrix.target }}.bin" >> $GITHUB_ENV
- name: Print Version
run: |
echo SHA: ${{ env.build_sha }}
echo TAG: ${{ env.build_tag }}
echo BRANCH: ${{ env.build_branch }}
echo NAME: ${{ env.build_name }}
echo DEVEL: ${{ env.build_file_devel }}
echo RELEASE: ${{ env.build_file_release }}
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ hashFiles('**/lockfiles') }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install platformio
- name: Run Development Build
if: "!startsWith(github.ref, 'refs/tags/')"
run: |
platformio run -e ${{ matrix.target }}
env:
PLATFORMIO_BUILD_FLAGS: -DESPFC_REVISION=${{ env.build_sha }}
- name: Merge ESP32 Development Build
if: "!startsWith(github.ref, 'refs/tags/') && ${{ matrix.target }} == 'lolin32'"
run: |
python3 ~/.platformio/packages/tool-esptoolpy/esptool.py --chip ESP32 merge_bin -o .pio/build/lolin32/firmware_full.bin --target-offset 0x0 --flash_mode dio --flash_freq 80m --flash_size 4MB 0x1000 .pio/build/lolin32/bootloader.bin 0x8000 .pio/build/lolin32/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/lolin32/firmware.bin
env:
PLATFORMIO_BUILD_FLAGS: -DESPFC_REVISION=${{ env.build_sha }}
- name: Create Development Artifact
uses: actions/upload-artifact@v3
if: "!startsWith(github.ref, 'refs/tags/')"
with:
name: ${{ env.build_file_devel }}
path: .pio/build/${{ matrix.target }}/firmware.bin
- name: Create ESP32 Merged Development Artifact
uses: actions/upload-artifact@v3
if: "!startsWith(github.ref, 'refs/tags/')"
with:
name: "${{ env.build_file_devel }}_full"
path: .pio/build/${{ matrix.target }}/firmware_full.bin
- name: Run Release Build
if: "startsWith(github.ref, 'refs/tags/')"
run: |
platformio run -e ${{ matrix.target }}
env:
PLATFORMIO_BUILD_FLAGS: -DESPFC_REVISION=${{ env.build_sha }} -DESPFC_VERSION=${{ env.build_tag }}
- name: Create Release Artifact
uses: actions/upload-artifact@v3
if: "startsWith(github.ref, 'refs/tags/')"
with:
name: ${{ env.build_file_release }}
path: .pio/build/${{ matrix.target }}/firmware.bin