Skip to content

Commit

Permalink
update to clang-format v14; update pre-commit hooks
Browse files Browse the repository at this point in the history
- includes changes to .clang-format config
- ran clang-format on incorrectly formatted sources
- updated erroneous ignore pattern in CI workflows
- upgraded pre-commit hooks
- switch from black to to ruff for formatting python sources
- ran `ruff format` on python files
- format Arduino examples
- update CI triggers
- update all actions used in CI
  • Loading branch information
2bndy5 committed Mar 22, 2024
1 parent 9b94552 commit d60c977
Show file tree
Hide file tree
Showing 29 changed files with 199 additions and 216 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/build_arduino.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ env:

jobs:
check_formatting:
uses: 2bndy5/CirquePinnacle/.github/workflows/cpp_lint.yaml@master
uses: ./.github/workflows/cpp_lint.yaml
with:
extensions: 'ino'

Expand Down Expand Up @@ -53,7 +53,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Compile examples
uses: arduino/compile-sketches@main
Expand All @@ -66,24 +66,31 @@ jobs:
- examples/anymeas_mode
- examples/relative_mode
- name: sketch reports
if: matrix.enable-deltas-report
id: delta-report-name
run: >-
echo "report-name=${{ matrix.fqbn }}" | tr : - >> "$GITHUB_OUTPUT"
# This step is needed to pass the size data to the report job
- name: Upload sketches report to workflow artifact
if: matrix.enable-deltas-report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ env.SKETCH_REPORTS_PATH }}
name: arduino-deltas-${{ steps.delta-report-name.outputs.report-name }}
path: ${{ env.SKETCH_REPORTS_PATH }}

report_size_deltas:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Download sketches reports artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ env.SKETCH_REPORTS_PATH }}
pattern: arduino-deltas-*
path: ${{ env.SKETCH_REPORTS_PATH }}

- uses: arduino/report-size-deltas@v1
- uses: 2bndy5/report-size-deltas@update-comment
with:
sketches-reports-source: ${{ env.SKETCH_REPORTS_PATH }}
update-comment: true
6 changes: 3 additions & 3 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install sphinx deps
run: python -m pip install -r docs/requirements.txt
Expand All @@ -39,7 +39,7 @@ jobs:
run: sphinx-build . _build/html

- name: Save sphinx docs as artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Cirque_Pinnacle_docs
path: ${{ github.workspace }}/docs/_build/html
12 changes: 6 additions & 6 deletions .github/workflows/build_linux.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
name: Linux

on:
pull_request_target:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- "library.properties" # CMake gets lib info from here
- "src/*.h"
Expand All @@ -19,6 +18,7 @@ on:
- "examples/linux/*"
- ".github/workflows/build_linux.yml"
push:
branches: [master]
paths:
- "library.properties" # CMake gets lib info from here
- "src/*.h"
Expand All @@ -43,9 +43,9 @@ env:

jobs:
check_formatting:
uses: 2bndy5/CirquePinnacle/.github/workflows/cpp_lint.yaml@master
uses: ./.github/workflows/cpp_lint.yaml
with:
ignore: 'examples|examples_pico|utility/bcm2xxx/bcm2835.h|utility/bcm2xxx/bcm2835.c'
ignore: 'examples|!examples/linux|src/utility/bcm2xxx/bcm2835.h|src/utility/bcm2xxx/bcm2835.c'
build:
needs: check_formatting
runs-on: ubuntu-latest
Expand Down Expand Up @@ -92,7 +92,7 @@ jobs:
id: lib-info
run: echo "name=$(echo ${{ github.repository }} | sed 's;.\+/;;')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: ${{ steps.lib-info.outputs.name }}

Expand Down Expand Up @@ -148,7 +148,7 @@ jobs:

- name: Save artifact
if: endsWith(matrix.i2c-bus, 'OFF') && endsWith(matrix.dr-pin, 'OFF')
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: pkg_${{ steps.lib-info.outputs.name }}
path: |
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/build_pico_sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Pico SDK

on:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- "src/*.cpp"
- "!src/py_bindings.cpp"
Expand All @@ -12,6 +12,7 @@ on:
- "examples/pico_sdk/**"
- ".github/workflows/build_pico_sdk.yml"
push:
branches: [master]
paths:
- "src/*.cpp"
- "!src/py_bindings.cpp"
Expand All @@ -23,9 +24,9 @@ on:

