Skip to content

Commit 73c7035

Browse files
Initial commit
0 parents  commit 73c7035

26 files changed

+694
-0
lines changed

.clang-format

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
---
2+
Language: Cpp
3+
IndentWidth: 2
4+
AlignAfterOpenBracket: Align
5+
AlignArrayOfStructures: Left
6+
AlignConsecutiveAssignments: AcrossComments
7+
AlignConsecutiveBitFields: AcrossComments
8+
AlignConsecutiveDeclarations: AcrossComments
9+
AlignConsecutiveMacros: AcrossComments
10+
AlignConsecutiveTableGenBreakingDAGArgColons: AcrossComments
11+
AlignConsecutiveTableGenCondOperatorColons: AcrossComments
12+
AlignConsecutiveTableGenDefinitionColons: AcrossComments
13+
AlignEscapedNewlines: DontAlign
14+
AlignOperands: AlignAfterOperator
15+
AlignTrailingComments:
16+
Kind: Always
17+
OverEmptyLines: 1
18+
AllowAllArgumentsOnNextLine: false
19+
AllowShortBlocksOnASingleLine: Empty
20+
AllowShortCaseExpressionOnASingleLine: true
21+
AllowShortCaseLabelsOnASingleLine: true
22+
AllowShortEnumsOnASingleLine: true
23+
AllowShortFunctionsOnASingleLine: All
24+
AllowShortIfStatementsOnASingleLine: WithoutElse
25+
AllowShortLambdasOnASingleLine: Inline
26+
AllowShortLoopsOnASingleLine: false
27+
AlwaysBreakBeforeMultilineStrings: false
28+
EmptyLineAfterAccessModifier: Never
29+
EmptyLineBeforeAccessModifier: Always
30+
FixNamespaceComments: true
31+
KeepEmptyLines:
32+
AtEndOfFile: true
33+
AtStartOfBlock: false
34+
AtStartOfFile: false
35+
MaxEmptyLinesToKeep: 2
36+
PointerAlignment: Right
37+
SpaceBeforeAssignmentOperators: true
38+
SpaceBeforeParens: Never
39+
SpacesBeforeTrailingComments: 1
40+
SpacesInAngles: false
41+
SpaceInEmptyParentheses: false
42+
SpacesInParentheses: false
43+
SpacesInSquareBrackets: false

.clang-tidy

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
Checks: '-*,cppcoreguidelines-*,cert-*,clang-analyzer-*,performance-*,readability-*'
3+
FormatStyle: file

.github/workflows/lint.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: C++ Linter
2+
3+
on: [pull_request]
4+
5+
permissions:
6+
contents: read
7+
pull-requests: write
8+
9+
jobs:
10+
cpp-linter:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/cache@v4
15+
with:
16+
path: |
17+
~/.cache/pip
18+
~/.platformio/.cache
19+
key: ${{ runner.os }}-pio
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.9"
23+
- name: Install PlatformIO Core
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install platformio
27+
- name: Build Compilation Database
28+
run: platformio run -e esp32dev --target compiledb
29+
- uses: cpp-linter/cpp-linter-action@main
30+
id: linter
31+
continue-on-error: true
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
with:
35+
# style: file
36+
tidy-checks: ""
37+
database: compile_commands.json
38+
files-changed-only: true
39+
no-lgtm: false
40+
step-summary: true
41+
file-annotations: true
42+
tidy-review: true
43+
format-review: true
44+
thread-comments: ${{ github.event_name == 'pull_request' && 'update' }}

