Files
OpenBK7231T_App/.github/workflows/workflow.yaml
Bartosz Nitka 7e1afd0fdf [POC] Run berry-lang (#1544)
* setChannel(ch, v) in Berry

* try

* t2

* b

* fx

* update to berry with autogenerated files

* Add debug to find out whether the submodule is really checked out

* Revert "Add debug to find out whether the submodule is really checked out"

This reverts commit 40ec2f6677.

* Add src/berry checkout to every build

* berry separate file p1

* #define ENABLE_OBK_BERRY 1 on Beken only

* Compile in obkSimulator

Compiles, but crashes in parser.
Seems like the Berry code has not been tested under MSVC2017.

* Checkout with submodules in obkSimulator workflow

* berry with ffs msvc fix

* berry autogen fiasco fix

* OpenBK7231T compiles from official berry, handle prebuild

Breaks obkSimulator

* Fix botched rebase on .gitmodules

* Build in msvc with a berry prebuild step (requires python)

* MSVC: also extend include directories for Release

* Fix BK723x build, extract common berry build rules into berry.mk

* Fix OpenBL602 build

This doesn't actually compile berry for OpenBL602, but makes compile
errors go away and marks where further work will be needed.

* working delayMs

Test Plan:
```
berry state = 1; var tick; def tick() state = 1 - state; channelSet(1, state); delayMs(1000, tick); end; tick();
```
can be stopped with `stopAllScripts`

* only use os_realloc on PLATFORM_BK7231T

* Move as much berry logic as possible out of cmd_script

* Guard more with ENABLE_OBK_BERRY

* upload script

* file operations & working import

* enough to implement "Advanced turn off after time with timer on UI and timer setting on UI and kept in flash"

* experiments

* clang-format -i src/berry/be_*.{h,c} src/cmnds/cmd_berry.c

* Remove redundant hfile != NULL

Calling with hfile == NULL would be bug in some other part of the code

* Don't checkout other submodules for simulator build

* remove stray debug & .user files

* Use be_newcomobj

* Build sim on linux

* build linux sim [2]

* threads & tests

* Leave enabled on Windows, disable on BEKEN

* SIM_RunWindow fix?

* allow "startScript test.be" as a shorthand for "berry import test" ??

* test?

* fix /

* test arg

* test2

* test

* test add

* fx

* test

* just checking if i can use import without module?

* test with module

* CMD_StopBerry fix?

* run obk command from berry? probably not good idea due to the stack size, will delay execution later?

* str arg

* test to see if i have to repeat import

* submit unfinished code

* concat tst

* more tests

* fix copy/paste mistake, add fib test

* fx

* channelSet

* fx

* try

* tester.fib(11)

* rename

---------

Co-authored-by: Tester23 <85486843+openshwprojects@users.noreply.github.com>
Co-authored-by: NonPIayerCharacter <18557343+NonPIayerCharacter@users.noreply.github.com>
2025-03-30 20:37:37 +02:00

281 lines
11 KiB
YAML

name: Build App
on:
push:
branches:
- '**'
pull_request:
branches:
- '**'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
APP_NAME: ${{ github.event.repository.name }}
jobs:
refs:
name: Prepare CI Environment
runs-on: ubuntu-22.04
outputs:
sha_short: ${{ steps.refs.outputs.sha_short }}
short_ref: ${{ steps.refs.outputs.short_ref }}
version: ${{ steps.refs.outputs.version }}
new_release: ${{ steps.refs.outputs.new_release }}
steps:
- name: Source checkout
uses: actions/checkout@v4
- name: Update SDKs if required
run: make update-submodules
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: true
semantic_version: 21
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits@7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set outputs
id: refs
run: |
export BRANCH=${GITHUB_REF#refs/*/}
echo "branch: ${BRANCH}"
export BRANCHTRANSLATED=$(echo ${BRANCH} | tr '/' '_')
echo "short_ref: ${BRANCHTRANSLATED}"
export VERSION=""
if ${{ steps.semantic.outputs.new_release_published == 'true' }}; then
export VERSION=${{ steps.semantic.outputs.new_release_version }}
else
export VERSION=${BRANCHTRANSLATED}_$(git rev-parse --short=12 HEAD)
fi
echo "new_release=${{ steps.semantic.outputs.new_release_published }}" >> $GITHUB_OUTPUT
echo "short_ref=${BRANCHTRANSLATED}" >> $GITHUB_OUTPUT
echo "sha_short=SHA-$(git rev-parse --short=12 HEAD)" >> $GITHUB_OUTPUT
echo "version=${VERSION}" >> $GITHUB_OUTPUT
build2:
name: Build Simulator
needs: refs
runs-on: windows-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Checkout berry submodule
run: |
git submodule update --init --recursive libraries/berry
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
- name: Checkout simulator repository
run: |
git clone https://github.com/openshwprojects/obkSimulator
mkdir -p ./libs_for_simulator
cp -r ./obkSimulator/simulator/libs_for_simulator/* ./libs_for_simulator
- name: Build project
run: msbuild openBeken_win32_mvsc2017.vcxproj /p:Configuration=Release /p:PlatformToolset=v143
- name: Flatten build assets
run: |
mkdir -p flat
cp ./Release/openBeken_win32.exe flat/
cp ./obkSimulator/simulator/*.dll flat/
cp ./run_*.bat flat/
mkdir -p flat/examples
cp -r ./obkSimulator/examples/* flat/examples/
- name: Run unit tests
run: |
./flat/openBeken_win32.exe -runUnitTests 2
- name: Compress build assets
run: |
Compress-Archive -Path flat/* -DestinationPath obkSimulator_win32_${{ needs.refs.outputs.version }}.zip
- name: Copy build assets
run: |
mkdir -Force output/${{ needs.refs.outputs.version }}
cp obkSimulator_win32_${{ needs.refs.outputs.version }}.zip output/${{ needs.refs.outputs.version }}/obkSimulator_${{ needs.refs.outputs.version }}.zip
- name: Upload build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_sim
path: output/${{ needs.refs.outputs.version }}/obkSimulator_${{ needs.refs.outputs.version }}.zip
build:
name: Build
needs: refs
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
platform: [OpenBK7231N, OpenBK7238, OpenXR809, OpenBL602, OpenW800, OpenW600, OpenLN882H, OpenTR6260, OpenRTL8710A, OpenRTL8710B, OpenRTL87X0C, OpenRTL8720D, OpenECR6600]
steps:
- name: Source checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
architecture: 'x64'
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install libc6-i386 make cmake gcc-arm-none-eabi
pip3 install pycryptodomex
pip3 install configobj
pip3 install toml
pip3 install fdt
- run: ls -la
- name: Run make
run: make APP_VERSION=${{ needs.refs.outputs.version }} APP_NAME=${{ matrix.platform }} ${{ matrix.platform }}
- name: Save build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_${{ matrix.platform }}
path: |
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_UA_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_UG_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_QIO_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/OpenBK7231M_QIO_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.rbl
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.fls
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_ota.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_gz.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_OTA.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_OTA.bin.xz
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}_OTA.bin.xz.ota
if-no-files-found: warn
build2004:
name: Build
needs: refs
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
platform: [OpenBK7231T]
steps:
- name: Source checkout
uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'
architecture: 'x64'
- name: Install dependencies
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get -y install libc6-i386 make cmake gcc-arm-none-eabi
pip3 install pycryptodomex
pip3 install configobj
pip3 install toml
pip3 install fdt
- run: ls -la
- name: Run make
run: make APP_VERSION=${{ needs.refs.outputs.version }} APP_NAME=${{ matrix.platform }} ${{ matrix.platform }}
- name: Save build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_${{ matrix.platform }}
path: |
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_UA_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_UG_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_QIO_${{ needs.refs.outputs.version }}.bin
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.rbl
if-no-files-found: warn
build_idf:
name: Build IDF
needs: refs
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
platform: [OpenESP32, OpenESP32C3, OpenESP32C2, OpenESP32C6, OpenESP32S3, OpenESP32S2]
steps:
- name: Source checkout
uses: actions/checkout@v4
- name: SDK checkout
uses: actions/checkout@v4
with:
repository: espressif/esp-idf
path: sdk/esp-idf
ref: v5.3.2
submodules: recursive
- uses: actions/setup-python@v5
with:
python-version: '3.8'
architecture: 'x64'
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get -y install make cmake python3-venv
pip3 install pycryptodomex
pip3 install configobj
pip3 install toml
pip3 install fdt
- name: Run make
run: |
cd sdk/esp-idf
./install.sh > /dev/null
. ./export.sh
. ./add_path.sh
cd ../..
make APP_VERSION=${{ needs.refs.outputs.version }} APP_NAME=${{ matrix.platform }} ${{ matrix.platform }}
- name: Save build assets
uses: actions/upload-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}_${{ matrix.platform }}
path: |
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.img
output/${{ needs.refs.outputs.version }}/${{ matrix.platform }}_${{ needs.refs.outputs.version }}.factory.bin
if-no-files-found: warn
merge:
name: Merge Artifacts
runs-on: ubuntu-22.04
needs: [refs, build, build2004, build2, build_idf]
#if: always() && needs.refs.outputs.new_release == 'true' && (github.ref == 'refs/heads/main' || github.ref_name == 'alpha')
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}
#delete-merged: true
release:
name: Semantic Release Images and Artifacts
runs-on: ubuntu-22.04
needs: [merge, refs]
if: always() && needs.refs.outputs.new_release == 'true' && (github.ref == 'refs/heads/main' || github.ref_name == 'alpha')
steps:
- name: Source checkout
uses: actions/checkout@v4
- name: Fetch build assets
uses: actions/download-artifact@v4
with:
name: ${{ env.APP_NAME }}_${{ needs.refs.outputs.version }}
path: output/${{ needs.refs.outputs.version }}
- name: Run Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
with:
dry_run: false
semantic_version: 21
extra_plugins: |
@semantic-release/changelog
@semantic-release/git
conventional-changelog-conventionalcommits@7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Echo Semantic Release Versions
if: steps.semantic.outputs.new_release_published == 'true'
run: |
echo ${{ steps.semantic.outputs.new_release_version }}
echo ${{ steps.semantic.outputs.new_release_major_version }}
echo ${{ steps.semantic.outputs.new_release_minor_version }}
echo ${{ steps.semantic.outputs.new_release_patch_version }}