unit_tests.yml 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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: 'Wipe workspace'
  13. run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
  14. - name: Checkout code
  15. uses: actions/checkout@v3
  16. with:
  17. fetch-depth: 1
  18. ref: ${{ github.event.pull_request.head.sha }}
  19. - name: 'Get flipper from device manager (mock)'
  20. id: device
  21. run: |
  22. echo "flipper=/dev/ttyACM0" >> $GITHUB_OUTPUT
  23. - name: 'Flash unit tests firmware'
  24. id: flashing
  25. if: success()
  26. run: |
  27. ./fbt flash OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1
  28. - name: 'Wait for flipper and format ext'
  29. id: format_ext
  30. if: steps.flashing.outcome == 'success'
  31. run: |
  32. source scripts/toolchain/fbtenv.sh
  33. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  34. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext
  35. - name: 'Copy assets and unit data, reboot and wait for flipper'
  36. id: copy
  37. if: steps.format_ext.outcome == 'success'
  38. run: |
  39. source scripts/toolchain/fbtenv.sh
  40. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/resources /ext
  41. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} -f send assets/unit_tests /ext/unit_tests
  42. python3 scripts/power.py -p ${{steps.device.outputs.flipper}} reboot
  43. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  44. - name: 'Run units and validate results'
  45. id: run_units
  46. if: steps.copy.outcome == 'success'
  47. timeout-minutes: 2.5
  48. run: |
  49. source scripts/toolchain/fbtenv.sh
  50. python3 scripts/testing/units.py ${{steps.device.outputs.flipper}}
  51. - name: 'Check GDB output'
  52. if: failure()
  53. run: |
  54. ./fbt gdb_trace_all OPENOCD_ADAPTER_SERIAL=2A0906016415303030303032 FIRMWARE_APP_SET=unit_tests FORCE=1