2022-08-23 11:29:26 +00:00
|
|
|
name: 'Analyze .map file with Amap'
|
|
|
|
|
|
|
|
on:
|
2022-12-19 17:09:19 +00:00
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- dev
|
|
|
|
- "release*"
|
|
|
|
tags:
|
|
|
|
- '*'
|
|
|
|
pull_request:
|
2022-08-23 11:29:26 +00:00
|
|
|
|
|
|
|
env:
|
|
|
|
TARGETS: f7
|
2022-12-19 13:07:23 +00:00
|
|
|
FBT_TOOLCHAIN_PATH: /opt
|
2022-08-23 11:29:26 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
amap_analyse:
|
2022-12-19 17:09:19 +00:00
|
|
|
if: ${{ !github.event.pull_request.head.repo.fork }}
|
2022-08-23 11:29:26 +00:00
|
|
|
runs-on: [self-hosted,FlipperZeroMacShell]
|
2022-12-19 17:09:19 +00:00
|
|
|
timeout-minutes: 15
|
2022-08-23 11:29:26 +00:00
|
|
|
steps:
|
2022-12-19 17:09:19 +00:00
|
|
|
- name: 'Wait Build workflow'
|
|
|
|
uses: fountainhead/action-wait-for-check@v1.0.0
|
|
|
|
id: wait-for-build
|
|
|
|
with:
|
|
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
checkName: 'main'
|
|
|
|
ref: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
|
|
intervalSeconds: 20
|
|
|
|
|
|
|
|
- name: 'Check Build workflow status'
|
|
|
|
if: steps.wait-for-build.outputs.conclusion == 'failure'
|
|
|
|
run: |
|
|
|
|
exit 1
|
|
|
|
|
2022-08-23 11:29:26 +00:00
|
|
|
- name: 'Decontaminate previous build leftovers'
|
|
|
|
run: |
|
|
|
|
if [ -d .git ]; then
|
2022-09-03 07:09:03 +00:00
|
|
|
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
|
2022-08-23 11:29:26 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
- name: 'Checkout code'
|
2022-12-10 13:10:51 +00:00
|
|
|
uses: actions/checkout@v3
|
2022-08-23 11:29:26 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-12-19 17:09:19 +00:00
|
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
2022-08-23 11:29:26 +00:00
|
|
|
|
2022-12-19 16:42:06 +00:00
|
|
|
- name: 'Get commit details'
|
|
|
|
run: |
|
2022-12-19 17:09:19 +00:00
|
|
|
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
|
|
|
|
TYPE="pull"
|
|
|
|
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
|
|
|
|
TYPE="tag"
|
|
|
|
else
|
|
|
|
TYPE="other"
|
2022-12-19 16:42:06 +00:00
|
|
|
fi
|
2022-12-19 17:09:19 +00:00
|
|
|
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE"
|
2022-12-19 16:42:06 +00:00
|
|
|
|
2022-08-23 11:29:26 +00:00
|
|
|
- name: 'Make artifacts directory'
|
|
|
|
run: |
|
|
|
|
rm -rf artifacts
|
|
|
|
mkdir artifacts
|
|
|
|
|
|
|
|
- name: 'Download build artifacts'
|
|
|
|
run: |
|
2022-10-12 15:31:25 +00:00
|
|
|
mkdir -p ~/.ssh
|
|
|
|
ssh-keyscan -p ${{ secrets.RSYNC_DEPLOY_PORT }} -H ${{ secrets.RSYNC_DEPLOY_HOST }} > ~/.ssh/known_hosts
|
2022-08-23 11:29:26 +00:00
|
|
|
echo "${{ secrets.RSYNC_DEPLOY_KEY }}" > deploy_key;
|
|
|
|
chmod 600 ./deploy_key;
|
|
|
|
rsync -avzP \
|
|
|
|
-e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \
|
2022-12-19 17:09:19 +00:00
|
|
|
${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/" artifacts/;
|
2022-08-23 11:29:26 +00:00
|
|
|
rm ./deploy_key;
|
|
|
|
|
2022-08-24 15:14:27 +00:00
|
|
|
- name: 'Make .map file analyze'
|
2022-08-23 11:29:26 +00:00
|
|
|
run: |
|
|
|
|
cd artifacts/
|
2022-12-19 17:09:19 +00:00
|
|
|
/Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map"
|
2022-08-23 11:29:26 +00:00
|
|
|
|
|
|
|
- name: 'Upload report to DB'
|
|
|
|
run: |
|
2022-12-19 13:07:23 +00:00
|
|
|
source scripts/toolchain/fbtenv.sh
|
2022-08-23 11:29:26 +00:00
|
|
|
get_size()
|
|
|
|
{
|
|
|
|
SECTION="$1";
|
|
|
|
arm-none-eabi-size \
|
2022-09-03 07:09:03 +00:00
|
|
|
-A artifacts/flipper-z-f7-firmware-$SUFFIX.elf \
|
2022-08-23 11:29:26 +00:00
|
|
|
| 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")"
|
2022-11-08 16:56:49 +00:00
|
|
|
python3 -m pip install mariadb==1.1.4
|
2022-08-23 11:29:26 +00:00
|
|
|
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 }} \
|
2022-12-19 17:09:19 +00:00
|
|
|
artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all
|
2022-10-12 15:31:25 +00:00
|
|
|
|