diff --git a/.github/workflows/amap_analyse.yml b/.github/workflows/amap_analyse.yml index 6231c588..1340e4cd 100644 --- a/.github/workflows/amap_analyse.yml +++ b/.github/workflows/amap_analyse.yml @@ -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"; diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 99c272e6..2de0e57c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/lint_c.yml b/.github/workflows/lint_c.yml index 71ec24ff..a6fd5127 100644 --- a/.github/workflows/lint_c.yml +++ b/.github/workflows/lint_c.yml @@ -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 diff --git a/.github/workflows/lint_python.yml b/.github/workflows/lint_python.yml index 44f233db..66c36064 100644 --- a/.github/workflows/lint_python.yml +++ b/.github/workflows/lint_python.yml @@ -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 diff --git a/.github/workflows/merge_report.yml b/.github/workflows/merge_report.yml index b6c08905..13fab094 100644 --- a/.github/workflows/merge_report.yml +++ b/.github/workflows/merge_report.yml @@ -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 }} \ diff --git a/.github/workflows/pvs_studio.yml b/.github/workflows/pvs_studio.yml index 5473f19f..5bb04afc 100644 --- a/.github/workflows/pvs_studio.yml +++ b/.github/workflows/pvs_studio.yml @@ -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 \ diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml index 308ec592..361b647f 100644 --- a/.github/workflows/unit_tests.yml +++ b/.github/workflows/unit_tests.yml @@ -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 diff --git a/scripts/testing/await_flipper.py b/scripts/testing/await_flipper.py index 1f0d1619..efae6765 100755 --- a/scripts/testing/await_flipper.py +++ b/scripts/testing/await_flipper.py @@ -24,7 +24,7 @@ def flp_serial_by_name(flp_name): return "" -UPDATE_TIMEOUT = 30 +UPDATE_TIMEOUT = 60 def main():