Skip to content

Commit 13c9545

Browse files
committed
fix: stuff
1 parent 2fd8d05 commit 13c9545

File tree

9 files changed

+233
-106
lines changed

9 files changed

+233
-106
lines changed

.github/workflows/build.yml

Lines changed: 41 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,72 @@
1-
name: 'Build'
1+
name: Build
22

33
on:
44
push:
5-
branches:
6-
- main
7-
tags:
8-
- '*'
5+
branches: [main, "release*", "dev*"]
6+
tags: ["*"]
97
pull_request:
8+
branches: [main, "release*", "dev*"]
9+
workflow_dispatch:
1010

11-
env:
12-
DEFAULT_TARGET: f7
13-
FBT_TOOLCHAIN_PATH: /runner/_work
14-
FBT_GIT_SUBMODULE_SHALLOW: 1
15-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
16-
permissions: write-all
17-
jobs:
18-
main:
11+
jobs:
12+
build:
1913
runs-on: ubuntu-latest
2014
strategy:
2115
fail-fast: false
2216
matrix:
2317
target: [f7, f18]
24-
steps:
25-
- name: 'Wipe workspace'
26-
run: sudo find ./ -mount -maxdepth 1 -exec rm -rf {} \;
2718

28-
- name: 'Checkout code'
29-
uses: actions/checkout@v4
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
3022
with:
31-
fetch-depth: 1
32-
ref: ${{ github.event.pull_request.head.sha }}
23+
fetch-depth: 0
24+
submodules: true
3325

34-
- name: 'Get commit details'
35-
id: names
26+
# Setup environment variables
27+
- name: Set environment variables
28+
run: |
29+
echo "TARGETS=${{ matrix.target }}" >> $GITHUB_ENV
30+
echo "DEFAULT_TARGET=f7" >> $GITHUB_ENV
31+
echo "FBT_TOOLCHAIN_PATH=/tmp/toolchain" >> $GITHUB_ENV
32+
echo "FBT_GIT_SUBMODULE_SHALLOW=1" >> $GITHUB_ENV
33+
echo "DIST_SUFFIX=custom" >> $GITHUB_ENV
34+
35+
- name: 'Create toolchain directory with proper permissions'
36+
run: |
37+
sudo mkdir -p $FBT_TOOLCHAIN_PATH
38+
sudo chmod -R 777 $FBT_TOOLCHAIN_PATH
39+
40+
# Build stuff
41+
- name: 'Build firmware'
42+
id: build-fw
3643
run: |
37-
set -e
38-
sudo -i
39-
BUILD_TYPE='DEBUG=1 COMPACT=0'
40-
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
41-
TYPE="pull"
42-
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
43-
TYPE="tag"
44-
BUILD_TYPE='DEBUG=0 COMPACT=1'
45-
else
46-
TYPE="other"
47-
fi
48-
sudo python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" || cat "${{ github.event_path }}"
49-
echo "event_type=$TYPE" >> $GITHUB_OUTPUT
50-
echo "FBT_BUILD_TYPE=$BUILD_TYPE" >> $GITHUB_ENV
5144
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
5245
echo "TARGET_HW=$(echo "${{ matrix.target }}" | sed 's/f//')" >> $GITHUB_ENV
5346
5447
- name: 'Check API versions for consistency between targets'
5548
run: |
56-
set -e
57-
sudo -i
5849
N_API_HEADER_SIGNATURES=`ls -1 targets/f*/api_symbols.csv | xargs -I {} sh -c "head -n2 {} | md5sum" | sort -u | wc -l`
59-
if [ $N_API_HEADER_SIGNATURES != 1 ] ; then
50+
if [ "$N_API_HEADER_SIGNATURES" -ne 1 ]; then
6051
echo API versions aren\'t matching for available targets. Please update!
61-
echo API versions are:
52+
echo "Signatures found:"
6253
head -n2 targets/f*/api_symbols.csv
6354
exit 1
64-
fi
65-
66-
- name: 'Build the firmware and apps'
67-
id: build-fw
55+
56+
- name: 'Build firmware with fbt'
57+
id: build-fw-with-fbt
6858
run: |
69-
set -e
70-
sudo -i
71-
./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE copro_dist updater_package fap_dist
59+
# Use FBT_TOOLCHAIN_PATH that we've already set up with proper permissions
60+
sudo ./fbt TARGET_HW=$TARGET_HW $FBT_BUILD_TYPE copro_dist updater_package fap_dist
7261
echo "firmware_api=$(./fbt TARGET_HW=$TARGET_HW get_apiversion)" >> $GITHUB_OUTPUT
62+
shell: /usr/bin/bash -e {0}
7363

