Skip to content

Commit 812ecf0

Browse files
authored
Merge branch 'main' into copilot/improve-ci-procedures
2 parents 9c280b7 + cf2e2ad commit 812ecf0

360 files changed

Lines changed: 12149 additions & 4614 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-tidy

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
---
2+
# RIT Launch Initiative FSW clang-tidy configuration
3+
# This configuration enforces the project's coding standards
4+
5+
Checks: >
6+
-*,
7+
bugprone-*,
8+
clang-analyzer-*,
9+
cppcoreguidelines-*,
10+
modernize-*,
11+
performance-*,
12+
portability-*,
13+
-portability-avoid-pragma-once,
14+
readability-*,
15+
-modernize-use-trailing-return-type,
16+
-readability-identifier-length,
17+
-cppcoreguidelines-avoid-magic-numbers,
18+
-readability-magic-numbers,
19+
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
20+
-cppcoreguidelines-pro-bounds-constant-array-index,
21+
-cppcoreguidelines-pro-type-vararg,
22+
-cppcoreguidelines-avoid-c-arrays,
23+
-modernize-avoid-c-arrays,
24+
-readability-avoid-const-params-in-decls,
25+
-cppcoreguidelines-owning-memory,
26+
-cppcoreguidelines-no-malloc,
27+
-cppcoreguidelines-pro-type-reinterpret-cast,
28+
-cppcoreguidelines-init-variables,
29+
-cppcoreguidelines-avoid-non-const-global-variables,
30+
-modernize-use-auto,
31+
-readability-implicit-bool-conversion,
32+
-cppcoreguidelines-pro-type-union-access,
33+
-readability-braces-around-statements,
34+
-readability-else-after-return
35+
36+
WarningsAsErrors: ''
37+
38+
HeaderFilterRegex: '.*'
39+
40+
CheckOptions:
41+
# Naming conventions
42+
# Classes must start with 'C'
43+
- key: readability-identifier-naming.ClassCase
44+
value: CamelCase
45+
- key: readability-identifier-naming.ClassPrefix
46+
value: 'C'
47+
48+
# Structs must start with 'C' (treated like classes in C++)
49+
- key: readability-identifier-naming.StructCase
50+
value: CamelCase
51+
- key: readability-identifier-naming.StructPrefix
52+
value: 'C'
53+
54+
# Namespaces must start with 'N'
55+
- key: readability-identifier-naming.NamespaceCase
56+
value: CamelCase
57+
- key: readability-identifier-naming.NamespacePrefix
58+
value: 'N'
59+
60+
# Public member functions: CamelCase with capitalized first letter
61+
- key: readability-identifier-naming.PublicMethodCase
62+
value: CamelCase
63+
64+
# Private member functions: camelBack (first letter lowercase)
65+
- key: readability-identifier-naming.PrivateMethodCase
66+
value: camelBack
67+
68+
# Protected member functions: camelBack (first letter lowercase)
69+
- key: readability-identifier-naming.ProtectedMethodCase
70+
value: camelBack
71+
72+
# Member variables: camelBack
73+
- key: readability-identifier-naming.MemberCase
74+
value: camelBack
75+
76+
# Private member variables: camelBack
77+
- key: readability-identifier-naming.PrivateMemberCase
78+
value: camelBack
79+
80+
# Public member variables: camelBack
81+
- key: readability-identifier-naming.PublicMemberCase
82+
value: camelBack
83+
84+
# Protected member variables: camelBack
85+
- key: readability-identifier-naming.ProtectedMemberCase
86+
value: camelBack
87+
88+
# Parameters: camelBack
89+
- key: readability-identifier-naming.ParameterCase
90+
value: camelBack
91+
92+
# Local variables: camelBack
93+
- key: readability-identifier-naming.LocalVariableCase
94+
value: camelBack
95+
96+
# Global variables: camelBack
97+
- key: readability-identifier-naming.GlobalVariableCase
98+
value: camelBack
99+
100+
# Constants: CamelCase or UPPER_CASE both acceptable
101+
- key: readability-identifier-naming.ConstantCase
102+
value: aNy_CasE
103+
104+
# Enums: CamelCase
105+
- key: readability-identifier-naming.EnumCase
106+
value: CamelCase
107+
108+
# Enum constants: CamelCase
109+
- key: readability-identifier-naming.EnumConstantCase
110+
value: CamelCase
111+
112+
# Template parameters: CamelCase
113+
- key: readability-identifier-naming.TemplateParameterCase
114+
value: CamelCase
115+
116+
# Type aliases and typedefs: CamelCase
117+
- key: readability-identifier-naming.TypedefCase
118+
value: CamelCase
119+
- key: readability-identifier-naming.TypeAliasCase
120+
value: CamelCase
121+
122+
# Functions (C style with underscores is allowed for Zephyr compatibility)
123+
- key: readability-identifier-naming.FunctionCase
124+
value: aNy_CasE
125+
126+
# Line length (enforced by clang-format, but mentioned here for completeness)
127+
# Maximum line length is 120 characters (configured in .clang-format)
128+
129+
# Brace wrapping and indentation
130+
# 4 space indents - configured in .clang-format
131+
# Opening braces on same line - configured in .clang-format
132+
133+
# Include sorting
134+
# Alphabetized includes with grouping - configured in .clang-format
135+
136+
# Readability options
137+
- key: readability-braces-around-statements.ShortStatementLines
138+
value: '0'
139+
- key: readability-function-cognitive-complexity.Threshold
140+
value: '50'
141+
- key: readability-function-size.LineThreshold
142+
value: '200'
143+
- key: readability-function-size.StatementThreshold
144+
value: '150'
145+
146+
# Modern C++ features
147+
- key: modernize-use-nullptr.NullMacros
148+
value: 'NULL'
149+
150+
# Performance
151+
- key: performance-move-const-arg.CheckTriviallyCopyableMove
152+
value: 'true'
153+
154+
# Ignore certain patterns for C functions from Zephyr
155+
# C functions with underscores (k_*, z_*, etc.) are explicitly allowed
156+
- key: readability-identifier-naming.FunctionIgnoredRegexp
157+
value: '^(k_|z_|sys_|device_|gpio_|uart_|spi_|i2c_|LOG_|sntp_|.*_init|.*_setup|.*_handler).*'
158+
159+
# Ignore certain variable patterns for compatibility
160+
- key: readability-identifier-naming.LocalVariableIgnoredRegexp
161+
value: '^(k_|z_|sys_|ts|rc|rv|fd)$'
162+
- key: readability-identifier-naming.ParameterIgnoredRegexp
163+
value: '^(k_|z_|sys_|_).*'
164+
165+
...

