Skip to content

Commit

Permalink
CI build for classic and pro variant
Browse files Browse the repository at this point in the history
  • Loading branch information
amandel committed Aug 17, 2024
1 parent e9eab2a commit e966265
Show file tree
Hide file tree
Showing 3 changed files with 150 additions and 29 deletions.
157 changes: 138 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,13 @@ jobs:
run: |
mkdir sonarqube-out
./sonarqube/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir sonarqube-out \
platformio ci --build-dir="./bin" --keep-build-dir --project-conf=platformio.ini ./src/
platformio ci --environment obspro --environment obs --build-dir ./bin --keep-build-dir --project-conf platformio.ini ./src/
- name: Package firmware
- name: Package firmware OBS classic
run: |
set -eux
mkdir -p obs-classic
cd obs-classic
if [ -f "/github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_40m.elf" ]; then
cp /github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_40m.elf 0x01000.elf
elif [ -f "/github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin" ]; then
Expand All @@ -112,10 +114,10 @@ jobs:
find /github/home/.platformio/ -name "bootloader*.elf"
exit 1
fi
cp bin/.pio/build/esp32dev/partitions.bin 0x08000.bin
cp ../bin/.pio/build/obs/partitions.bin 0x08000.bin
cp /github/home/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x0e000.bin
cp bin/.pio/build/esp32dev/firmware.bin 0x10000.bin
cp bin/.pio/build/esp32dev/firmware.bin firmware.bin
cp ../bin/.pio/build/obs/firmware.bin 0x10000.bin
cp ../bin/.pio/build/obs/firmware.bin firmware.bin
ESPTOOL=/github/home/.platformio/packages/tool-esptoolpy/esptool.py
chmod +x ${ESPTOOL}
# CMD to create a merged binary (still missing flash.app)
Expand All @@ -138,16 +140,73 @@ jobs:
0x01000 0x01000.bin.org
echo OpenBikeSensor bootloader params
${ESPTOOL} --chip esp32 image_info --version 2 0x01000.bin || echo image_info failed
cp src/fonts/LICENSE.txt LICENSE-OpenSans.txt
cp ../src/fonts/LICENSE.txt LICENSE-OpenSans.txt
wget --no-verbose -O COPYRIGHT-ESP.html https://docs.espressif.com/projects/esp-idf/en/latest/esp32/COPYRIGHT.html
wget --no-verbose -O LICENSE-ARDUINO-ESP32.md https://github.com/espressif/arduino-esp32/raw/master/LICENSE.md
zip --junk-paths obs-${{ env.OBS_VERSION }}-initial-flash.zip \
zip --junk-paths ../obs-${{ env.OBS_VERSION }}-initial-flash.zip \
0x*.bin \
COPYRIGHT-ESP.html \
LICENSE-ARDUINO-ESP32.md \
LICENSE-OpenSans.txt \
LICENSE
zip --junk-paths obs-${{ env.OBS_VERSION }}.zip \
zip --junk-paths ../obs-${{ env.OBS_VERSION }}.zip \
firmware.bin \
COPYRIGHT-ESP.html \
LICENSE-ARDUINO-ESP32.md \
LICENSE-OpenSans.txt \
LICENSE
- name: Package firmware OBS pro
run: |
set -eux
mkdir -p obs-pro
cd obs-pro
if [ -f "/github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_40m.elf" ]; then
cp /github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/esp32/bin/bootloader_dio_40m.elf 0x01000.elf
elif [ -f "/github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin" ]; then
cp /github/home/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin 0x01000.bin
else
echo could not find bootloader_dio_40m.bin, new location?
find /github/home/.platformio/ -name "bootloader*.bin"
find /github/home/.platformio/ -name "bootloader*.elf"
exit 1
fi
cp ../bin/.pio/build/obspro/partitions.bin 0x08000.bin
cp /github/home/.platformio/packages/framework-arduinoespressif32/tools/partitions/boot_app0.bin 0x0e000.bin
cp ../bin/.pio/build/obspro/firmware.bin 0x10000.bin
cp ../bin/.pio/build/obspro/firmware.bin firmware.bin
ESPTOOL=/github/home/.platformio/packages/tool-esptoolpy/esptool.py
chmod +x ${ESPTOOL}
# CMD to create a merged binary (still missing flash.app)
# ${ESPTOOL} --trace --chip esp32 merge_bin --output merged.bin \
# --flash_freq keep --flash_mode dio --flash_size 4MB \
# 0x01000 0x01000.bin \
# 0x08000 0x08000.bin \
# 0x0e000 0x0e000.bin \
# 0x10000 0x10000.bin
${ESPTOOL} --trace --chip esp32 elf2image \
--dont-append-digest \
--flash_freq 40m --flash_mode dio \
0x01000.elf
echo Original bootloader params after elf2image
${ESPTOOL} --chip esp32 image_info --version 2 0x01000.bin || echo image_info for converted bootloader failed
mv 0x01000.bin 0x01000.bin.org
${ESPTOOL} --trace --chip esp32 merge_bin --output 0x01000.bin \
--flash_freq 40m --flash_mode dio --flash_size 4MB \
--target-offset 0x01000 \
0x01000 0x01000.bin.org
echo OpenBikeSensor bootloader params
${ESPTOOL} --chip esp32 image_info --version 2 0x01000.bin || echo image_info failed
cp ../src/fonts/LICENSE.txt LICENSE-OpenSans.txt
wget --no-verbose -O COPYRIGHT-ESP.html https://docs.espressif.com/projects/esp-idf/en/latest/esp32/COPYRIGHT.html
wget --no-verbose -O LICENSE-ARDUINO-ESP32.md https://github.com/espressif/arduino-esp32/raw/master/LICENSE.md
zip --junk-paths ../obspro-${{ env.OBS_VERSION }}-initial-flash.zip \
0x*.bin \
COPYRIGHT-ESP.html \
LICENSE-ARDUINO-ESP32.md \
LICENSE-OpenSans.txt \
LICENSE
zip --junk-paths ../obspro-${{ env.OBS_VERSION }}.zip \
firmware.bin \
COPYRIGHT-ESP.html \
LICENSE-ARDUINO-ESP32.md \
Expand Down Expand Up @@ -186,26 +245,50 @@ jobs:
with:
name: obs-${{ env.OBS_VERSION }}
path: |
firmware.bin
COPYRIGHT-ESP.html
LICENSE-ARDUINO-ESP32.md
LICENSE-OpenSans.txt
LICENSE
obs-classic/firmware.bin
obs-classic/COPYRIGHT-ESP.html
obs-classic/LICENSE-ARDUINO-ESP32.md
obs-classic/LICENSE-OpenSans.txt
obs-classic/LICENSE
if-no-files-found: error