74-
- name: 'Check for uncommitted changes'
75-
run: |
76-
set -e
77-
sudo -i
78-
git diff --exit-code
79-
80-
- name: 'Copy build output'
64+
- name: 'Prepare artifacts'
8165
run: |
82-
set -e
83-
sudo -i
84-
rm -rf artifacts map_analyser_files || true
85-
sudo mkdir artifacts map_analyser_files
86-
sudo cp dist/${TARGET}-*/* artifacts/ || true
66+
mkdir -p artifacts map_analyser_files
67+
cp dist/${TARGET}-*/* artifacts/ || true
8768
tar czpf "artifacts/flipper-z-${TARGET}-resources-${SUFFIX}.tgz" \
88-
-C build/latest resources
69+
-C assets resources
8970
tar czpf "artifacts/flipper-z-${TARGET}-debugapps-${SUFFIX}.tgz" \
9071
-C dist/${TARGET}-*/apps/Debug .
9172
tar czpf "artifacts/flipper-z-${TARGET}-appsymbols-${SUFFIX}.tgz" \

.github/workflows/build_compact.yml

Lines changed: 27 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,53 +1,48 @@
1-
name: 'Compact build'
1+
name: Build compact target
22

33
on:
4+
push:
5+
branches: [main, "release*", "dev*"]
6+
tags: ["*"]
47
pull_request:
5-
6-
env:
7-
FBT_TOOLCHAIN_PATH: /runner/_work
8-
FBT_GIT_SUBMODULE_SHALLOW: 1
9-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
10-
permissions: write-all
8+
branches: [main, "release*", "dev*"]
9+
workflow_dispatch:
1110

1211
jobs:
13-
compact:
12+
build-compact:
1413
runs-on: ubuntu-latest
15-
container:
16-
options: --user root
1714
strategy:
1815
fail-fast: false
1916
matrix:
2017
target: [f7, f18]
21-
steps:
22-
- name: 'Wipe workspace'
23-
run: find ./ -mount -maxdepth 1 -exec rm -rf {} \;
2418

25-
- name: 'Checkout code'
26-
uses: actions/checkout@v4
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v3
2722
with:
28-
fetch-depth: 1
29-
submodules: false
30-
ref: ${{ github.event.pull_request.head.sha }}
23+
fetch-depth: 0
24+
submodules: true
3125

