Amap workflow, "toolchain improvements" (#1685)
* fix quotes in amap * try to fix quotes * try to read "commit_message" * Add new actions anv parser * fix amap_anayse * fix script ssl error * test build with new get commit details method * fix build.yml * add fbt envs to get_env.py * fix envs * using new commit info "way" * try to fix report link in PR page * fix "pvs_studio.yml" again * fix vars * fix "build.yml" Co-authored-by: あく <alleteam@gmail.com>
This commit is contained in:
@@ -35,8 +35,7 @@ jobs:
|
||||
- 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`
|
||||
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
|
||||
fi
|
||||
|
||||
- name: 'Checkout code'
|
||||
@@ -45,44 +44,14 @@ jobs:
|
||||
fetch-depth: 0
|
||||
ref: ${{ github.event.pull_request.head.sha }}
|
||||
|
||||
- name: 'Escape pull request title'
|
||||
if: github.event_name == 'pull_request'
|
||||
- name: 'Get commit details'
|
||||
run: |
|
||||
import json
|
||||
import os
|
||||
import shlex
|
||||
with open('${{ github.event_path }}') as fh:
|
||||
event = json.load(fh)
|
||||
escaped = shlex.quote(event['pull_request']['title'])
|
||||
with open(os.environ['GITHUB_ENV'], 'a') as fh:
|
||||
print(f'PULL_NAME={escaped}', file=fh)
|
||||
shell: python3 {0}
|
||||
|
||||
- name: 'Generate prefixes by commit'
|
||||
id: names
|
||||
run: |
|
||||
REF="${{github.ref}}"
|
||||
COMMIT_HASH="$(git rev-parse HEAD)"
|
||||
SHA="$(git rev-parse --short HEAD)"
|
||||
COMMIT_MSG="${{github.event.head_commit.message}}"
|
||||
FBT_TOOLCHAIN_PATH=/opt source scripts/toolchain/fbtenv.sh
|
||||
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
|
||||
REF="${{github.head_ref}}"
|
||||
COMMIT_HASH="$(git log -1 --pretty=oneline | awk '{print $1}')"
|
||||
SHA="$(cut -c -8 <<< "$COMMIT_HASH")"
|
||||
COMMIT_MSG="$(git log -1 --pretty=format:"%s")"
|
||||
PULL_ID="${{github.event.pull_request.number}}"
|
||||
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--is_pull"
|
||||
else
|
||||
python3 scripts/get_env.py "--event_file=${{ github.event_path }}"
|
||||
fi
|
||||
BRANCH_NAME=${REF#refs/*/}
|
||||
SUFFIX=${BRANCH_NAME//\//_}-$(date +'%d%m%Y')-${SHA}
|
||||
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
|
||||
SUFFIX=${BRANCH_NAME//\//_}
|
||||
fi
|
||||
echo "::set-output name=commit-hash::${COMMIT_HASH}"
|
||||
echo "::set-output name=commit-msg::${COMMIT_MSG}"
|
||||
echo "::set-output name=pull-id::${PULL_ID}"
|
||||
echo "::set-output name=pull-name::${PULL_NAME}"
|
||||
echo "::set-output name=branch-name::${BRANCH_NAME}"
|
||||
echo "::set-output name=suffix::${SUFFIX}"
|
||||
|
||||
- name: 'Make artifacts directory'
|
||||
run: |
|
||||
@@ -95,13 +64,13 @@ jobs:
|
||||
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 }}${{steps.names.outputs.branch-name}}/" artifacts/;
|
||||
${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/" artifacts/;
|
||||
rm ./deploy_key;
|
||||
|
||||
- name: 'Make .map file analyze'
|
||||
run: |
|
||||
cd artifacts/
|
||||
/Applications/amap/Contents/MacOS/amap -f flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf.map
|
||||
/Applications/amap/Contents/MacOS/amap -f "flipper-z-f7-firmware-${SUFFIX}.elf.map"
|
||||
|
||||
- name: 'Upload report to DB'
|
||||
run: |
|
||||
@@ -110,20 +79,14 @@ jobs:
|
||||
{
|
||||
SECTION="$1";
|
||||
arm-none-eabi-size \
|
||||
-A artifacts/flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf \
|
||||
-A artifacts/flipper-z-f7-firmware-$SUFFIX.elf \
|
||||
| grep "^$SECTION" | awk '{print $2}'
|
||||
}
|
||||
export COMMIT_HASH="${{steps.names.outputs.commit-hash}}"
|
||||
export COMMIT_MSG="${{steps.names.outputs.commit-msg}}"
|
||||
export BRANCH_NAME="${{steps.names.outputs.branch-name}}"
|
||||
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")"
|
||||
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
|
||||
export PULL_ID="${{steps.names.outputs.pull-id}}"
|
||||
fi
|
||||
python3 -m pip install mariadb
|
||||
python3 scripts/amap_mariadb_insert.py \
|
||||
${{ secrets.AMAP_MARIADB_USER }} \
|
||||
@@ -131,4 +94,4 @@ jobs:
|
||||
${{ secrets.AMAP_MARIADB_HOST }} \
|
||||
${{ secrets.AMAP_MARIADB_PORT }} \
|
||||
${{ secrets.AMAP_MARIADB_DATABASE }} \
|
||||
artifacts/flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf.map.all
|
||||
artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all
|
||||
|
||||
Reference in New Issue
Block a user