mirror of
https://github.com/jomjol/AI-on-the-edge-device.git
synced 2025-12-14 23:46:52 +03:00
* fix kernel panic (vector out of range) in getReadoutRawString * fix key of caches * fix key of caches * fix key caches * fix cache keys * fix cache keys * move set variables to top * debug * fix key * testing * try fix changelog * test * Update Changelog.md for release * Revert "Update Changelog.md for release" This reverts commit4f51ec7962. * remove testing * fix release creation * testing * Update Changelog.md for release * test * Revert "Merge branch 'master' of https://github.com/haverland/AI-on-the-edge-device" This reverts commitf68695a4c0, reversing changes made toa096cf7182. * Revert "test" This reverts commita096cf7182. * revert testing Co-authored-by: github-actions <github-actions@github.com>
334 lines
11 KiB
YAML
334 lines
11 KiB
YAML
name: Build and Pack
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
#########################################################################################
|
|
## Build Firmware
|
|
#########################################################################################
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- id: skip_check
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
with:
|
|
concurrent_skipping: same_content_newer
|
|
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Set Variables
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
|
|
- 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 PlatformIO
|
|
run: |
|
|
python -m pip install --upgrade pip
|
|
pip install --upgrade platformio
|
|
|
|
- name: Build Firmware
|
|
#run: echo "Testing... ${{ github.ref_name }}, ${{ steps.vars.outputs.sha_short }}" > ./sd-card/html/version.txt; mkdir -p ./code/.pio/build/esp32cam/; cd ./code/.pio/build/esp32cam/; echo "${{ steps.vars.outputs.sha_short }}" > firmware.bin; cp firmware.bin partitions.bin; cp firmware.bin bootloader.bin # Testing
|
|
run: cd code; platformio run --environment esp32cam
|
|
|
|
- name: Store generated files in cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./code/.pio/build/esp32cam/firmware.bin
|
|
./code/.pio/build/esp32cam/partitions.bin
|
|
./code/.pio/build/esp32cam/bootloader.bin
|
|
./sd-card/html/version.txt
|
|
key: ${{ github.run_number }}
|
|
|
|
|
|
|
|
#########################################################################################
|
|
## Pack for old OTA (v1)
|
|
#########################################################################################
|
|
pack-for-OTA-v1:
|
|
# Old OTA concept
|
|
# firmware__*.zip needs to be unpacked before attaching to the release!
|
|
# The bin filename can contain versioning.
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Get generated files from cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./code/.pio/build/esp32cam/firmware.bin
|
|
./code/.pio/build/esp32cam/partitions.bin
|
|
./code/.pio/build/esp32cam/bootloader.bin
|
|
./sd-card/html/version.txt
|
|
key: ${{ github.run_number }}
|
|
|
|
- name: Set Variables
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
echo "branch=$(echo ${{ github.ref_name }} | tr / __)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Rename firmware file to contain versioning (old ota)
|
|
run: |
|
|
mkdir -p ./dist_old_ota
|
|
cp "./code/.pio/build/esp32cam/firmware.bin" "./dist_old_ota/firmware__${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }}).bin"
|
|
|
|
- name: Upload Firmware artifact (old OTA concept)
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
# name: "firmware__${{ github.ref_name }}__(${{ steps.vars.outputs.sha_short }})__(extract_before_upload__only_needed_for_migration_from_11.3.1)"
|
|
name: "firmware__(extract_before_upload)__${{ steps.vars.outputs.branch }}__(${{ steps.vars.outputs.sha_short }})"
|
|
path: ./dist_old_ota/*
|
|
|
|
- name: Upload Web interface artifact (old OTA concept)
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "html__${{ steps.vars.outputs.branch }}__(${{ steps.vars.outputs.sha_short }})"
|
|
path: ./sd-card/html/*
|
|
|
|
|
|
|
|
#########################################################################################
|
|
## Pack for new OTA (v2)
|
|
#########################################################################################
|
|
pack-for-OTA-v2:
|
|
# New OTA concept
|
|
# update__version.zip file with following content:
|
|
# - /firmware.bin
|
|
# - (optional) /html/*
|
|
# - (optional) /config/*.tfl
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Get generated files from cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./code/.pio/build/esp32cam/firmware.bin
|
|
./code/.pio/build/esp32cam/partitions.bin
|
|
./code/.pio/build/esp32cam/bootloader.bin
|
|
./sd-card/html/version.txt
|
|
key: ${{ github.run_number }}
|
|
|
|
- name: Set Variables
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
echo "branch=$(echo ${{ github.ref_name }} | tr / __)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Prepare update.zip artifact
|
|
run: |
|
|
mkdir -p ./dist
|
|
cp "./code/.pio/build/esp32cam/firmware.bin" "dist/firmware.bin"
|
|
|
|
# - name: Upload update.zip Artifact (Firmware only)
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: "update_firmware_only__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
|
|
# path: ./dist/*
|
|
|
|
- name: Add Web UI to dist
|
|
run: cp -r ./sd-card/html ./dist/
|
|
|
|
# - name: Upload update.zip artifact (Firmware + Web UI)
|
|
# uses: actions/upload-artifact@v3
|
|
# with:
|
|
# name: "update_firmware+webinterface__${{ github.ref_name }}_(${{ steps.vars.outputs.sha_short }})"
|
|
# path: ./dist/*
|
|
|
|
- name: Add CNN to dist
|
|
run: |
|
|
mkdir ./dist/config/
|
|
cp ./sd-card/config/*.tfl ./dist/config/ 2>/dev/null || true
|
|
cp ./sd-card/config/*.tflite ./dist/config/ 2>/dev/null || true
|
|
|
|
- name: Upload dist as update.zip artifact (Firmware + Web UI + CNN)
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "update__${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})"
|
|
path: ./dist/*
|
|
|
|
- name: Store generated files in cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: dist
|
|
key: ${{ github.run_number }}-pack-for-OTA-v2
|
|
|
|
|
|
|
|
|
|
#########################################################################################
|
|
## Pack for a fresh install (USB flashing) (initial_esp32_setup)
|
|
#########################################################################################
|
|
pack-for-fresh-install:
|
|
# creates old style binaries for fresh installation (backward compatible to wiki)
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
|
|
- name: Get generated files from cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./code/.pio/build/esp32cam/firmware.bin
|
|
./code/.pio/build/esp32cam/partitions.bin
|
|
./code/.pio/build/esp32cam/bootloader.bin
|
|
./sd-card/html/version.txt
|
|
key: ${{ github.run_number }}
|
|
|
|
- name: Set Variables
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
echo "branch=$(echo ${{ github.ref_name }} | tr / __)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Prepare artifacts for release
|
|
run: |
|
|
mkdir -p firmware
|
|
rm -rf firmware/*.zip
|
|
mkdir -p release
|
|
# copy builds to firmware folder
|
|
cp -f "./code/.pio/build/esp32cam/firmware.bin" "firmware/firmware.bin"
|
|
cp -f "./code/.pio/build/esp32cam/bootloader.bin" "firmware/bootloader.bin"
|
|
cp -f "./code/.pio/build/esp32cam/partitions.bin" "firmware/partitions.bin"
|
|
zip -r ./firmware/sd-card.zip sd-card
|
|
cd ./firmware
|
|
|
|
- name: Upload initial_esp32_setup.zip artifact (Firmware + Bootloader + Partitions + Web UI)
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: "initial_esp32_setup__${{ steps.vars.outputs.branch }}_(${{ steps.vars.outputs.sha_short }})"
|
|
path: ./firmware
|
|
|
|
- name: Store generated files in cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: firmware
|
|
key: ${{ github.run_number }}-pack-for-fresh-install
|
|
|
|
|
|
|
|
|
|
#########################################################################################
|
|
## Prepare and create release
|
|
#########################################################################################
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
needs: [pack-for-OTA-v2, pack-for-fresh-install]
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- name: Set Variables
|
|
id: vars
|
|
run: |
|
|
echo "sha_short=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
|
|
|
|
- name: Get generated files from cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
./code/.pio/build/esp32cam/firmware.bin
|
|
./code/.pio/build/esp32cam/partitions.bin
|
|
./code/.pio/build/esp32cam/bootloader.bin
|
|
./sd-card/html/version.txt
|
|
key: ${{ github.run_number }}
|
|
|
|
# import the changes from
|
|
- name: Get generated files from cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: dist
|
|
key: ${{ github.run_number }}-pack-for-OTA-v2
|
|
|
|
# import cached artifacts from pack-for-fresh-install
|
|
- name: Get generated files from cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: firmware
|
|
key: ${{ github.run_number }}-pack-for-fresh-install
|
|
|
|
|
|
|
|
- name: Prepare artifacts for release
|
|
run: |
|
|
mkdir -p release
|
|
mkdir -p dist
|
|
# create a update.zip like "update__rolling"
|
|
pwd
|
|
ls ./dist
|
|
cd ./dist
|
|
zip -r ../release/update.zip .
|
|
cd ../firmware
|
|
zip -r ../release/initial_esp32_setup.zip .
|
|
cd ../sd-card/html
|
|
zip -r ../../firmware/html-from-11.3.1.zip .
|
|
|
|
|
|
# extract the version used in next step
|
|
- id: get_version
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: battila7/get-version-action@v2
|
|
|
|
# the changelog [unreleased] will now be changed to the release version
|
|
- name: Update changelog
|
|
uses: thomaseizinger/keep-a-changelog-new-release@v1
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
changelogPath: Changelog.md
|
|
version: ${{ steps.get_version.outputs.version-without-v }}
|
|
|
|
# the release notes will be extracted from changelog
|
|
- name: Extract release notes
|
|
id: extract-release-notes
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
uses: ffurrer2/extract-release-notes@v1
|
|
with:
|
|
changelog_file: Changelog.md
|
|
|
|
|
|
# Releases should only be created on master by tagging the last commit.
|
|
# all artifacts in firmware folder pushed to the release
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
with:
|
|
name: ${{ steps.get_version.outputs.version-without-v }}
|
|
body: ${{ steps.extract-release-notes.outputs.release_notes }}
|
|
files: |
|
|
release/*
|
|
firmware/firmware.bin
|
|
firmware/html-from-11.3.1.zip
|
|
|
|
|
|
# Commit&Push Changelog to master branch. Must be manually merged back to rolling
|
|
- name: Commit changes and push changes
|
|
if: startsWith(github.ref, 'refs/tags/')
|
|
run: |
|
|
git config user.name github-actions
|
|
git config user.email github-actions@github.com
|
|
git add Changelog.md
|
|
git commit Changelog.md -m "Update Changelog.md for ${{github.event.inputs.versionIncrement}} release"
|
|
git push origin HEAD:master
|