.gitattributes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
**/.idea/* export-ignore linguist-generated=true -diff
33
data/orksim_csv/* export-ignore linguist-generated=true -diff
44
data/sim/* export-ignore linguist-generated=true -diff
5+
**/*.ipynb linguist-vendored
56

67
# Source Code
78
*.c text diff=cpp

.github/workflows/build.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,79 @@ jobs:
7373
done;
7474
}
7575
west twister $(add_arglist -T "${{ env.test_roots }}") $(add_arglist -p "${{ env.platforms }}") $(if [ "${{ runner.os }}" = "Linux" ]; then add_arglist -p "${{ env.linux_only_platforms }}"; fi) -v --inline-logs --integration $EXTRA_TWISTER_FLAGS
76+
77+
- name: Print Test Results Summary
78+
if: runner.os == 'Linux' && steps.set_test_roots.outcome == 'success' && env.test_roots != ''
79+
working-directory: FSW
80+
shell: bash
81+
run: |
82+
if [ -f "twister-out/twister.json" ]; then
83+
python3 << 'PYTHON_SCRIPT'
84+
import json
85+
import sys
86+
87+
try:
88+
with open('twister-out/twister.json', 'r') as f:
89+
data = json.load(f)
90+
91+
print("\n" + "="*80)
92+
print("TWISTER TEST RESULTS SUMMARY")
93+
print("="*80)
94+
95+
# Environment info
96+
env = data.get('environment', {})
97+
print(f"\nEnvironment:")
98+
print(f" OS: {env.get('os', 'N/A')}")
99+
print(f" Zephyr Version: {env.get('zephyr_version', 'N/A')}")
100+
print(f" Run Date: {env.get('run_date', 'N/A')}")
101+
102+
# Test statistics
103+
testsuites = data.get('testsuites', [])
104+
total = len(testsuites)
105+
106+
status_counts = {}
107+
for suite in testsuites:
108+
status = suite.get('status', 'unknown')
109+
status_counts[status] = status_counts.get(status, 0) + 1
110+
111+
print(f"\nTest Statistics:")
112+
print(f" Total Test Suites: {total}")
113+
for status, count in sorted(status_counts.items()):
114+
print(f" {status.capitalize()}: {count}")
115+
116+
# Total build time
117+
total_build_time = sum(float(suite.get('build_time', 0)) for suite in testsuites)
118+
print(f"\nTotal Build Time: {total_build_time:.2f}s")
119+
120+
# Per-suite details
121+
print(f"\nTest Suite Details:")
122+
print(f"{'Name':<50} {'Platform':<25} {'Status':<12} {'Build Time':<10}")
123+
print("-"*100)
124+
125+
for suite in testsuites:
126+
name = suite.get('name', 'unknown')[:48]
127+
platform = suite.get('platform', 'unknown')[:23]
128+
status = suite.get('status', 'unknown')[:10]
129+
build_time = suite.get('build_time', '0')
130+
print(f"{name:<50} {platform:<25} {status:<12} {build_time:<10}s")
131+
132+
print("="*80 + "\n")
133+
134+
except Exception as e:
135+
print(f"Error parsing twister.json: {e}", file=sys.stderr)
136+
sys.exit(1)
137+
PYTHON_SCRIPT
138+
else
139+
echo "Warning: twister-out/twister.json not found"
140+
fi
141+
142+
- name: Upload Twister Reports
143+
if: runner.os == 'Linux' && steps.set_test_roots.outcome == 'success' && env.test_roots != ''
144+
uses: actions/upload-artifact@v4
145+
with:
146+
name: twister-reports-projects
147+
path: |
148+
FSW/twister-out/twister.html
149+
FSW/twister-out/twister.json
150+
FSW/twister-out/twister.xml
151+
if-no-files-found: warn

