build fix #776
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: | |
- { name: 'esp32', merge: true } | |
- { name: 'esp32s2', merge: true } | |
- { name: 'esp32s3', merge: true } | |
- { name: 'esp32c3', merge: true } | |
- { name: 'esp8266', merge: false } | |
- { name: 'rp2040', merge: false } | |
- { name: 'rp2350', merge: false } | |
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: Extract Version | |
run: | | |
VAR_REV=$(echo ${GITHUB_SHA} | cut -c1-7) | |
if [[ $GITHUB_EVENT_NAME == "pull_request" ]]; then | |
VAR_VER="pr${{ github.event.pull_request.number }}" | |
VAR_NAME="espfc_${VAR_VER}_${{ matrix.target.name }}" | |
elif [[ $GITHUB_REF == refs/tags/* ]]; then | |
VAR_VER="${GITHUB_REF#refs/tags/}" | |
VAR_NAME="espfc_${VAR_VER}_${{ matrix.target.name }}" | |
else | |
VAR_VER="0.0.0" | |
VAR_NAME="espfc_${VAR_REV}_${{ matrix.target.name }}" | |
fi | |
echo VERSION=$VAR_VER | |
echo REVISION=$VAR_REV | |
echo FILENAME=$VAR_NAME | |
echo "build_ver=${VAR_VER}" >> $GITHUB_ENV | |
echo "build_rev=${VAR_REV}" >> $GITHUB_ENV | |
echo "build_name=${VAR_NAME}" >> $GITHUB_ENV | |
- name: Build Target | |
run: | | |
platformio run -e ${{ matrix.target.name }} | |
mv .pio/build/${{ matrix.target.name }}/firmware.bin .pio/build/${{ env.build_name }}.bin | |
env: | |
PLATFORMIO_BUILD_FLAGS: -DESPFC_REVISION=${{ env.build_rev }} -DESPFC_VERSION=${{ env.build_ver }} | |
- name: Rename Target Merged | |
if: ${{ matrix.target.merge == true }} | |
run: | | |
mv .pio/build/${{ matrix.target.name }}/firmware_0x00.bin .pio/build/${{ env.build_name }}_0x00.bin | |
- name: Create Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.build_name }}.bin | |
path: .pio/build/${{ env.build_name }}.bin | |
- name: Create Artifact Merged | |
uses: actions/upload-artifact@v4 | |
if: ${{ matrix.target.merge == true }} | |
with: | |
name: "${{ env.build_name }}_0x00.bin" | |
path: .pio/build/${{ env.build_name }}_0x00.bin |