amap_analyse.yml 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. name: 'Analyze .map file with Amap'
  2. on:
  3. push:
  4. branches:
  5. - dev
  6. - "release*"
  7. tags:
  8. - '*'
  9. pull_request:
  10. env:
  11. TARGETS: f7
  12. jobs:
  13. amap_analyse:
  14. if: ${{ !github.event.pull_request.head.repo.fork }}
  15. runs-on: [self-hosted,FlipperZeroMacShell]
  16. timeout-minutes: 15
  17. steps:
  18. - name: 'Wait Build workflow'
  19. uses: fountainhead/action-wait-for-check@v1.0.0
  20. id: wait-for-build
  21. with:
  22. token: ${{ secrets.GITHUB_TOKEN }}
  23. checkName: 'main'
  24. ref: ${{ github.event.pull_request.head.sha || github.sha }}
  25. intervalSeconds: 20
  26. - name: 'Check Build workflow status'
  27. if: steps.wait-for-build.outputs.conclusion == 'failure'
  28. run: |
  29. exit 1
  30. - name: 'Decontaminate previous build leftovers'
  31. run: |
  32. if [ -d .git ]; then
  33. git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
  34. fi
  35. - name: 'Checkout code'
  36. uses: actions/checkout@v2
  37. with:
  38. fetch-depth: 0
  39. ref: ${{ github.event.pull_request.head.sha }}
  40. - name: 'Get commit details'
  41. run: |
  42. FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh
  43. if [[ ${{ github.event_name }} == 'pull_request' ]]; then
  44. python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--is_pull"
  45. else
  46. python3 scripts/get_env.py "--event_file=${{ github.event_path }}"
  47. fi
  48. - name: 'Make artifacts directory'
  49. run: |
  50. rm -rf artifacts
  51. mkdir artifacts
  52. - name: 'Download build artifacts'
  53. run: |
  54. echo "${{ secrets.RSYNC_DEPLOY_KEY }}" > deploy_key;
  55. chmod 600 ./deploy_key;
  56. rsync -avzP \
  57. -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \
  58. ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/" artifacts/;
  59. rm ./deploy_key;
  60. - name: 'Make .map file analyze'
  61. run: |
  62. cd artifacts/
  63. /Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map"
  64. - name: 'Upload report to DB'
  65. run: |
  66. FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh
  67. get_size()
  68. {
  69. SECTION="$1";
  70. arm-none-eabi-size \
  71. -A artifacts/flipper-z-f7-firmware-$SUFFIX.elf \
  72. | grep "^$SECTION" | awk '{print $2}'
  73. }
  74. export BSS_SIZE="$(get_size ".bss")"
  75. export TEXT_SIZE="$(get_size ".text")"
  76. export RODATA_SIZE="$(get_size ".rodata")"
  77. export DATA_SIZE="$(get_size ".data")"
  78. export FREE_FLASH_SIZE="$(get_size ".free_flash")"
  79. python3 -m pip install mariadb
  80. python3 scripts/amap_mariadb_insert.py \
  81. ${{ secrets.AMAP_MARIADB_USER }} \
  82. ${{ secrets.AMAP_MARIADB_PASSWORD }} \
  83. ${{ secrets.AMAP_MARIADB_HOST }} \
  84. ${{ secrets.AMAP_MARIADB_PORT }} \
  85. ${{ secrets.AMAP_MARIADB_DATABASE }} \
  86. artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all