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

View File

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

View File

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

View File

@ -9,6 +9,10 @@ on:
- '*' - '*'
pull_request: pull_request:
env:
FBT_TOOLCHAIN_PATH: /runner/_work
SET_GH_OUTPUT: 1
jobs: jobs:
lint_python: lint_python:
runs-on: [self-hosted,FlipperZeroShell] runs-on: [self-hosted,FlipperZeroShell]
@ -26,4 +30,4 @@ jobs:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: 'Check code formatting' - 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: push:
branches: branches:
- dev - dev
env:
FBT_TOOLCHAIN_PATH: /runner/_work
jobs: jobs:
merge_report: merge_report:
runs-on: [self-hosted,FlipperZeroShell] runs-on: [self-hosted,FlipperZeroShell]
@ -33,7 +37,7 @@ jobs:
- name: 'Check ticket and report' - name: 'Check ticket and report'
run: | run: |
FBT_TOOLCHAIN_PATH=/runner/_work source scripts/toolchain/fbtenv.sh source scripts/toolchain/fbtenv.sh
python3 -m pip install slack_sdk python3 -m pip install slack_sdk
python3 scripts/merge_report_qa.py \ python3 scripts/merge_report_qa.py \
${{ secrets.QA_REPORT_SLACK_TOKEN }} \ ${{ secrets.QA_REPORT_SLACK_TOKEN }} \

View File

@ -12,6 +12,7 @@ on:
env: env:
TARGETS: f7 TARGETS: f7
DEFAULT_TARGET: f7 DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /runner/_work
jobs: jobs:
analyse_c_cpp: analyse_c_cpp:
@ -49,11 +50,11 @@ jobs:
- name: 'Generate compile_comands.json' - name: 'Generate compile_comands.json'
run: | 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' - name: 'Static code analysis'
run: | 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 credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }}
pvs-studio-analyzer analyze \ pvs-studio-analyzer analyze \
@.pvsoptions \ @.pvsoptions \

View File

@ -6,6 +6,7 @@ on:
env: env:
TARGETS: f7 TARGETS: f7
DEFAULT_TARGET: f7 DEFAULT_TARGET: f7
FBT_TOOLCHAIN_PATH: /opt
jobs: jobs:
run_units_on_test_bench: run_units_on_test_bench:
@ -28,35 +29,81 @@ jobs:
run: | run: |
echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT 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' - name: 'Flash unit tests firmware'
id: flashing id: flashing
if: success()
run: | 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' - name: 'Wait for flipper to finish updating'
id: connect id: connect
if: steps.flashing.outcome == 'success' if: steps.flashing.outcome == 'success'
run: | run: |
. scripts/toolchain/fbtenv.sh source scripts/toolchain/fbtenv.sh
./scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}} python3 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
- name: 'Copy assets and unit tests data to flipper' - name: 'Copy assets and unit tests data to flipper'
id: copy id: copy
if: steps.format.outcome == 'success' if: steps.connect.outcome == 'success'
run: | run: |
. scripts/toolchain/fbtenv.sh source scripts/toolchain/fbtenv.sh
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/resources /ext python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests
./scripts/storage.py -p ${{steps.device.outputs.flipper}} send assets/unit_tests /ext/unit_tests
- name: 'Run units and validate results' - name: 'Run units and validate results'
if: steps.copy.outcome == 'success' if: steps.copy.outcome == 'success'
run: | run: |
. scripts/toolchain/fbtenv.sh source scripts/toolchain/fbtenv.sh
./scripts/testing/units.py ${{steps.device.outputs.flipper}} 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 "" return ""
UPDATE_TIMEOUT = 30 UPDATE_TIMEOUT = 60
def main(): def main():