.github/workflows/build_samples.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,79 @@ jobs:
7777
done;
7878
}
7979
west twister $(add_arglist -T "${{ env.test_roots }}") $(add_arglist -p "${{ env.platforms }}") $(if [ "${{ runner.os }}" = "Linux" ]; then add_arglist -p "${{ env.linux_only_platforms }}"; fi) -v --inline-logs --integration $EXTRA_TWISTER_FLAGS
80+
81+
- name: Print Test Results Summary
82+
if: runner.os == 'Linux' && steps.set_test_roots.outcome == 'success' && env.test_roots != ''
83+
working-directory: FSW
84+
shell: bash
85+
run: |
86+
if [ -f "twister-out/twister.json" ]; then
87+
python3 << 'PYTHON_SCRIPT'
88+
import json
89+
import sys
90+
91+
try:
92+
with open('twister-out/twister.json', 'r') as f:
93+
data = json.load(f)
94+
95+
print("\n" + "="*80)
96+
print("TWISTER TEST RESULTS SUMMARY")
97+
print("="*80)
98+
99+
# Environment info
100+
env = data.get('environment', {})
101+
print(f"\nEnvironment:")
102+
print(f" OS: {env.get('os', 'N/A')}")
103+
print(f" Zephyr Version: {env.get('zephyr_version', 'N/A')}")
104+
print(f" Run Date: {env.get('run_date', 'N/A')}")
105+
106+
# Test statistics
107+
testsuites = data.get('testsuites', [])
108+
total = len(testsuites)
109+
110+
status_counts = {}
111+
for suite in testsuites:
112+
status = suite.get('status', 'unknown')
113+
status_counts[status] = status_counts.get(status, 0) + 1
114+
115+
print(f"\nTest Statistics:")
116+
print(f" Total Test Suites: {total}")
117+
for status, count in sorted(status_counts.items()):
118+
print(f" {status.capitalize()}: {count}")
119+
120+
# Total build time
121+
total_build_time = sum(float(suite.get('build_time', 0)) for suite in testsuites)
122+
print(f"\nTotal Build Time: {total_build_time:.2f}s")
123+
124+
# Per-suite details
125+
print(f"\nTest Suite Details:")
126+
print(f"{'Name':<50} {'Platform':<25} {'Status':<12} {'Build Time':<10}")
127+
print("-"*100)
128+
129+
for suite in testsuites:
130+
name = suite.get('name', 'unknown')[:48]
131+
platform = suite.get('platform', 'unknown')[:23]
132+
status = suite.get('status', 'unknown')[:10]
133+
build_time = suite.get('build_time', '0')
134+
print(f"{name:<50} {platform:<25} {status:<12} {build_time:<10}s")
135+
136+
print("="*80 + "\n")
137+
138+
except Exception as e:
139+
print(f"Error parsing twister.json: {e}", file=sys.stderr)
140+
sys.exit(1)
141+
PYTHON_SCRIPT
142+
else
143+
echo "Warning: twister-out/twister.json not found"
144+
fi
145+
146+
- name: Upload Twister Reports
147+
if: runner.os == 'Linux' && steps.set_test_roots.outcome == 'success' && env.test_roots != ''
148+
uses: actions/upload-artifact@v4
149+
with:
150+
name: twister-reports-samples
151+
path: |
152+
FSW/twister-out/twister.html
153+
FSW/twister-out/twister.json
154+
FSW/twister-out/twister.xml
155+
if-no-files-found: warn