jobs:
check_formatting:
uses: 2bndy5/CirquePinnacle/.github/workflows/cpp_lint.yaml@master
uses: ./.github/workflows/cpp_lint.yaml
with:
ignore: 'examples/pico_sdk|'
ignore: '!examples/pico_sdk|'
build:
needs: check_formatting
runs-on: ubuntu-latest
Expand All @@ -52,15 +53,15 @@ jobs:
id: lib-info
run: echo "name=$(echo ${{ github.repository }} | sed 's;.\+/;;')" >> $GITHUB_OUTPUT

- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
path: ${{ steps.lib-info.outputs.name }}

- name: Install toolchain
run: sudo apt update && sudo apt install gcc-arm-none-eabi libnewlib-arm-none-eabi build-essential

- name: Clone pico-sdk
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: raspberrypi/pico-sdk
# master branch is latest stable release
Expand Down Expand Up @@ -88,7 +89,7 @@ jobs:
run: cmake --build . --config $BUILD_TYPE

- name: Save artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: examples_pico_${{ matrix.board }}_${{ matrix.i2c-bus }}_${{ matrix.dr-pin }}
path: |
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/build_platformio.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ name: PlatformIO

on:
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- ".github/workflows/build_platformio.yml"
- "library.json"
- "examples/**/*.ino"
push:
branches: [master]
paths:
- ".github/workflows/build_platformio.yml"
- "library.json"
Expand All @@ -20,7 +21,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: get lib info
id: lib-info
Expand All @@ -29,7 +30,7 @@ jobs:
echo "release=$(awk -F "=" '/version/ {print $2}' library.properties)" >> $GITHUB_OUTPUT
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

Expand All @@ -42,7 +43,7 @@ jobs:
run: pio package pack -o PlatformIO-${{ steps.lib-info.outputs.name }}-${{ steps.lib-info.outputs.release }}.tar.gz

- name: Save artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: PIO_pkg_${{ steps.lib-info.outputs.name }}
path: PlatformIO*.tar.gz
Expand All @@ -62,7 +63,7 @@ jobs:
run: pio package publish --owner 2bndy5 --non-interactive

check_formatting:
uses: 2bndy5/CirquePinnacle/.github/workflows/cpp_lint.yaml@master
uses: ./.github/workflows/cpp_lint.yaml
with:
extensions: ino

Expand Down Expand Up @@ -90,25 +91,25 @@ jobs:

steps:
- name: Cache pip
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Cache PlatformIO
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.platformio
key: ${{ runner.os }}-${{ matrix.board }}

- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Install PlatformIO
run: |
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/build_python.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: Python

on:
pull_request_target:
workflow_dispatch:
release:
types: [published]
pull_request:
types: [opened, reopened]
branches: [master]
paths:
- "src/*.h"
- "src/*.cpp"
Expand All @@ -17,6 +16,7 @@ on:
- "src/utility/linux_kernel/*"
- ".github/workflows/build_python.yml"
push:
branches: [master]
paths:
- "src/*.h"
- "src/*.cpp"
Expand All @@ -33,12 +33,12 @@ jobs:
steps:
- name: Set up Python
id: python-setup
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Checkout Current Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
Expand All @@ -50,7 +50,7 @@ jobs:
run: python -m build -s

- name: Cache pre-commit venv
uses: actions/cache@v3
uses: actions/cache@v4
with:
key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
path: '~/.cache/pre-commit'
Expand All @@ -63,7 +63,7 @@ jobs:
run: twine check dist/*

- name: Save distributable source as artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "cirque_pinnacle-sdist"
path: ${{ github.workspace }}/dist
Expand All @@ -75,7 +75,7 @@ jobs:
BUILD_ARCH: native
steps:
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

Expand All @@ -86,7 +86,7 @@ jobs:
python3 -m pip install twine
- name: Fetch distributable source artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: "cirque_pinnacle-sdist"
path: ${{ github.workspace }}/sdist
Expand All @@ -95,7 +95,7 @@ jobs:
run: pip install sdist/*.tar.gz -v

- name: Checkout Current Repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
Expand Down Expand Up @@ -125,7 +125,7 @@ jobs:
run: python3 -m twine check dist/*

- name: Save distributable wheels as artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: "cirque_pinnacle-bdist"
path: ${{ github.workspace }}/dist
Expand All @@ -136,18 +136,18 @@ jobs:
needs: [check_source, build_linux]
steps:
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.x

- name: Fetch distributable wheel artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: "cirque_pinnacle-bdist"
path: ${{ github.workspace }}/dist

- name: Fetch distributable source artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: "cirque_pinnacle-sdist"
path: ${{ github.workspace }}/dist
Expand Down
Loading

0 comments on commit d60c977

Please sign in to comment.