diff --git a/.clang-tidy b/.clang-tidy index 09cf949..78b230f 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -1,2 +1,33 @@ -Checks: "*" +Checks: > + *, + -altera-unroll-loops, + -bugprone-branch-clone, + -bugprone-easily-swappable-parameters, + -cppcoreguidelines-avoid-c-arrays, + -cppcoreguidelines-avoid-magic-numbers, + -cppcoreguidelines-pro-bounds-constant-array-index, + -cppcoreguidelines-pro-bounds-pointer-arithmetic, + -cppcoreguidelines-pro-type-vararg, + -fuchsia-default-arguments-calls, + -fuchsia-default-arguments-declarations, + -fuchsia-statically-constructed-objects, + -google-runtime-int, + -hicpp-avoid-c-arrays, + -hicpp-vararg, + -llvm-header-guard, + -llvmlibc-callee-namespace, + -llvmlibc-implementation-in-namespace, + -misc-use-internal-linkage, + -modernize-avoid-c-arrays, + -modernize-use-trailing-return-type, + -portability-avoid-pragma-once, + -readability-convert-member-functions-to-static, + -readability-magic-numbers +CheckOptions: + - key: cppcoreguidelines-macro-usage.CheckCapsOnly + value: true + - key: misc-include-cleaner.MissingIncludes + value: false + - key: readability-identifier-length.IgnoredVariableNames + value: ^(rx|tx)$ FormatStyle: file diff --git a/.github/labeler.yml b/.github/labeler.yml index 72b5f96..31bc6bd 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -1,3 +1,9 @@ +avr: + - changed-files: + - any-glob-to-any-file: + - include/avr/**/* + - src/avr/**/* + bug: - head-branch: - ^fix/ @@ -13,3 +19,9 @@ documentation: enhancement: - head-branch: - ^feat/ + +esp: + - changed-files: + - any-glob-to-any-file: + - include/esp/**/* + - src/esp/**/* diff --git a/.github/workflows/clang.yml b/.github/workflows/clang.yml index 8f67aa0..f955374 100644 --- a/.github/workflows/clang.yml +++ b/.github/workflows/clang.yml @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up uv uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 @@ -38,6 +40,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Clang format uses: cpp-linter/cpp-linter-action@cab1143a2c149bc41e85b070a9de81716974c18f # v2.21.0 @@ -70,6 +74,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up Cache for PlatformIO continue-on-error: true @@ -122,11 +128,14 @@ jobs: tidy-checks: "" - name: Summary + env: + clang-threshold: 64 run: | - echo "Status: ${{ steps.tidy.outputs.checks-failed }} checks failed." + echo "Status: ${{ steps.tidy.outputs.checks-failed }} checks failed, threshold for success is ${{ env.clang-threshold }}." echo "Clang report:" if [ -n "${{ github.event.pull_request.number }}" ]; then echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}?pr=${{ github.event.pull_request.number }}" else echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" fi + exit $(( ${{ steps.tidy.outputs.checks-failed }} > ${{ env.clang-threshold }} )) diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 7737dc4..3489191 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -20,6 +20,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: PlatformIO Dependency Updater uses: VIPnytt/platformio-dependency-updater@151e4688a6696cc129b69b33de262f4be58b7904 # v1.0.2 diff --git a/.github/workflows/ikea-bekant.yml b/.github/workflows/ikea-bekant.yml new file mode 100644 index 0000000..5680a31 --- /dev/null +++ b/.github/workflows/ikea-bekant.yml @@ -0,0 +1,70 @@ +name: IKEA Bekant + +on: + merge_group: + types: + - checks_requested + + pull_request: + branches: + - main + + workflow_dispatch: + +permissions: + contents: read + +jobs: + context: + name: Context + runs-on: ubuntu-latest + outputs: + pio-environments: ${{ steps.platformio.outputs.environments }} + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up uv + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: 3.11 + version: latest-known + + - name: PlatformIO environments + id: platformio + run: echo "environments=$(uv run pio project config --json-output | jq -c '[.[] | .[0] | select(startswith("env:")) | sub("^env:"; "")]')" >> "$GITHUB_OUTPUT" + + build: + name: Build + needs: context + runs-on: ubuntu-latest + + strategy: + matrix: + environment: ${{ fromJSON(needs.context.outputs.pio-environments) }} + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up Cache for PlatformIO + uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 + with: + key: platformio-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('platformio.ini') }} + path: .platformio/.cache + + - name: Set up uv + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: 3.11 + version: latest-known + + - name: PlatformIO build + env: + PIO_ENVIRONMENT: ${{ matrix.environment }} + run: uv run pio run -e "$PIO_ENVIRONMENT" diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 0df1ca7..adf0463 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -3,7 +3,7 @@ name: Labeler on: pull_request_target: branches: - - master + - main permissions: contents: read @@ -19,6 +19,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Labeler uses: actions/labeler@bf12e9b00b37c5c0ca2b87b79b2daf7891dbda13 # v7.0.0 diff --git a/.github/workflows/platformio.yml b/.github/workflows/platformio.yml index 05039fe..43f094a 100644 --- a/.github/workflows/platformio.yml +++ b/.github/workflows/platformio.yml @@ -3,11 +3,11 @@ name: PlatformIO on: pull_request: branches: - - master + - main push: branches: - - master + - main workflow_dispatch: @@ -15,56 +15,6 @@ permissions: contents: read jobs: - context: - name: Context - runs-on: ubuntu-latest - outputs: - pio-environments: ${{ steps.platformio.outputs.environments }} - - steps: - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - name: Set up uv - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: 3.11 - version: latest-known - - - name: PlatformIO environments - id: platformio - run: echo "environments=$(uv run pio project config --json-output | jq -c '[.[] | .[0] | select(startswith("env:")) | sub("^env:"; "")]')" >> "$GITHUB_OUTPUT" - - build: - name: Build - needs: context - runs-on: ubuntu-latest - - strategy: - matrix: - environment: ${{ fromJSON(needs.context.outputs.pio-environments) }} - - steps: - - name: Checkout - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - - - name: Set up Cache for PlatformIO - uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0 - with: - key: platformio-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('platformio.ini') }} - path: .platformio/.cache - - - name: Set up uv - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 - with: - python-version: 3.11 - version: latest-known - - - name: PlatformIO build - env: - PIO_ENVIRONMENT: ${{ matrix.environment }} - run: uv run pio run -e "$PIO_ENVIRONMENT" - lint: name: Lint runs-on: ubuntu-latest @@ -72,6 +22,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false - name: Set up uv uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 diff --git a/.github/workflows/uv.yml b/.github/workflows/uv.yml new file mode 100644 index 0000000..08ce2db --- /dev/null +++ b/.github/workflows/uv.yml @@ -0,0 +1,31 @@ +name: uv + +on: + pull_request: + branches: + - main + + workflow_dispatch: + +permissions: + contents: read + +jobs: + uv-lock: + name: uv.lock consistency + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up uv + uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + python-version: 3.11 + version: latest-known + + - name: uv lock check + run: uv lock --check