amap_analyse.yml 3.3 KB

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