mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-23 05:14:16 +03:00
3932503660
* github: testing SDK with ufbt action * github: also build apps with ufbt * github: fixed dir lookup for ufbt * ufbt: checks for compatibility on app discovery * github: Conditional app skip for ufbt * github: fixed app build flow with ufbt * extra debug * github: lint: message capture * github: testing different output capture method for linters * shorter version of status check * github: updated comment actions to suppress warnings * Reverted formatting changes Co-authored-by: あく <alleteam@gmail.com>
91 lines
3.0 KiB
YAML
91 lines
3.0 KiB
YAML
name: 'Lint sources & check submodule integrity'
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- dev
|
|
- "release*"
|
|
tags:
|
|
- '*'
|
|
pull_request:
|
|
|
|
env:
|
|
TARGETS: f7
|
|
FBT_TOOLCHAIN_PATH: /runner/_work
|
|
SET_GH_OUTPUT: 1
|
|
|
|
jobs:
|
|
lint_sources_check_submodules:
|
|
runs-on: [self-hosted,FlipperZeroShell]
|
|
steps:
|
|
- name: 'Wipe workspace'
|
|
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
|
|
|
|
- name: 'Checkout code'
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 1
|
|
ref: ${{ github.event.pull_request.head.sha }}
|
|
|
|
|
|
- name: 'Check protobuf branch'
|
|
run: |
|
|
git submodule update --init
|
|
SUB_PATH="assets/protobuf";
|
|
SUB_BRANCH="dev";
|
|
SUB_COMMITS_MIN=40;
|
|
cd "$SUB_PATH";
|
|
SUBMODULE_HASH="$(git rev-parse HEAD)";
|
|
BRANCHES=$(git branch -r --contains "$SUBMODULE_HASH");
|
|
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
|
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
|
echo "name=fails::error" >> $GITHUB_OUTPUT;
|
|
echo "::error::Error: Too few commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
|
exit 1;
|
|
fi
|
|
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
|
echo "name=fails::error" >> $GITHUB_OUTPUT;
|
|
echo "::error::Error: Submodule $SUB_PATH is not on branch $SUB_BRANCH";
|
|
exit 1;
|
|
fi
|
|
|
|
- name: 'Check Python code formatting'
|
|
id: syntax_check_py
|
|
run: |
|
|
set +e;
|
|
./fbt -s lint_py 2>&1 | tee lint-py.log;
|
|
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
|
# Save multiline output
|
|
echo "errors=1" >> $GITHUB_OUTPUT;
|
|
printf "Python Lint errors:\n\`\`\`\n" >> $GITHUB_STEP_SUMMARY;
|
|
echo "$(cat lint-py.log)" >> $GITHUB_STEP_SUMMARY;
|
|
printf "\n\`\`\`\n" >> $GITHUB_STEP_SUMMARY;
|
|
exit 1;
|
|
else
|
|
echo "Python Lint: all good ✨" >> $GITHUB_STEP_SUMMARY;
|
|
fi
|
|
|
|
- name: 'Check C++ code formatting'
|
|
id: syntax_check_cpp
|
|
if: always()
|
|
run: |
|
|
set +e;
|
|
./fbt -s lint 2>&1 | tee lint-cpp.log;
|
|
if [ "${PIPESTATUS[0]}" -ne 0 ]; then
|
|
# Save multiline output
|
|
echo "errors=1" >> $GITHUB_OUTPUT;
|
|
printf "C Lint errors:\n\`\`\`\n" >> $GITHUB_STEP_SUMMARY;
|
|
echo "$(cat lint-cpp.log)" >> $GITHUB_STEP_SUMMARY;
|
|
printf "\n\`\`\`\n" >> $GITHUB_STEP_SUMMARY;
|
|
exit 1;
|
|
else
|
|
echo "C Lint: all good ✨" >> $GITHUB_STEP_SUMMARY;
|
|
fi
|
|
|
|
- name: Report code formatting errors
|
|
if: ( steps.syntax_check_py.outputs.errors || steps.syntax_check_cpp.outputs.errors ) && github.event.pull_request
|
|
run: |
|
|
echo "Code formatting errors found";
|
|
echo "Please run './fbt format' or './fbt format_py' to fix them";
|
|
exit 1;
|