unit_tests.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. name: 'Unit tests'
  2. on:
  3. pull_request:
  4. env:
  5. TARGETS: f7
  6. DEFAULT_TARGET: f7
  7. FBT_TOOLCHAIN_PATH: /opt
  8. jobs:
  9. run_units_on_bench:
  10. runs-on: [self-hosted, FlipperZeroUnitTest]
  11. steps:
  12. - name: 'Decontaminate previous build leftovers'
  13. run: |
  14. if [ -d .git ]; then
  15. git submodule status || (
  16. git ls-files --stage | egrep '^160000' | awk '{print $4}' | while read submodule
  17. do
  18. git rm -rf --cached "$submodule"
  19. done
  20. )
  21. fi
  22. - name: Checkout code
  23. uses: actions/checkout@v3
  24. with:
  25. fetch-depth: 1
  26. ref: ${{ github.event.pull_request.head.sha }}
  27. - name: 'Get flipper from device manager (mock)'
  28. id: device
  29. run: |
  30. echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT
  31. - name: 'Flash unit tests firmware'
  32. id: flashing
  33. if: success()
  34. run: |
  35. ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
  36. - name: 'Wait for flipper and format ext'
  37. id: format_ext
  38. if: steps.flashing.outcome == 'success'
  39. run: |
  40. source scripts/toolchain/fbtenv.sh
  41. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  42. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
  43. - name: 'Copy assets and unit data, reboot and wait for flipper'
  44. id: copy
  45. if: steps.format_ext.outcome == 'success'
  46. run: |
  47. source scripts/toolchain/fbtenv.sh
  48. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/resources /ext
  49. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests
  50. python3 scripts/power.py -p ${{steps.device.outputs.flipper}} reboot
  51. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  52. - name: 'Run units and validate results'
  53. id: run_units
  54. if: steps.copy.outcome == 'success'
  55. timeout-minutes: 2.5
  56. run: |
  57. source scripts/toolchain/fbtenv.sh
  58. python3 scripts/testing/units.py ${{steps.device.outputs.flipper}}
  59. - name: 'Check GDB output'
  60. if: failure()
  61. run: |
  62. ./fbt gdb_trace_all OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1