updater_test.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: 'Updater test'
  2. on:
  3. pull_request:
  4. env:
  5. TARGETS: f7
  6. DEFAULT_TARGET: f7
  7. FBT_TOOLCHAIN_PATH: /opt
  8. jobs:
  9. test_updater_on_bench:
  10. runs-on: [self-hosted, FlipperZeroUpdaterTest]
  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. submodules: false
  27. ref: ${{ github.event.pull_request.head.sha }}
  28. - name: 'Get flipper from device manager (mock)'
  29. id: device
  30. run: |
  31. echo "flipper=Rekigyn" >> $GITHUB_OUTPUT
  32. echo "stlink=0F020D026415303030303032" >> $GITHUB_OUTPUT
  33. - name: 'Flashing target firmware'
  34. id: first_full_flash
  35. run: |
  36. source scripts/toolchain/fbtenv.sh
  37. ./fbt flash_usb_full PORT=${{steps.device.outputs.flipper}} FORCE=1
  38. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  39. - name: 'Validating updater'
  40. id: second_full_flash
  41. if: success()
  42. run: |
  43. source scripts/toolchain/fbtenv.sh
  44. ./fbt flash_usb PORT=${{steps.device.outputs.flipper}} FORCE=1
  45. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  46. - name: 'Get last release tag'
  47. id: release_tag
  48. if: failure()
  49. run: |
  50. echo "tag=$(git tag -l --sort=-version:refname | grep -v "rc\|RC" | head -1)" >> $GITHUB_OUTPUT
  51. - name: 'Decontaminate previous build leftovers'
  52. if: failure()
  53. run: |
  54. if [ -d .git ]; then
  55. git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
  56. fi
  57. - name: 'Checkout latest release'
  58. uses: actions/checkout@v3
  59. if: failure()
  60. with:
  61. fetch-depth: 1
  62. ref: ${{ steps.release_tag.outputs.tag }}
  63. - name: 'Flash last release'
  64. if: failure()
  65. run: |
  66. ./fbt flash OPENOCD_ADAPTER_SERIAL=${{steps.device.outputs.stlink}} FORCE=1
  67. - name: 'Wait for flipper and format ext'
  68. if: failure()
  69. run: |
  70. source scripts/toolchain/fbtenv.sh
  71. python3 scripts/testing/await_flipper.py ${{steps.device.outputs.flipper}}
  72. python3 scripts/storage.py -p ${{steps.device.outputs.flipper}} format_ext