name: 'Analyze .map file with Amap' on: repository_dispatch: types: [make_map_analyse] env: TARGETS: f7 FBT_TOOLCHAIN_PATH: /opt jobs: amap_analyse: runs-on: [self-hosted,FlipperZeroMacShell] timeout-minutes: 5 steps: - name: 'Decontaminate previous build leftovers' run: | if [ -d .git ]; then git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)" fi - name: 'Checkout code' uses: actions/checkout@v3 with: fetch-depth: 0 - name: 'Make artifacts directory' run: | rm -rf artifacts mkdir artifacts - name: 'Download build artifacts' run: | mkdir -p ~/.ssh ssh-keyscan -p ${{ secrets.RSYNC_DEPLOY_PORT }} -H ${{ secrets.RSYNC_DEPLOY_HOST }} > ~/.ssh/known_hosts echo "${{ secrets.RSYNC_DEPLOY_KEY }}" > deploy_key; chmod 600 ./deploy_key; rsync -avzP \ -e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{ github.event.client_payload.branch_name }}/" artifacts/; rm ./deploy_key; - name: 'Make .map file analyze' run: | cd artifacts/ /Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map" - name: 'Upload report to DB' run: | source scripts/toolchain/fbtenv.sh get_size() { SECTION="$1"; arm-none-eabi-size \ -A artifacts/flipper-z-f7-firmware-$SUFFIX.elf \ | grep "^$SECTION" | awk '{print $2}' } export BSS_SIZE="$(get_size ".bss")" export TEXT_SIZE="$(get_size ".text")" export RODATA_SIZE="$(get_size ".rodata")" export DATA_SIZE="$(get_size ".data")" export FREE_FLASH_SIZE="$(get_size ".free_flash")" python3 -m pip install mariadb==1.1.4 python3 scripts/amap_mariadb_insert.py \ ${{ secrets.AMAP_MARIADB_USER }} \ ${{ secrets.AMAP_MARIADB_PASSWORD }} \ ${{ secrets.AMAP_MARIADB_HOST }} \ ${{ secrets.AMAP_MARIADB_PORT }} \ ${{ secrets.AMAP_MARIADB_DATABASE }} \ artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all