.github/workflows/prlint.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Pull Request Message Validation
2+
on: pull_request
3+
4+
permissions:
5+
pull-requests: read
6+
7+
jobs:
8+
prlint:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Validate Pull Request
12+
uses: amannn/action-semantic-pull-request@v5
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/publish.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: Publish to PlatformIO
2+
3+
on:
4+
release:
5+
types: [released]
6+
workflow_call:
7+
8+
permissions:
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
pio-publish:
14+
runs-on: ubuntu-latest
15+
name: Publish a new Release to PlatformIO
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-tags: true
20+
- uses: actions/setup-python@v5
21+
with:
22+
python-version: "3.9"
23+
- name: Install PlatformIO Core
24+
run: |
25+
python -m pip install --upgrade pip
26+
pip install platformio
27+
- name: Install jq for handling JSON data
28+
run: |
29+
sudo apt update
30+
sudo apt install -y jq
31+
- name: Update Library Metadata and Configurations
32+
run: |
33+
LATEST_TAG=$(git describe --tags --abbrev=0)
34+
LIB_V=$(jq -r .version library.json)
35+
PROPS_V=$(cat library.properties | grep -oP version=\K.*)
36+
if [ $LIB_V = $LATEST_TAG ] || [ $PROPS_V = $LATEST_TAG ]; then
37+
exit 1
38+
fi
39+
set -e
40+
sed -i -E "s/(version=).*/\1${LATEST_TAG}/" library.properties
41+
echo ✅ Successfully Modified release tag in library.json file...
42+
jq ".version = \"${LATEST_TAG}\"" library.json > temp.json && mv temp.json library.json
43+
echo ✅ Successfully Modified release tag in library.properties file...
44+
- name: Publish to PlatformIO
45+
env:
46+
PLATFORMIO_AUTH_TOKEN: ${{ secrets.PLATFORMIO_AUTH_TOKEN }}
47+
run: |
48+
pio package publish --no-interactive --type library
49+
echo 👍 Successfully published to PlatformIO
50+
51+
update-lib-versions:
52+
runs-on: ubuntu-latest
53+
name: Update versions in library.json and library.properties
54+
needs: pio-publish
55+
steps:
56+
- uses: actions/checkout@v4
57+
with:
58+
fetch-tags: true
59+
- name: Update library versions
60+
run: |
61+
LATEST_TAG=$(git describe --tags --abbrev=0)
62+
set -e
63+
sed -i -E "s/(version=).*/\1${LATEST_TAG}/" library.properties
64+
jq ".version = \"${LATEST_TAG}\"" library.json > temp.json && mv temp.json library.json
65+
- name: Push to main branch using PAT
66+
env:
67+
PAT: ${{ secrets.CI_PAT }} # new fine-grained PAT with contents = rw
68+
run: |
69+
git config --global user.name "GitHub Actions"
70+
git config --global user.email "actions@github.com"
71+
git remote set-url origin https://x-access-token:${{ env.PAT }}@github.com/${{ github.repository }}
72+
git stash
73+
git pull origin main
74+
git stash pop
75+
git add library.json library.properties
76+
git commit -m "Automated update: Update library.json library.properties"
77+
git push

.github/workflows/tests.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: PlatformIO Unit Tests
2+
3+
on: [push, workflow_call]
4+
5+
permissions:
6+
contents: read
7+
8+
jobs:
9+
test:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest, windows-latest]
14+
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/cache@v4
18+
with:
19+
path: |
20+
~/.cache/pip
21+
~/.platformio/.cache
22+
key: ${{ runner.os }}-pio
23+
- uses: actions/setup-python@v5
24+
with:
25+
python-version: "3.9"
26+
- name: Install PlatformIO Core
27+
run: |
28+
python -m pip install --upgrade pip
29+
pip install platformio
30+
- name: Run Tests on the Desktop Environment
31+
run: platformio test -e desktop
32+
- name: Run Build Test for ESP32 Dev Module
33+
run: platformio run -e esp32dev -t build_test.cpp

.gitignore

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
.DS_Store
2+
3+
# Visual Studio project configurations
4+
.vscode/*
5+
/.vs
6+
7+
!.vscode/settings.json
8+
!.vscode/extensions.json
9+
10+
# Compilation output
11+
/out
12+
bin/
13+
build/
14+
.idea/
15+
CMakeSettings.json
16+
17+
# PlatformIO
18+
.pio/
19+
compile_commands.json

.trunk/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*out
2+
*logs
3+
*actions
4+
*notifications
5+
*tools
6+
plugins
7+
user_trunk.yaml
8+
user.yaml
9+
tmp

.trunk/configs/.markdownlint.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Prettier friendly markdownlint config (all formatting rules disabled)
2+
extends: markdownlint/style/prettier

.trunk/configs/.yamllint.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules:
2+
quoted-strings:
3+
required: only-when-needed
4+
extra-allowed: ["{|}"]
5+
key-duplicates: {}
6+
octal-values:
7+
forbid-implicit-octal: true

0 commit comments

Comments
 (0)