Skip to content

Commit 9667062

Browse files
authored
Initialize dev
0 parents  commit 9667062

File tree

6 files changed

+875
-0
lines changed

6 files changed

+875
-0
lines changed

.clang-format

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
BasedOnStyle: Microsoft
2+
IndentWidth: 2
3+
TabWidth: 2
4+
UseTab: Never
5+
ColumnLimit: 100
6+
7+
ReflowComments: false
8+
9+
SortIncludes: false
10+
PointerAlignment: Left
11+
AlignConsecutiveMacros: true
12+
AlignConsecutiveAssignments: true
13+
AllowShortIfStatementsOnASingleLine: false
14+
BreakBeforeBraces: Allman
15+
SpaceAfterCStyleCast: true
16+
IndentCaseLabels: true

.github/workflows/auto-format.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Auto Format C++ / Arduino
2+
3+
on:
4+
push:
5+
branches: [ dev ]
6+
pull_request:
7+
branches: [ dev ]
8+
workflow_dispatch:
9+
10+
jobs:
11+
auto-format:
12+
name: Apply clang-format and push fixes
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Install clang-format
24+
run: sudo apt-get update && sudo apt-get install -y clang-format
25+
26+
- name: Run clang-format on C++ / Arduino files
27+
run: |
28+
echo "Running clang-format..."
29+
FILES=$(find . -type f \( -name "*.cpp" -o -name "*.h" -o -name "*.hpp" -o -name "*.ino" -o -name "*.pde" \))
30+
if [ -z "$FILES" ]; then
31+
echo "No C++ or Arduino files found."
32+
exit 0
33+
fi
34+
clang-format -i $FILES
35+
36+
- name: Commit and push changes if formatting modified files
37+
run: |
38+
if [[ -n "$(git status --porcelain)" ]]; then
39+
echo "Formatting changes detected. Committing and pushing..."
40+
git config user.name "github-actions[bot]"
41+
git config user.email "github-actions[bot]@users.noreply.github.com"
42+
git add .
43+
git commit -m "style: auto-format C++ / Arduino code"
44+
git push
45+
else
46+
echo "No formatting changes needed."
47+
fi

.github/workflows/push-main.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Push dev changes to main
2+
3+
on:
4+
push:
5+
branches:
6+
- dev
7+
8+
jobs:
9+
push_main:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout main branch
14+
uses: actions/checkout@v4
15+
with:
16+
ref: main
17+
path: main
18+
19+
- name: Checkout dev branch
20+
uses: actions/checkout@v4
21+
with:
22+
ref: dev
23+
path: dev
24+
25+
- name: Identify project folder (contains .ino)
26+
id: detect_folder
27+
run: |
28+
cd dev
29+
folder=$(find . -mindepth 1 -maxdepth 2 -type f -name "*.ino" -printf '%h\n' | sort -u | head -n 1)
30+
if [ -z "$folder" ]; then
31+
echo "No .ino file found!"
32+
exit 1
33+
fi
34+
echo "Found project folder: $folder"
35+
echo "folder_name=${folder#./}" >> $GITHUB_OUTPUT
36+
37+
- name: Sync dev → main (include full project directory)
38+
run: |
39+
cd main
40+
# Remove everything except the .git folder
41+
find . -mindepth 1 -maxdepth 1 ! -name ".git" -exec rm -rf {} +
42+
43+
# Copy the entire project directory (keeping its name)
44+
rsync -av --exclude='.git' --exclude='.github' ../dev/${{ steps.detect_folder.outputs.folder_name }} ./
45+
46+
# Copy LICENSE and README if they exist
47+
cp ../dev/LICENSE ./LICENSE || true
48+
cp ../dev/README.md ./README.md || true
49+
50+
echo "Copied ${{ steps.detect_folder.outputs.folder_name }} directory + LICENSE + README.md"
51+
52+
- name: Commit and push to main
53+
uses: EndBug/add-and-commit@v9
54+
with:
55+
cwd: main
56+
author_name: Jura the Push Robot
57+
author_email: robot@example.com
58+
message: "Push changes from dev"
59+
branch: main
60+
add: "."

0 commit comments

Comments
 (0)