Code refactor #714
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: platformio | |
on: | |
push: | |
branches: [ '*' ] | |
tags: [ 'v*' ] | |
pull_request: | |
branches: [ '*' ] | |
jobs: | |
test: | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Pio | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Dependencies | |
run: pip install --upgrade platformio | |
- name: Run PlatformIO Test | |
run: platformio test -e native | |
build: | |
needs: test | |
runs-on: ubuntu-24.04 | |
strategy: | |
matrix: | |
target: ['esp32', 'esp32s2', 'esp32s3', 'esp32c3', 'esp8266', 'rp2040', 'rp2350'] | |
steps: | |
- uses: actions/checkout@v4 | |
- 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 }}" >> $GITHUB_ENV | |
echo "build_file_release=espfc_${{ env.build_tag }}_${{ matrix.target }}" >> $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 Pio | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cache/pip | |
~/.platformio/.cache | |
key: ${{ runner.os }}-pio | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
- name: Install Dependencies | |
run: pip install --upgrade platformio | |
- name: Build Development Target | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
platformio run -e ${{ matrix.target }} | |
env: | |
PLATFORMIO_BUILD_FLAGS: -DESPFC_REVISION=${{ env.build_sha }} | |
- name: Build Release Target | |
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: Merge ESP32 Target | |
# if: ${{ matrix.target == 'esp32' }} | |
# run: | | |
# python3 ~/.platformio/packages/tool-esptoolpy/esptool.py --chip ${{ matrix.target }} merge_bin -o .pio/build/${{ matrix.target }}/firmware_merged.bin --target-offset 0x0 --flash_mode keep --flash_freq keep --flash_size 4MB 0x1000 .pio/build/${{ matrix.target }}/bootloader.bin 0x8000 .pio/build/${{ matrix.target }}/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/${{ matrix.target }}/firmware.bin | |
# - name: Merge ESP32-S3 Target | |
# if: ${{ matrix.target == 'esp32s3' }} | |
# run: | | |
# python3 ~/.platformio/packages/tool-esptoolpy/esptool.py --chip ${{ matrix.target }} merge_bin -o .pio/build/${{ matrix.target }}/firmware_merged.bin --target-offset 0x0 --flash_mode keep --flash_freq keep --flash_size 16MB 0x0000 .pio/build/${{ matrix.target }}/bootloader.bin 0x8000 .pio/build/${{ matrix.target }}/partitions.bin 0xe000 ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x10000 .pio/build/${{ matrix.target }}/firmware.bin | |
- name: Create Development Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ !startsWith(github.ref, 'refs/tags/') }} | |
with: | |
name: ${{ env.build_file_devel }}.bin | |
path: .pio/build/${{ matrix.target }}/firmware.bin | |
- name: Create Development Artifact Merged | |
uses: actions/upload-artifact@v4 | |
if: ${{ !startsWith(github.ref, 'refs/tags/') && startsWith(matrix.target, 'esp32') }} | |
with: | |
name: "${{ env.build_file_devel }}_0x00.bin" | |
path: .pio/build/${{ matrix.target }}/firmware_0x00.bin | |
- name: Create Release Artifact | |
uses: actions/upload-artifact@v4 | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
with: | |
name: ${{ env.build_file_release }}.bin | |
path: .pio/build/${{ matrix.target }}/firmware.bin | |
- name: Create Release Artifact Merged | |
uses: actions/upload-artifact@v4 | |
if: ${{ startsWith(github.ref, 'refs/tags/') && startsWith(matrix.target, 'esp32') }} | |
with: | |
name: ${{ env.build_file_release }}_0x00.bin | |
path: .pio/build/${{ matrix.target }}/firmware_0x00.bin |