Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/release-candidate' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
skotopes committed Sep 6, 2022
2 parents ae9038d + 09148b2 commit 55b4632
Show file tree
Hide file tree
Showing 170 changed files with 5,479 additions and 620 deletions.
50 changes: 13 additions & 37 deletions .github/workflows/amap_analyse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ env:

jobs:
amap_analyse:
if: ${{ !github.event.pull_request.head.repo.fork }}
runs-on: [self-hosted,FlipperZeroMacShell]
timeout-minutes: 15
steps:
Expand All @@ -34,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'
Expand All @@ -44,52 +44,35 @@ jobs:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: 'Generate prefixes by commit'
id: names
- name: 'Get commit details'
run: |
REF="${{github.ref}}"
COMMIT_HASH="$(git rev-parse HEAD)"
SHA="$(git rev-parse --short HEAD)"
COMMIT_MSG="${{github.event.head_commit.message}}"
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}}"
PULL_NAME="${{github.event.pull_request.title}}"
TYPE="pull"
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TYPE="tag"
else
TYPE="other"
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}"
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE"
- name: 'Make artifacts directory'
run: |
rm -rf artifacts
mkdir artifacts
- name: 'Download build artifacts'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
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 }}${{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: |
Expand All @@ -98,26 +81,19 @@ 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}}"
export PULL_NAME="${{steps.names.outputs.pull-name}}"
fi
python3 -m pip install mariadb
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-${{steps.names.outputs.suffix}}.elf.map.all
artifacts/flipper-z-f7-firmware-$SUFFIX.elf.map.all
102 changes: 43 additions & 59 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@ jobs:
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`
if [ -d .git ]; then
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
Expand All @@ -33,64 +31,58 @@ jobs:

- name: 'Make artifacts directory'
run: |
test -d artifacts && rm -rf artifacts || true
rm -rf artifacts
mkdir artifacts
- name: 'Generate suffix and folder name'
id: names
- name: 'Get commit details'
run: |
REF=${{ github.ref }}
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
REF=${{ github.head_ref }}
fi
BRANCH_OR_TAG=${REF#refs/*/}
SHA=$(git rev-parse --short HEAD)
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
SUFFIX=${BRANCH_OR_TAG//\//_}
TYPE="pull"
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TYPE="tag"
else
SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA}
TYPE="other"
fi
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE"
echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV
echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV
echo "::set-output name=artifacts-path::${BRANCH_OR_TAG}"
- name: 'Generate suffixes for comment'
id: names
run: |
echo "::set-output name=branch_name::${BRANCH_NAME}"
echo "::set-output name=commit_sha::${COMMIT_SHA}"
echo "::set-output name=default_target::${DEFAULT_TARGET}"
echo "::set-output name=suffix::${SUFFIX}"
echo "::set-output name=short-hash::${SHA}"
echo "::set-output name=default-target::${DEFAULT_TARGET}"
- name: 'Bundle scripts'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
tar czpf artifacts/flipper-z-any-scripts-${{steps.names.outputs.suffix}}.tgz scripts
tar czpf artifacts/flipper-z-any-scripts-${SUFFIX}.tgz scripts
- name: 'Build the firmware'
run: |
set -e
for TARGET in ${TARGETS}
do
FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW=`echo ${TARGET} | sed 's/f//'` updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
for TARGET in ${TARGETS}; do
FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \
updater_package ${{ startsWith(github.ref, 'refs/tags') && 'DEBUG=0 COMPACT=1' || '' }}
done
- name: 'Move upload files'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
set -e
for TARGET in ${TARGETS}
do
for TARGET in ${TARGETS}; do
mv dist/${TARGET}-*/* artifacts/
done
- name: 'Bundle self-update package'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
set -e
for UPDATEBUNDLE in artifacts/*/
do
BUNDLE_NAME=`echo $UPDATEBUNDLE | cut -d'/' -f2`
echo Packaging ${BUNDLE_NAME}
tar czpf artifacts/flipper-z-${BUNDLE_NAME}.tgz -C artifacts ${BUNDLE_NAME}
rm -rf artifacts/${BUNDLE_NAME}
for UPDATEBUNDLE in artifacts/*/; do
BUNDLE_NAME="$(echo "$UPDATEBUNDLE" | cut -d'/' -f2)"
echo Packaging "${BUNDLE_NAME}"
tar czpf "artifacts/flipper-z-${BUNDLE_NAME}.tgz" -C artifacts "${BUNDLE_NAME}"
rm -rf "artifacts/${BUNDLE_NAME}"
done
- name: "Check for uncommitted changes"
Expand All @@ -100,17 +92,17 @@ jobs:
- name: 'Bundle resources'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
tar czpf artifacts/flipper-z-any-resources-${{steps.names.outputs.suffix}}.tgz -C assets resources
tar czpf "artifacts/flipper-z-any-resources-${SUFFIX}.tgz" -C assets resources
- name: 'Bundle core2 firmware'
if: ${{ !github.event.pull_request.head.repo.fork }}
run: |
FBT_TOOLCHAIN_PATH=/opt ./fbt copro_dist
tar czpf artifacts/flipper-z-any-core2_firmware-${{steps.names.outputs.suffix}}.tgz -C assets core2_firmware
tar czpf "artifacts/flipper-z-any-core2_firmware-${SUFFIX}.tgz" -C assets core2_firmware
- name: 'Copy .map file'
run: |
cp build/f7-firmware-*/firmware.elf.map artifacts/flipper-z-f7-firmware-${{steps.names.outputs.suffix}}.elf.map
cp build/f7-firmware-*/firmware.elf.map "artifacts/flipper-z-f7-firmware-${SUFFIX}.elf.map"
- name: 'Upload artifacts to update server'
if: ${{ !github.event.pull_request.head.repo.fork }}
Expand All @@ -119,7 +111,7 @@ jobs:
chmod 600 ./deploy_key;
rsync -avzP --delete --mkpath \
-e 'ssh -p ${{ secrets.RSYNC_DEPLOY_PORT }} -i ./deploy_key' \
artifacts/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${{steps.names.outputs.artifacts-path}}/";
artifacts/ ${{ secrets.RSYNC_DEPLOY_USER }}@${{ secrets.RSYNC_DEPLOY_HOST }}:"${{ secrets.RSYNC_DEPLOY_BASE_PATH }}${BRANCH_NAME}/";
rm ./deploy_key;
- name: 'Trigger update server reindex'
Expand All @@ -142,10 +134,10 @@ jobs:
comment-id: ${{ steps.fc.outputs.comment-id }}
issue-number: ${{ github.event.pull_request.number }}
body: |
**Compiled firmware for commit `${{steps.names.outputs.short-hash}}`:**
- [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz)
- [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-full-${{steps.names.outputs.suffix}}.dfu)
- [☁️ Web updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.artifacts-path}}/flipper-z-${{steps.names.outputs.default-target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.artifacts-path}}&version=${{steps.names.outputs.short-hash}})
**Compiled firmware for commit `${{steps.names.outputs.commit_sha}}`:**
- [📦 Update package](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz)
- [📥 DFU file](https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-full-${{steps.names.outputs.suffix}}.dfu)
- [☁️ Web updater](https://my.flipp.dev/?url=https://update.flipperzero.one/builds/firmware/${{steps.names.outputs.branch_name}}/flipper-z-${{steps.names.outputs.default_target}}-update-${{steps.names.outputs.suffix}}.tgz&channel=${{steps.names.outputs.branch_name}}&version=${{steps.names.outputs.commit_sha}})
edit-mode: replace

compact:
Expand All @@ -157,7 +149,7 @@ jobs:
if [ -d .git ]
then
git submodule status \
|| git checkout `git rev-list --max-parents=0 HEAD | tail -n 1`
|| git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
Expand All @@ -167,29 +159,21 @@ jobs:
submodules: true
ref: ${{ github.event.pull_request.head.sha }}

- name: 'Generate suffix and folder name'
id: names
- name: 'Get commit details'
run: |
REF=${{ github.ref }}
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
REF=${{ github.head_ref }}
fi
BRANCH_OR_TAG=${REF#refs/*/}
SHA=$(git rev-parse --short HEAD)
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
SUFFIX=${BRANCH_OR_TAG//\//_}
TYPE="pull"
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
TYPE="tag"
else
SUFFIX=${BRANCH_OR_TAG//\//_}-$(date +'%d%m%Y')-${SHA}
TYPE="other"
fi
echo "WORKFLOW_BRANCH_OR_TAG=${BRANCH_OR_TAG}" >> $GITHUB_ENV
echo "DIST_SUFFIX=${SUFFIX}" >> $GITHUB_ENV
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE"
- name: 'Build the firmware'
run: |
set -e
for TARGET in ${TARGETS}
do
FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW=`echo ${TARGET} | sed 's/f//'` updater_package DEBUG=0 COMPACT=1
for TARGET in ${TARGETS}; do
FBT_TOOLCHAIN_PATH=/opt ./fbt TARGET_HW="$(echo "${TARGET}" | sed 's/f//')" \
updater_package DEBUG=0 COMPACT=1
done
6 changes: 2 additions & 4 deletions .github/workflows/check_submodules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ jobs:
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`
if [ -d .git ]; then
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/lint_c.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,8 @@ jobs:
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`
if [ -d .git ]; then
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/lint_python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,8 @@ jobs:
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`
if [ -d .git ]; then
git submodule status || git checkout "$(git rev-list --max-parents=0 HEAD | tail -n 1)"
fi
- name: 'Checkout code'
Expand Down
Loading

0 comments on commit 55b4632

Please sign in to comment.