Skip to content

Merge pull request #298 from ruza87/wifi_fix #270

Merge pull request #298 from ruza87/wifi_fix

Merge pull request #298 from ruza87/wifi_fix #270

Workflow file for this run

name: PlatformIO CI
on:
workflow_dispatch:
push:
paths-ignore:
- "**.md"
jobs:
job_build_modulecode:
runs-on: ubuntu-latest
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.11'
- name: Install PlatformIO
run: pip install --upgrade platformio
- name: Create folders
run: |
mkdir -p ./ESPController/data/avr
mkdir -p ~/OUTPUT
mkdir -p ~/OUTPUT/Controller
mkdir -p ~/OUTPUT/ControllerBoardTest
mkdir -p ~/OUTPUT/Modules/HEX
mkdir -p ~/OUTPUT/Modules/BIN
pwd
ls
- name: Build code for ATTINY modules
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ATTINYCellModule --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ATTINYCellModule/platformio.ini
- name: Copy output
run: |
cp ./ATTINYCellModule/.pio/build/V*/*.hex ~/OUTPUT/Modules/HEX/
cp ./ATTINYCellModule/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/
- name: Build code for STM32 modules
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/STM32All-In-One --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/STM32All-In-One/platformio.ini
- name: Copy STM32 binary firmware output files
run: |
cp ./STM32All-In-One/.pio/build/V*/*.bin ~/OUTPUT/Modules/BIN/
- name: Build code for ESP32 controller
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController --environment esp32-devkitc --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController/platformio.ini
- name: Copy output
run: |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_firmware_espressif32_esp32-devkitc.elf ~/OUTPUT/Controller/
cp ./ESPController/.pio/build/esp32-devkitc/partitions.bin ~/OUTPUT/Controller/
cp ./ESPController/.pio/build/esp32-devkitc/bootloader.bin ~/OUTPUT/Controller/
cp ~/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin ~/OUTPUT/Controller/
cp ./ESPController/data/avr/manifest.json ~/OUTPUT/Modules/
- name: Build File System Image for ESP32
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESPController --target buildfs --environment esp32-devkitc
- name: Copy output
run: |
cp ./ESPController/.pio/build/esp32-devkitc/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin ~/OUTPUT/Controller/
- name: Get latest esptool / Build single ESP32 image
run: |
git clone https://github.com/espressif/esptool.git
cd esptool
pip install --user -e .
cd ~
python -m esptool --chip esp32 merge_bin -o ~/OUTPUT/Controller/esp32-controller-firmware-complete.bin --flash_mode=keep --flash_size 4MB 0x1000 ~/OUTPUT/Controller/bootloader.bin 0x8000 ~/OUTPUT/Controller/partitions.bin 0xe000 ~/OUTPUT/Controller/boot_app0.bin 0x10000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x1C0000 ~/OUTPUT/Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin 0x370000 ~/OUTPUT/Controller/diybms_controller_filesystemimage_espressif32_esp32-devkitc.bin
- name: Board test code for ESP32 controller
run: pio run --project-dir=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESP32BoardTest --environment esp32-devkitc --project-conf=/home/runner/work/diyBMSv4ESP32/diyBMSv4ESP32/ESP32BoardTest/platformio.ini
- name: Copy board test output
run: |
cp ./ESP32BoardTest/.pio/build/esp32-devkitc/diybms_boardtest_espressif32_esp32-devkitc.bin ~/OUTPUT/ControllerBoardTest/
- name: Publish Artifacts 1
uses: actions/upload-artifact@v4
with:
name: DIYBMS-Compiled
path: ~/OUTPUT
if-no-files-found: error
job_zip_code:
runs-on: ubuntu-latest
needs: [job_build_modulecode]
steps:
- name: Download artifact DIYBMS-Compiled
uses: actions/download-artifact@v4
with:
name: DIYBMS-Compiled
- name: Rename over-the-air firmware
run: mv ./Controller/diybms_controller_firmware_espressif32_esp32-devkitc.bin ./Controller/esp32-controller-firmware-over-the-air.bin
- name: Display structure of downloaded files
run: ls -R
- name: ZIP output for release
run: |
zip release.zip ./Controller/esp32-controller-firmware-complete.bin
zip release.zip ./Controller/esp32-controller-firmware-over-the-air.bin
zip release.zip ./ControllerBoardTest/diybms_boardtest_espressif32_esp32-devkitc.bin
zip release.zip ./Modules/manifest.json
zip release.zip ./Modules/HEX/*.*
zip release.zip ./Modules/BIN/module_fw_V490*.*
- name: Get current date
id: date
run: echo "dt=$(date +'%Y-%m-%d-%H-%M')" >> $GITHUB_ENV
- name: Rename ZIP
run: mv release.zip release_${{ env.dt }}.zip
- name: Publish Artifact
uses: actions/upload-artifact@v4
with:
name: DIYBMS-Release-Artifact-${{ env.dt }}
path: |
./Controller/*.*
./Modules/manifest.json
./Modules/HEX/*.*
./Modules/BIN/module_fw_V490*.bin
if-no-files-found: error
- name: Create Release Files on MASTER branch only
id: create_release
uses: actions/create-release@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: Tag-${{ env.dt }}
release_name: Release-${{ env.dt }}
body: |
Automatically generated release
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
if: github.ref == 'refs/heads/master'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./release_${{ env.dt }}.zip
asset_name: Compiled_Firmware_${{ env.dt }}.zip
asset_content_type: application/zip