- name: Upload Build Asset Initial Flash
uses: actions/upload-artifact@v4
with:
name: obs-${{ env.OBS_VERSION }}-initial-flash
path: |
0x*.bin
COPYRIGHT-ESP.html
LICENSE-ARDUINO-ESP32.md
LICENSE-OpenSans.txt
LICENSE
obs-classic/0x*.bin
obs-classic/COPYRIGHT-ESP.html
obs-classic/LICENSE-ARDUINO-ESP32.md
obs-classic/LICENSE-OpenSans.txt
obs-classic/LICENSE
sonarqube-out/build-wrapper-dump.json
if-no-files-found: error

- name: Upload Build Asset obspro
uses: actions/upload-artifact@v4
with:
name: obspro-${{ env.OBS_VERSION }}
path: |
obs-pro/firmware.bin
obs-pro/COPYRIGHT-ESP.html
obs-pro/LICENSE-ARDUINO-ESP32.md
obs-pro/LICENSE-OpenSans.txt
obs-pro/LICENSE
if-no-files-found: error

- name: Upload Build Asset Initial Flash obspro
uses: actions/upload-artifact@v4
with:
name: obspro-${{ env.OBS_VERSION }}-initial-flash
path: |
obs-pro/0x*.bin
obs-pro/COPYRIGHT-ESP.html
obs-pro/LICENSE-ARDUINO-ESP32.md
obs-pro/LICENSE-OpenSans.txt
obs-pro/LICENSE
if-no-files-found: error

- name: Generate changelog
id: changelog
if: ${{ env.OBS_PREPARE_RELEASE == 'true' }}
Expand Down Expand Up @@ -275,6 +358,42 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/.pio/build/esp32dev/firmware.bin
asset_path: ./bin/.pio/build/obs/firmware.bin
asset_name: firmware.bin
asset_content_type: application/x-esp32

- name: Upload Release Asset obspro
id: upload-release-asset
if: ${{ env.OBS_PREPARE_RELEASE == 'true' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./obspro-${{ env.OBS_VERSION }}.zip
asset_name: obspro-${{ env.OBS_VERSION }}.zip
asset_content_type: application/zip

- name: Upload Release Asset Initial Flash pro
id: upload-release-asset-initial-flash
if: ${{ env.OBS_PREPARE_RELEASE == 'true' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./obspro-${{ env.OBS_VERSION }}-initial-flash.zip
asset_name: obspro-${{ env.OBS_VERSION }}-initial-flash.zip
asset_content_type: application/zip

- name: Upload Release Asset app bin pro
id: upload-release-asset-app-bin
if: ${{ env.OBS_PREPARE_RELEASE == 'true' }}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./bin/.pio/build/obspro/firmware.bin
asset_name: obspro-firmware.bin
asset_content_type: application/x-esp32
9 changes: 2 additions & 7 deletions custom_config.ini.example
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
; This file should contain your local modifications to the PlatformIO.ini file.

[env:esp32dev]
[env:myObs]
build_flags =
; settings needed by the build
-DHTTPS_REQUEST_MAX_REQUEST_LENGTH=1024
; reduce probability of https://github.com/fhessel/esp32_https_server/pull/123
-DHTTPS_CONNECTION_DATA_CHUNK_SIZE=1024
; custom default configuration
;
${env.build_flags}
; you can specify a custom config json (see docs/software/firmware/obs_cfg.md)
; here which will be used for fresh installs based on this firmware
-DCUSTOM_OBS_DEFAULT_CONFIG='"{ obs: [ { displayConfig: 15, offset: [ 30, 30 ], httpPin: \\"12345678\\", wifiSsid: \\"SID\\", wifiPassword: \\"87654321\\" } ] }"'
Expand Down
13 changes: 10 additions & 3 deletions platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
src_dir = src
extra_configs = custom_config.ini

[env:esp32dev]
[env]
platform = espressif32 @ 6.6.0
; 5.4.0
board = esp32dev
Expand Down Expand Up @@ -69,6 +69,13 @@ build_flags =
-DHTTPS_CONNECTION_DATA_CHUNK_SIZE=1024
; build number "-dev" will be replaced in github action
-DBUILD_NUMBER=\"-dev\"
; Select variant here

[env:obs]
build_flags =
${env.build_flags}
-DOBSCLASSIC

[env:obspro]
build_flags =
${env.build_flags}
-DOBSPRO
; -DOBSCLASSIC

0 comments on commit e966265

Please sign in to comment.