diff --git a/.clang-format b/.clang-format new file mode 100644 index 00000000..d43a5830 --- /dev/null +++ b/.clang-format @@ -0,0 +1,10 @@ +BasedOnStyle: LLVM +IndentWidth: 4 +TabWidth: 4 +UseTab: Never +BreakBeforeBraces: Allman +ColumnLimit: 0 +DerivePointerAlignment: false +PointerAlignment: Left +AllowShortIfStatementsOnASingleLine: AllIfsAndElse +AllowShortLoopsOnASingleLine: true diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..e7f29236 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: ["**"] + pull_request: + +jobs: + format: + name: Format Check + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install clang-format + run: sudo apt-get update && sudo apt-get install -y clang-format + + - name: Verify formatting + run: | + files=$(git ls-files '*.c' '*.cpp' '*.h' '*.hpp') + if [ -z "$files" ]; then + echo "No C/C++ files to check." + exit 0 + fi + clang-format --version + clang-format --dry-run --Werror $files + + build: + name: PlatformIO Build + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - name: Cache PlatformIO + uses: actions/cache@v4 + with: + path: | + ~/.platformio + key: ${{ runner.os }}-platformio-${{ hashFiles('platformio.ini') }} + + - name: Install PlatformIO + run: python -m pip install --upgrade platformio + + - name: Build (default env) + run: pio run -e tlora_pager_sx1262