Doom/Unit_tests flashing proper firmware (#2133)

* doom: should fix all issues, needs review
* fixed flash call and added port
* increased timeout, full flash wasn't completing
* turned serial back
* added unit formatting and force flag for overwriting files
* testing crash
* fixed step names, added release flashing, removed unit_tests from updater tests
* changed checkout method, added step validations
* removed duplicated tag
* fixed styling, stopped relying on shebang lines, removed debug output
* moved format to the end, flash_usb_full copies resourses already
* awaiting flipper after flashing and step status for file move

Co-authored-by: Konstantin Volkov <k.volkov@flipperdevices.com>
Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
Konstantin Volkov 2022-12-19 16:07:23 +03:00 committed by GitHub
parent 94453d9100
commit 36e15a1352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 85 additions and 25 deletions

View File

@ -11,6 +11,7 @@ on:
env:
TARGETS: f7
FBT_TOOLCHAIN_PATH: /opt
jobs:
amap_analyse:
@ -78,7 +79,7 @@ jobs:
- name: 'Upload report to DB'
run: |
FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh
source scripts/toolchain/fbtenv.sh
get_size()
{
SECTION="$1";

View File

@ -12,6 +12,7 @@ on:
env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /runner/_work
jobs:
main:
@ -55,7 +56,7 @@ jobs:
run: |
set -e
for TARGET in ${TARGETS}; do
FBT_TOOLCHAIN_PATH=/runner/_work ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \
./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \
copro_dist updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
done
@ -157,6 +158,6 @@ jobs:
run: |
set -e
for TARGET in ${TARGETS}; do
FBT_TOOLCHAIN_PATH=/runner/_work ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \
./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \
updater_package DEBUG=0 COMPACT=1
done

View File

@ -11,6 +11,8 @@ on:
env:
TARGETS: f7
FBT_TOOLCHAIN_PATH: /runner/_work
SET_GH_OUTPUT: 1
jobs:
lint_c_cpp:
@ -30,7 +32,7 @@ jobs:
- name: 'Check code formatting'
id: syntax_check
run: SET_GH_OUTPUT=1 FBT_TOOLCHAIN_PATH=/runner/_work ./fbt lint
run: ./fbt lint
- name: Report code formatting errors
if: failure() && steps.syntax_check.outputs.errors && github.event.pull_request

View File

@ -9,6 +9,10 @@ on:
- '*'
pull_request:
env:
FBT_TOOLCHAIN_PATH: /runner/_work
SET_GH_OUTPUT: 1
jobs:
lint_python:
runs-on: [self-hosted,FlipperZeroShell]
@ -26,4 +30,4 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }}
- name: 'Check code formatting'
run: SET_GH_OUTPUT=1 FBT_TOOLCHAIN_PATH=/runner/_work ./fbt lint_py
run: ./fbt lint_py

View File

@ -4,6 +4,10 @@ on:
push:
branches:
- dev
env:
FBT_TOOLCHAIN_PATH: /runner/_work
jobs:
merge_report:
runs-on: [self-hosted,FlipperZeroShell]
@ -33,7 +37,7 @@ jobs:
- name: 'Check ticket and report'
run: |
FBT_TOOLCHAIN_PATH=/runner/_work source scripts/toolchain/fbtenv.sh
source scripts/toolchain/fbtenv.sh
python3 -m pip install slack_sdk
python3 scripts/merge_report_qa.py \
${{ secrets.QA_REPORT_SLACK_TOKEN }} \

View File

@ -12,6 +12,7 @@ on:
env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /runner/_work
jobs:
analyse_c_cpp:
@ -49,11 +50,11 @@ jobs:
- name: 'Generate compile_comands.json'
run: |
FBT_TOOLCHAIN_PATH=/runner/_work ./fbt COMPACT=1 version_json proto_ver icons firmware_cdb dolphin_internal dolphin_blocking _fap_icons
./fbt COMPACT=1 version_json proto_ver icons firmware_cdb dolphin_internal dolphin_blocking _fap_icons
- name: 'Static code analysis'
run: |
FBT_TOOLCHAIN_PATH=/runner/_work source scripts/toolchain/fbtenv.sh
source scripts/toolchain/fbtenv.sh
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
pvs-studio-analyzer analyze \
@.pvsoptions \

View File

@ -6,6 +6,7 @@ on:
env:
TARGETS: f7
DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /opt
jobs:
run_units_on_test_bench:
@ -28,35 +29,81 @@ jobs:
run: |
echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT
- name: 'Flashing target firmware'
id: first_full_flash
run: |
./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
- name: 'Validating updater'
id: second_full_flash
if: success()
run: |
./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
- name: 'Flash unit tests firmware'
id: flashing
if: success()
run: |
FBT_TOOLCHAIN_PATH=/opt ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
- name: 'Wait for flipper to finish updating'
id: connect
if: steps.flashing.outcome == 'success'
run: |
. scripts/toolchain/fbtenv.sh
./scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
- name: 'Format flipper SD card'
id: format
if: steps.connect.outcome == 'success'
run: |
. scripts/toolchain/fbtenv.sh
./scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
- name: 'Copy assets and unit tests data to flipper'
id: copy
if: steps.format.outcome == 'success'
if: steps.connect.outcome == 'success'
run: |
. scripts/toolchain/fbtenv.sh
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/resources /ext
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/unit_tests /ext/unit_tests
source scripts/toolchain/fbtenv.sh
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests
- name: 'Run units and validate results'
if: steps.copy.outcome == 'success'
run: |
. scripts/toolchain/fbtenv.sh
./scripts/testing/units.py ${{steps.device.outputs.flipper}}
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/units.py ${{steps.device.outputs.flipper}}
- name: 'Get last release tag'
id: release_tag
if: success()
run: |
echo "tag=$(git tag -l --sort=-version:refname | grep -v "rc\|RC" | head -1)" >> $GITHUB_OUTPUT
- name: 'Decontaminate previous build leftovers'
if: success()
run: |
if [ -d .git ]; then
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout latest release'
uses: actions/checkout@v3
if: success()
with:
fetch-depth: 0
ref: ${{ steps.release_tag.outputs.tag }}
- name: 'Flash last release'
if: success()
run: |
./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
- name: 'Wait for flipper to finish updating'
if: success()
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
- name: 'Format flipper SD card'
id: format
if: success()
run: |
source scripts/toolchain/fbtenv.sh
python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext

View File

@ -24,7 +24,7 @@ def flp_serial_by_name(flp_name):
return ""
UPDATE_TIMEOUT = 30
UPDATE_TIMEOUT = 60
def main():