Skip to content

Commit a91eedf

Browse files
authored
Ci/add (#6)
* add pre-commit hook and clang format for ensuring style * ran pre commit hook to update style of all files * add ci * fix case issue on cloud build for jpegdec include * ignore jpegdec in static analysis * suppress parameter for callback
1 parent 1ec3bec commit a91eedf

File tree

12 files changed

+453
-215
lines changed

12 files changed

+453
-215
lines changed

.clang-format

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
---
2+
Language: Cpp
3+
# BasedOnStyle: LLVM
4+
AccessModifierOffset: -2
5+
AlignAfterOpenBracket: Align
6+
AlignConsecutiveAssignments: false
7+
AlignConsecutiveDeclarations: false
8+
AlignEscapedNewlines: Right
9+
AlignOperands: true
10+
AlignTrailingComments: true
11+
AllowAllParametersOfDeclarationOnNextLine: true
12+
AllowShortBlocksOnASingleLine: false
13+
AllowShortCaseLabelsOnASingleLine: false
14+
AllowShortFunctionsOnASingleLine: All
15+
AllowShortIfStatementsOnASingleLine: false
16+
AllowShortLoopsOnASingleLine: false
17+
AlwaysBreakAfterDefinitionReturnType: None
18+
AlwaysBreakAfterReturnType: None
19+
AlwaysBreakBeforeMultilineStrings: false
20+
AlwaysBreakTemplateDeclarations: false
21+
BinPackArguments: true
22+
BinPackParameters: true
23+
BraceWrapping:
24+
AfterClass: false
25+
AfterControlStatement: false
26+
AfterEnum: false
27+
AfterFunction: false
28+
AfterNamespace: false
29+
AfterObjCDeclaration: false
30+
AfterStruct: false
31+
AfterUnion: false
32+
AfterExternBlock: false
33+
BeforeCatch: false
34+
BeforeElse: false
35+
IndentBraces: false
36+
SplitEmptyFunction: true
37+
SplitEmptyRecord: true
38+
SplitEmptyNamespace: true
39+
BreakBeforeBinaryOperators: None
40+
BreakBeforeBraces: Attach
41+
BreakBeforeInheritanceComma: false
42+
BreakBeforeTernaryOperators: true
43+
BreakConstructorInitializersBeforeComma: true
44+
BreakConstructorInitializers: BeforeColon
45+
BreakAfterJavaFieldAnnotations: false
46+
BreakStringLiterals: true
47+
ColumnLimit: 100
48+
CommentPragmas: '^ IWYU pragma:'
49+
CompactNamespaces: false
50+
ConstructorInitializerAllOnOneLineOrOnePerLine: false
51+
ConstructorInitializerIndentWidth: 4
52+
ContinuationIndentWidth: 4
53+
Cpp11BracedListStyle: true
54+
DerivePointerAlignment: false
55+
DisableFormat: false
56+
ExperimentalAutoDetectBinPacking: false
57+
FixNamespaceComments: true
58+
ForEachMacros:
59+
- foreach
60+
- Q_FOREACH
61+
- BOOST_FOREACH
62+
IncludeBlocks: Preserve
63+
IncludeCategories:
64+
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
65+
Priority: 2
66+
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
67+
Priority: 3
68+
- Regex: '.*'
69+
Priority: 1
70+
IncludeIsMainRegex: '(Test)?$'
71+
IndentCaseLabels: false
72+
IndentPPDirectives: None
73+
IndentWidth: 2
74+
IndentWrappedFunctionNames: false
75+
JavaScriptQuotes: Leave
76+
JavaScriptWrapImports: true
77+
KeepEmptyLinesAtTheStartOfBlocks: true
78+
MacroBlockBegin: ''
79+
MacroBlockEnd: ''
80+
MaxEmptyLinesToKeep: 1
81+
NamespaceIndentation: None
82+
ObjCBlockIndentWidth: 2
83+
ObjCSpaceAfterProperty: false
84+
ObjCSpaceBeforeProtocolList: true
85+
PenaltyBreakAssignment: 2
86+
PenaltyBreakBeforeFirstCallParameter: 19
87+
PenaltyBreakComment: 300
88+
PenaltyBreakFirstLessLess: 120
89+
PenaltyBreakString: 1000
90+
PenaltyExcessCharacter: 1000000
91+
PenaltyReturnTypeOnItsOwnLine: 60
92+
PointerAlignment: Right
93+
RawStringFormats:
94+
- Language: TextProto
95+
Delimiters:
96+
- 'pb'
97+
- 'proto'
98+
BasedOnStyle: google
99+
ReflowComments: true
100+
SortIncludes: true
101+
SortUsingDeclarations: true
102+
SpaceAfterCStyleCast: false
103+
SpaceAfterTemplateKeyword: true
104+
SpaceBeforeAssignmentOperators: true
105+
SpaceBeforeParens: ControlStatements
106+
SpaceInEmptyParentheses: false
107+
SpacesBeforeTrailingComments: 1
108+
SpacesInAngles: false
109+
SpacesInContainerLiterals: true
110+
SpacesInCStyleCastParentheses: false
111+
SpacesInParentheses: false
112+
SpacesInSquareBrackets: false
113+
Standard: Cpp11
114+
TabWidth: 8
115+
UseTab: Never
116+
...
117+

.github/workflows/build.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
build:
7+
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout repo
12+
uses: actions/checkout@v2
13+
with:
14+
submodules: 'recursive'
15+
16+
- name: Build Examples
17+
uses: espressif/esp-idf-ci-action@v1
18+
with:
19+
esp_idf_version: release-v5.2
20+
target: esp32s3
21+
path: '.'

.github/workflows/package_main.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Build and Package Main
2+
3+
on:
4+
push:
5+
branches: [main]
6+
release:
7+
types: [published]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
continue-on-error: false
14+
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v2
18+
with:
19+
submodules: 'recursive'
20+
21+
- name: Build Main Code
22+
uses: espressif/esp-idf-ci-action@v1
23+
with:
24+
esp_idf_version: release-v5.2
25+
target: esp32s3
26+
path: '.'
27+
command: 'idf.py build'
28+
29+
- name: Upload Build Outputs
30+
uses: actions/upload-artifact@v3
31+
with:
32+
name: build-artifacts
33+
path: |
34+
build/bootloader/bootloader.bin
35+
build/partition_table/partition-table.bin
36+
build/*.bin
37+
build/flash_args
38+
39+
- name: Attach files to release
40+
uses: softprops/action-gh-release@v1
41+
if: ${{ github.event.release && github.event.action == 'published' }}
42+
with:
43+
files: |
44+
build/*.bin
45+
build/bootloader/bootloader.bin
46+
build/partition_table/partition-table.bin
47+
build/flash_args
48+

.github/workflows/static_analysis.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Static analysis
2+
3+
on: [pull_request]
4+
5+
jobs:
6+
static_analysis:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v2
12+
with:
13+
submodules: 'recursive'
14+
15+
- name: Run static analysis
16+
uses: esp-cpp/StaticAnalysis@master
17+
with:
18+
# Do not build the project and do not use cmake to generate compile_commands.json
19+
use_cmake: false
20+
21+
# Use the 5.2 release version since it's what we build with
22+
esp_idf_version: release/v5.2
23+
24+
# (Optional) cppcheck args
25+
cppcheck_args: -i$GITHUB_WORKSPACE/components/espp -i$GITHUB_WORKSPACE/components/jpegdec -i$GITHUB_WORKSPACE/components/esp-protocols --force --enable=all --inline-suppr --inconclusive --platform=mips32 --std=c++17 --suppressions-list=$GITHUB_WORKSPACE/suppressions.txt

.pre-commit-config.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/mirrors-clang-format
3+
rev: v14.0.6
4+
hooks:
5+
- id: clang-format
6+
exclude: |
7+
(?x)(
8+
^components/esp-dsp/|
9+
^components/esp_littlefs/|
10+
^components/lvgl/|
11+
^components/state_machine/include/magic_enum.hpp|
12+
^external/alpaca/|
13+
^external/cli/|
14+
^external/csv2/|
15+
^external/fmt/
16+
)
17+
types_or: [c++, c]

main/box.hpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#pragma once
22

3-
#include "hal/spi_types.h"
43
#include "driver/gpio.h"
54
#include "driver/i2s_std.h"
65
#include "driver/spi_master.h"
6+
#include "hal/spi_types.h"
77

88
#include "i2c.hpp"
99
#include "st7789.hpp"
@@ -51,13 +51,13 @@ static constexpr bool touch_invert_x = true;
5151
static constexpr bool touch_invert_y = false;
5252
static constexpr gpio_num_t touch_interrupt = GPIO_NUM_3;
5353
using TouchDriver = espp::Tt21100;
54-
#define TOUCH_DRIVER_USE_WRITE 0
55-
#define TOUCH_DRIVER_USE_READ 1
56-
#define TOUCH_DRIVER_USE_WRITE_READ 0
54+
#define TOUCH_DRIVER_USE_WRITE 0
55+
#define TOUCH_DRIVER_USE_READ 1
56+
#define TOUCH_DRIVER_USE_WRITE_READ 0
5757

5858
// sound
5959
static constexpr gpio_num_t sound_power_pin = GPIO_NUM_46;
60-
static constexpr auto i2s_port = I2S_NUM_0;
60+
static constexpr auto i2s_port = I2S_NUM_0;
6161
static constexpr gpio_num_t i2s_mck_io = GPIO_NUM_2;
6262
static constexpr gpio_num_t i2s_bck_io = GPIO_NUM_17;
6363
static constexpr gpio_num_t i2s_ws_io = GPIO_NUM_47;
@@ -72,4 +72,4 @@ static constexpr gpio_num_t sdcard_miso = GPIO_NUM_13;
7272
static constexpr gpio_num_t sdcard_sclk = GPIO_NUM_12;
7373
static constexpr auto sdcard_spi_num = SPI3_HOST;
7474

75-
} // namespace box_hal
75+
} // namespace hal

main/box_3.hpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
#pragma once
22

3-
#include "hal/spi_types.h"
43
#include "driver/gpio.h"
54
#include "driver/i2s_std.h"
65
#include "driver/spi_master.h"
6+
#include "hal/spi_types.h"
77

8+
#include "gt911.hpp"
89
#include "i2c.hpp"
910
#include "st7789.hpp"
1011
#include "touchpad_input.hpp"
11-
#include "gt911.hpp"
1212

1313
namespace hal {
1414

@@ -51,13 +51,13 @@ static constexpr bool touch_invert_x = false;
5151
static constexpr bool touch_invert_y = false;
5252
static constexpr gpio_num_t touch_interrupt = GPIO_NUM_3;
5353
using TouchDriver = espp::Gt911;
54-
#define TOUCH_DRIVER_USE_WRITE 1
55-
#define TOUCH_DRIVER_USE_READ 0
56-
#define TOUCH_DRIVER_USE_WRITE_READ 1
54+
#define TOUCH_DRIVER_USE_WRITE 1
55+
#define TOUCH_DRIVER_USE_READ 0
56+
#define TOUCH_DRIVER_USE_WRITE_READ 1
5757

5858
// sound
5959
static constexpr gpio_num_t sound_power_pin = GPIO_NUM_46;
60-
static constexpr auto i2s_port = I2S_NUM_0;
60+
static constexpr auto i2s_port = I2S_NUM_0;
6161
static constexpr gpio_num_t i2s_mck_io = GPIO_NUM_2;
6262
static constexpr gpio_num_t i2s_bck_io = GPIO_NUM_17;
6363
static constexpr gpio_num_t i2s_ws_io = GPIO_NUM_45; // was 47 on ESP32-S3-BOX
@@ -72,4 +72,4 @@ static constexpr gpio_num_t sdcard_miso = GPIO_NUM_13;
7272
static constexpr gpio_num_t sdcard_sclk = GPIO_NUM_12;
7373
static constexpr auto sdcard_spi_num = SPI3_HOST;
7474

75-
} // namespace box_hal
75+
} // namespace hal

0 commit comments

Comments
 (0)