.github/workflows/clang-format.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Clang Format
2+
3+
on:
4+
schedule:
5+
# Run every Sunday at midnight UTC (Sunday night)
6+
- cron: '0 0 * * 0'
7+
workflow_dispatch: # Allow manual triggering for testing
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
format:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout Repository
17+
uses: actions/checkout@v4
18+
with:
19+
ref: main
20+
token: ${{ secrets.GITHUB_TOKEN }}
21+
22+
- name: Install clang-format
23+
run: |
24+
sudo apt-get update
25+
sudo apt-get install -y clang-format-18
26+
27+
- name: Run clang-format
28+
run: |
29+
# Find all C/C++ files and format them
30+
find . -type f \( -name "*.c" -o -name "*.cpp" -o -name "*.h" -o -name "*.hpp" \) \
31+
-not -path "*/build/*" \
32+
-not -path "*/zephyr/*" \
33+
-not -path "*/.git/*" \
34+
-not -path "*/CMakeFiles/*" \
35+
-exec clang-format-18 -i {} \;
36+
37+
- name: Check for changes
38+
id: check_changes
39+
run: |
40+
if [ -n "$(git status --porcelain)" ]; then
41+
echo "changes=true" >> $GITHUB_OUTPUT
42+
else
43+
echo "changes=false" >> $GITHUB_OUTPUT
44+
fi
45+
46+
- name: Commit and push changes
47+
if: steps.check_changes.outputs.changes == 'true'
48+
run: |
49+
git config user.name "github-actions[bot]"
50+
git config user.email "github-actions[bot]@users.noreply.github.com"
51+
git add -A
52+
git commit -m "Apply clang-format formatting"
53+
git push

0 commit comments

Comments
 (0)