[FL-3243] github: testing SDK with ufbt action (#2581)
* 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>
This commit is contained in:
parent
e0fa2e7b12
commit
3932503660
42
.github/workflows/build.yml
vendored
42
.github/workflows/build.yml
vendored
@ -139,7 +139,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 'Find Previous Comment'
|
- name: 'Find Previous Comment'
|
||||||
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request }}
|
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request }}
|
||||||
uses: peter-evans/find-comment@v1
|
uses: peter-evans/find-comment@v2
|
||||||
id: fc
|
id: fc
|
||||||
with:
|
with:
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
@ -148,7 +148,7 @@ jobs:
|
|||||||
|
|
||||||
- name: 'Create or update comment'
|
- name: 'Create or update comment'
|
||||||
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request}}
|
if: ${{ !github.event.pull_request.head.repo.fork && github.event.pull_request}}
|
||||||
uses: peter-evans/create-or-update-comment@v1
|
uses: peter-evans/create-or-update-comment@v3
|
||||||
with:
|
with:
|
||||||
comment-id: ${{ steps.fc.outputs.comment-id }}
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
||||||
issue-number: ${{ github.event.pull_request.number }}
|
issue-number: ${{ github.event.pull_request.number }}
|
||||||
@ -162,6 +162,9 @@ jobs:
|
|||||||
compact:
|
compact:
|
||||||
if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
if: ${{ !startsWith(github.ref, 'refs/tags') }}
|
||||||
runs-on: [self-hosted,FlipperZeroShell]
|
runs-on: [self-hosted,FlipperZeroShell]
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
target: [f7, f18]
|
||||||
steps:
|
steps:
|
||||||
- name: 'Wipe workspace'
|
- name: 'Wipe workspace'
|
||||||
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
|
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
|
||||||
@ -185,9 +188,40 @@ jobs:
|
|||||||
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" || cat "${{ github.event_path }}"
|
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" || cat "${{ github.event_path }}"
|
||||||
|
|
||||||
- name: 'Build the firmware'
|
- name: 'Build the firmware'
|
||||||
|
id: build-fw
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
for TARGET in ${TARGETS}; do
|
TARGET="$(echo '${{ matrix.target }}' | sed 's/f//')"; \
|
||||||
TARGET="$(echo "${TARGET}" | sed 's/f//')"; \
|
|
||||||
./fbt TARGET_HW=$TARGET DEBUG=0 COMPACT=1 fap_dist updater_package
|
./fbt TARGET_HW=$TARGET DEBUG=0 COMPACT=1 fap_dist updater_package
|
||||||
|
echo "sdk-file=$(ls dist/${{ matrix.target }}-*/flipper-z-${{ matrix.target }}-sdk-*.zip)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Deploy uFBT with SDK
|
||||||
|
uses: flipperdevices/flipperzero-ufbt-action@v0.1.0
|
||||||
|
with:
|
||||||
|
task: setup
|
||||||
|
sdk-file: ${{ steps.build-fw.outputs.sdk-file }}
|
||||||
|
|
||||||
|
- name: Build test app with SDK
|
||||||
|
run: |
|
||||||
|
mkdir testapp
|
||||||
|
cd testapp
|
||||||
|
ufbt create APPID=testapp
|
||||||
|
ufbt
|
||||||
|
|
||||||
|
- name: Build example & external apps with uFBT
|
||||||
|
run: |
|
||||||
|
for appdir in 'applications/external' 'applications/examples'; do
|
||||||
|
for app in $(find "$appdir" -maxdepth 1 -mindepth 1 -type d); do
|
||||||
|
pushd $app
|
||||||
|
TARGETS_FAM=$(grep "targets" application.fam || echo "${{ matrix.target }}")
|
||||||
|
if ! grep -q "${{ matrix.target }}" <<< $TARGETS_FAM ; then
|
||||||
|
echo Skipping unsupported app: $app
|
||||||
|
popd
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
echo Building $app
|
||||||
|
ufbt
|
||||||
|
popd
|
||||||
done
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
32
.github/workflows/lint_and_submodule_check.yml
vendored
32
.github/workflows/lint_and_submodule_check.yml
vendored
@ -40,7 +40,7 @@ jobs:
|
|||||||
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
COMMITS_IN_BRANCH="$(git rev-list --count dev)";
|
||||||
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
if [ $COMMITS_IN_BRANCH -lt $SUB_COMMITS_MIN ]; then
|
||||||
echo "name=fails::error" >> $GITHUB_OUTPUT;
|
echo "name=fails::error" >> $GITHUB_OUTPUT;
|
||||||
echo "::error::Error: Too low commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
echo "::error::Error: Too few commits in $SUB_BRANCH of submodule $SUB_PATH: $COMMITS_IN_BRANCH(expected $SUB_COMMITS_MIN+)";
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
if ! grep -q "/$SUB_BRANCH" <<< "$BRANCHES"; then
|
||||||
@ -51,12 +51,36 @@ jobs:
|
|||||||
|
|
||||||
- name: 'Check Python code formatting'
|
- name: 'Check Python code formatting'
|
||||||
id: syntax_check_py
|
id: syntax_check_py
|
||||||
run: ./fbt lint_py 2>&1 >/dev/null || echo "errors=1" >> $GITHUB_OUTPUT
|
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'
|
- name: 'Check C++ code formatting'
|
||||||
if: always()
|
|
||||||
id: syntax_check_cpp
|
id: syntax_check_cpp
|
||||||
run: ./fbt lint 2>&1 >/dev/null || echo "errors=1" >> $GITHUB_OUTPUT
|
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
|
- name: Report code formatting errors
|
||||||
if: ( steps.syntax_check_py.outputs.errors || steps.syntax_check_cpp.outputs.errors ) && github.event.pull_request
|
if: ( steps.syntax_check_py.outputs.errors || steps.syntax_check_cpp.outputs.errors ) && github.event.pull_request
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
from SCons.Platform import TempFileMunge
|
from SCons.Platform import TempFileMunge
|
||||||
from SCons.Node import FS
|
from SCons.Node import FS
|
||||||
from SCons.Errors import UserError
|
from SCons.Errors import UserError
|
||||||
|
from SCons.Warnings import warn, WarningOnByDefault
|
||||||
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
@ -246,7 +248,12 @@ known_extapps = [
|
|||||||
for apptype in apps_to_build_as_faps
|
for apptype in apps_to_build_as_faps
|
||||||
for app in appenv["APPBUILD"].get_apps_of_type(apptype, True)
|
for app in appenv["APPBUILD"].get_apps_of_type(apptype, True)
|
||||||
]
|
]
|
||||||
|
incompatible_apps = []
|
||||||
for app in known_extapps:
|
for app in known_extapps:
|
||||||
|
if not app.supports_hardware_target(appenv.subst("f${TARGET_HW}")):
|
||||||
|
incompatible_apps.append(app)
|
||||||
|
continue
|
||||||
|
|
||||||
app_artifacts = appenv.BuildAppElf(app)
|
app_artifacts = appenv.BuildAppElf(app)
|
||||||
app_src_dir = extract_abs_dir(app_artifacts.app._appdir)
|
app_src_dir = extract_abs_dir(app_artifacts.app._appdir)
|
||||||
app_artifacts.installer = [
|
app_artifacts.installer = [
|
||||||
@ -254,6 +261,13 @@ for app in known_extapps:
|
|||||||
appenv.Install(app_src_dir.Dir("dist").Dir("debug"), app_artifacts.debug),
|
appenv.Install(app_src_dir.Dir("dist").Dir("debug"), app_artifacts.debug),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
if len(incompatible_apps):
|
||||||
|
print(
|
||||||
|
"WARNING: The following apps are not compatible with the current target hardware and will not be built: {}".format(
|
||||||
|
", ".join([app.name for app in incompatible_apps])
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
if appenv["FORCE"]:
|
if appenv["FORCE"]:
|
||||||
appenv.AlwaysBuild([extapp.compact for extapp in apps_artifacts.values()])
|
appenv.AlwaysBuild([extapp.compact for extapp in apps_artifacts.values()])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user