Skip to content

Commit

Permalink
Ci/add (#6)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
finger563 authored Feb 18, 2024
1 parent 1ec3bec commit a91eedf
Show file tree
Hide file tree
Showing 12 changed files with 453 additions and 215 deletions.
117 changes: 117 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlines: Right
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: false
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
AfterExternBlock: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeInheritanceComma: false
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: true
BreakConstructorInitializers: BeforeColon
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 100
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerAllOnOneLineOrOnePerLine: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
- Regex: '.*'
Priority: 1
IncludeIsMainRegex: '(Test)?$'
IndentCaseLabels: false
IndentPPDirectives: None
IndentWidth: 2
IndentWrappedFunctionNames: false
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
RawStringFormats:
- Language: TextProto
Delimiters:
- 'pb'
- 'proto'
BasedOnStyle: google
ReflowComments: true
SortIncludes: true
SortUsingDeclarations: true
SpaceAfterCStyleCast: false
SpaceAfterTemplateKeyword: true
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Cpp11
TabWidth: 8
UseTab: Never
...

21 changes: 21 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Build

on: [pull_request]

jobs:
build:

runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Build Examples
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: release-v5.2
target: esp32s3
path: '.'
48 changes: 48 additions & 0 deletions .github/workflows/package_main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build and Package Main

on:
push:
branches: [main]
release:
types: [published]

jobs:
build:

runs-on: ubuntu-latest
continue-on-error: false

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Build Main Code
uses: espressif/esp-idf-ci-action@v1
with:
esp_idf_version: release-v5.2
target: esp32s3
path: '.'
command: 'idf.py build'

- name: Upload Build Outputs
uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: |
build/bootloader/bootloader.bin
build/partition_table/partition-table.bin
build/*.bin
build/flash_args
- name: Attach files to release
uses: softprops/action-gh-release@v1
if: ${{ github.event.release && github.event.action == 'published' }}
with:
files: |
build/*.bin
build/bootloader/bootloader.bin
build/partition_table/partition-table.bin
build/flash_args
25 changes: 25 additions & 0 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Static analysis

on: [pull_request]

jobs:
static_analysis:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Run static analysis
uses: esp-cpp/StaticAnalysis@master
with:
# Do not build the project and do not use cmake to generate compile_commands.json
use_cmake: false

# Use the 5.2 release version since it's what we build with
esp_idf_version: release/v5.2

# (Optional) cppcheck args
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
17 changes: 17 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
repos:
- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v14.0.6
hooks:
- id: clang-format
exclude: |
(?x)(
^components/esp-dsp/|
^components/esp_littlefs/|
^components/lvgl/|
^components/state_machine/include/magic_enum.hpp|
^external/alpaca/|
^external/cli/|
^external/csv2/|
^external/fmt/
)
types_or: [c++, c]
12 changes: 6 additions & 6 deletions main/box.hpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#pragma once

#include "hal/spi_types.h"
#include "driver/gpio.h"
#include "driver/i2s_std.h"
#include "driver/spi_master.h"
#include "hal/spi_types.h"

#include "i2c.hpp"
#include "st7789.hpp"
Expand Down Expand Up @@ -51,13 +51,13 @@ static constexpr bool touch_invert_x = true;
static constexpr bool touch_invert_y = false;
static constexpr gpio_num_t touch_interrupt = GPIO_NUM_3;
using TouchDriver = espp::Tt21100;
#define TOUCH_DRIVER_USE_WRITE 0
#define TOUCH_DRIVER_USE_READ 1
#define TOUCH_DRIVER_USE_WRITE_READ 0
#define TOUCH_DRIVER_USE_WRITE 0
#define TOUCH_DRIVER_USE_READ 1
#define TOUCH_DRIVER_USE_WRITE_READ 0

// sound
static constexpr gpio_num_t sound_power_pin = GPIO_NUM_46;
static constexpr auto i2s_port = I2S_NUM_0;
static constexpr auto i2s_port = I2S_NUM_0;
static constexpr gpio_num_t i2s_mck_io = GPIO_NUM_2;
static constexpr gpio_num_t i2s_bck_io = GPIO_NUM_17;
static constexpr gpio_num_t i2s_ws_io = GPIO_NUM_47;
Expand All @@ -72,4 +72,4 @@ static constexpr gpio_num_t sdcard_miso = GPIO_NUM_13;
static constexpr gpio_num_t sdcard_sclk = GPIO_NUM_12;
static constexpr auto sdcard_spi_num = SPI3_HOST;

} // namespace box_hal
} // namespace hal
14 changes: 7 additions & 7 deletions main/box_3.hpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#pragma once

#include "hal/spi_types.h"
#include "driver/gpio.h"
#include "driver/i2s_std.h"
#include "driver/spi_master.h"
#include "hal/spi_types.h"

#include "gt911.hpp"
#include "i2c.hpp"
#include "st7789.hpp"
#include "touchpad_input.hpp"
#include "gt911.hpp"

namespace hal {

Expand Down Expand Up @@ -51,13 +51,13 @@ static constexpr bool touch_invert_x = false;
static constexpr bool touch_invert_y = false;
static constexpr gpio_num_t touch_interrupt = GPIO_NUM_3;
using TouchDriver = espp::Gt911;
#define TOUCH_DRIVER_USE_WRITE 1
#define TOUCH_DRIVER_USE_READ 0
#define TOUCH_DRIVER_USE_WRITE_READ 1
#define TOUCH_DRIVER_USE_WRITE 1
#define TOUCH_DRIVER_USE_READ 0
#define TOUCH_DRIVER_USE_WRITE_READ 1

// sound
static constexpr gpio_num_t sound_power_pin = GPIO_NUM_46;
static constexpr auto i2s_port = I2S_NUM_0;
static constexpr auto i2s_port = I2S_NUM_0;
static constexpr gpio_num_t i2s_mck_io = GPIO_NUM_2;
static constexpr gpio_num_t i2s_bck_io = GPIO_NUM_17;
static constexpr gpio_num_t i2s_ws_io = GPIO_NUM_45; // was 47 on ESP32-S3-BOX
Expand All @@ -72,4 +72,4 @@ static constexpr gpio_num_t sdcard_miso = GPIO_NUM_13;
static constexpr gpio_num_t sdcard_sclk = GPIO_NUM_12;
static constexpr auto sdcard_spi_num = SPI3_HOST;

} // namespace box_hal
} // namespace hal
Loading

0 comments on commit a91eedf

Please sign in to comment.