32-
- name: 'Get commit details'
26+
# Setup environment variables
27+
- name: Set environment variables
3328
run: |
34-
sudo -i
35-
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
36-
TYPE="pull"
37-
elif [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
38-
TYPE="tag"
39-
else
40-
TYPE="other"
41-
fi
42-
python3 scripts/get_env.py "--event_file=${{ github.event_path }}" "--type=$TYPE" || cat "${{ github.event_path }}"
29+
echo "TARGETS=${{ matrix.target }}" >> $GITHUB_ENV
30+
echo "DEFAULT_TARGET=f7" >> $GITHUB_ENV
31+
echo "FBT_TOOLCHAIN_PATH=/tmp/toolchain" >> $GITHUB_ENV
32+
echo "FBT_GIT_SUBMODULE_SHALLOW=1" >> $GITHUB_ENV
33+
echo "DIST_SUFFIX=custom" >> $GITHUB_ENV
34+
35+
- name: 'Create toolchain directory with proper permissions'
36+
run: |
37+
sudo mkdir -p $FBT_TOOLCHAIN_PATH
38+
sudo chmod -R 777 $FBT_TOOLCHAIN_PATH
4339
44-
- name: 'Build the firmware'
40+
# Build stuff
41+
- name: 'Build firmware with fbt'
4542
id: build-fw
4643
run: |
47-
set -e
48-
sudo -i
4944
TARGET="$(echo '${{ matrix.target }}' | sed 's/f//')"; \
50-
./fbt TARGET_HW=$TARGET DEBUG=0 COMPACT=1 fap_dist updater_package
45+
sudo ./fbt TARGET_HW=$TARGET DEBUG=0 COMPACT=1 fap_dist updater_package
5146
echo "sdk-file=$(ls dist/${{ matrix.target }}-*/flipper-z-${{ matrix.target }}-sdk-*.zip)" >> $GITHUB_OUTPUT
5247
echo "hw-target-code=$TARGET" >> $GITHUB_OUTPUT
5348

.github/workflows/qa_report.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: QA Report Generation
2+
3+
on:
4+
pull_request:
5+
branches: [main, "release*", "dev*"]
6+
types: [opened, synchronize, reopened]
7+
workflow_dispatch:
8+
9+
jobs:
10+
merge_report:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 0
18+
submodules: true
19+
20+
- name: Set environment variables
21+
run: |
22+
echo "FBT_TOOLCHAIN_PATH=/tmp/toolchain" >> $GITHUB_ENV
23+
24+
- name: 'Create toolchain directory with proper permissions'
25+
run: |
26+
sudo mkdir -p $FBT_TOOLCHAIN_PATH
27+
sudo chmod -R 777 $FBT_TOOLCHAIN_PATH
28+
29+
- name: Install dependencies
30+
run: |
31+
python3 -m pip install slack_sdk
32+
33+
- name: Generate merge report
34+
run: |
35+
# Initialize environment with our properly permissioned directory
36+
source scripts/toolchain/fbtenv.sh
37+
# Generate report
38+
python3 scripts/merge_report_qa.py
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Static C/C++ analysis with PVS-Studio
2+
3+
on:
4+
push:
5+
branches: [main, "release*", "dev*"]
6+
pull_request:
7+
branches: [main, "release*", "dev*"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
analyse_c_cpp:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
submodules: true
20+
21+
- name: Set environment variables
22+
run: |
23+
echo "TARGETS=f7" >> $GITHUB_ENV
24+
echo "DEFAULT_TARGET=f7" >> $GITHUB_ENV
25+
echo "FBT_TOOLCHAIN_PATH=/tmp/toolchain" >> $GITHUB_ENV
26+
echo "FBT_GIT_SUBMODULE_SHALLOW=1" >> $GITHUB_ENV
27+
echo "COMMIT_MSG=$(git log --format=%B -n 1 ${{ github.sha }})" >> $GITHUB_ENV
28+
echo "COMMIT_HASH=${{ github.sha }}" >> $GITHUB_ENV
29+
echo "COMMIT_SHA=$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV
30+
echo "SUFFIX=main-${{ github.run_id }}-$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV
31+
echo "BRANCH_NAME=${{ github.ref_name }}" >> $GITHUB_ENV
32+
echo "DIST_SUFFIX=main-${{ github.run_id }}-$(echo ${{ github.sha }} | cut -c1-8)" >> $GITHUB_ENV
33+
echo "WORKFLOW_BRANCH_OR_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
34+
35+
- name: Install PVS-Studio
36+
run: |
37+
wget -q -O - https://files.viva64.com/etc/pubkey.txt | sudo apt-key add -
38+
sudo wget -O /etc/apt/sources.list.d/viva64.list https://files.viva64.com/etc/viva64.list
39+
sudo apt-get update
40+
sudo apt-get install -y pvs-studio
41+
42+
- name: 'Create toolchain directory with proper permissions'
43+
run: |
44+
sudo mkdir -p $FBT_TOOLCHAIN_PATH
45+
sudo chmod -R 777 $FBT_TOOLCHAIN_PATH
46+
47+
- name: Run PVS-Studio analysis
48+
run: |
49+
# License activation
50+
pvs-studio-analyzer credentials ${{ secrets.PVS_STUDIO_CREDENTIALS }} -o pvs-studio.lic
51+
52+
# Prepare FBT environment
53+
./fbt TARGET_HW=7 proto_ver
54+
55+
# Run analysis
56+
pvs-studio-analyzer analyze -l pvs-studio.lic -o PVS-Studio.log
57+
plog-converter -a GA:1,2 -t fullhtml PVS-Studio.log -o pvs_report
58+
59+
- name: Upload PVS Studio report
60+
uses: actions/upload-artifact@v3
61+
with:
62+
name: pvs-studio-report
63+
path: pvs_report/
64+
retention-days: 14

SConstruct

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@
66
# trees on startup. So, to keep startup time as low as possible, we're hiding
77
# construction of certain targets behind command-line options.
88

9-
from argparse import Action
10-
from ast import Subscript, alias
11-
from optparse import Option
129
import os
1310
from fbt.util import open_browser_action
1411

@@ -19,7 +16,7 @@ EnsurePythonVersion(3, 8)
1916
# Progress(["OwO\r", "owo\r", "uwu\r", "owo\r"], interval=15)
2017

2118
# This environment is created only for loading options & validating file/dir existence
22-
fbt_variables = Subscript("site_scons/commandline.scons")
19+
fbt_variables = SConscript("site_scons/commandline.scons")
2320
cmd_environment = Environment(
2421
toolpath=["#/scripts/fbt_tools"],
2522
tools=[
@@ -30,12 +27,12 @@ cmd_environment = Environment(
3027

3128
# Building basic environment - tools, utility methods, cross-compilation
3229
# settings, gcc flags for Cortex-M4, basic builders and more
33-
coreenv = Subscript(
30+
coreenv = SConscript(
3431
"site_scons/environ.scons",
3532
exports={"VAR_ENV": cmd_environment},
3633
toolpath=["#/scripts/fbt_tools"],
3734
)
38-
Subscript("site_scons/cc.scons", exports={"ENV": coreenv})
35+
SConscript("site_scons/cc.scons", exports={"ENV": coreenv})
3936

4037
# Create a separate "dist" environment and add construction envs to it
4138
distenv = coreenv.Clone(
@@ -59,7 +56,7 @@ firmware_env = distenv.AddFwProject(
5956
)
6057

6158
# If enabled, initialize updater-related targets
62-
if Option("fullenv") or any(
59+
if GetOption("fullenv") or any(
6360
filter(lambda target: "updater" in target or "flash_usb" in target, BUILD_TARGETS)
6461
):
6562
updater_env = distenv.AddFwProject(
@@ -171,7 +168,7 @@ Depends(
171168
fap_dist,
172169
list(app_artifact.validator for app_artifact in external_app_list),
173170
)
174-
alias("fap_dist", fap_dist)
171+
Alias("fap_dist", fap_dist)
175172

176173
# Copy all faps to device
177174

@@ -490,8 +487,8 @@ doxy_build = distenv.DoxyBuild(
490487
"documentation/doxygen/build/html/index.html",
491488
"documentation/doxygen/Doxyfile-awesome.cfg",
492489
doxy_env_variables={
493-
"DOXY_SRC_ROOT": dir(".").abspath,
494-
"DOXY_BUILD_DIR": dir("documentation/doxygen/build").abspath,
490+
"DOXY_SRC_ROOT": Dir(".").abspath,
491+
"DOXY_BUILD_DIR": Dir("documentation/doxygen/build").abspath,
495492
"DOXY_CONFIG_DIR": "documentation/doxygen",
496493
},
497494
)

documentation/Containerization.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Flipper Zero Containerization System
22

33
The containerization system for Flipper Zero provides a minimal-overhead way to run and manage applications
4-
in a resource-efficient manner. This system draws inspiration from container orchestration systems like
4+
in a resource-efficient manner. This system draws inspiration from container orchestration systems like
55
Kubernetes but is specifically designed for the highly constrained microcontroller environment.
66

77
## Architecture
@@ -68,3 +68,4 @@ if(service) {
6868
- Volume mounts for shared persistent storage
6969
- Container health checks and self-healing
7070
- Configuration maps for environment variables
71+

0 commit comments

Comments
 (0)