Skip to content

Commit

Permalink
add format check
Browse files Browse the repository at this point in the history
  • Loading branch information
vroland committed May 25, 2024
1 parent 8d7abf3 commit 02c82d4
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ name: ESP-IDF
on: [push, pull_request]

jobs:
format-check:
runs-on: ubuntu-latest
container:
image: "espressif/idf:release-v5.2"
steps:
- uses: actions/checkout@v4
- run: apt update
- run: apt install clang-format
- run: make format-check

build:
runs-on: ubuntu-latest
strategy:
Expand All @@ -11,6 +21,7 @@ jobs:
version:
- release-v4.4
- release-v5.1
- release-v5.2
example:
- calibration_helper
- demo
Expand Down
18 changes: 12 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@ EXPORTED_MODES ?= 1,2,5,16,17
# Generate waveforms in room temperature range
EXPORT_TEMPERATURE_RANGE ?= 15,35

FORMATTED_FILES := $(shell find ./ -regex '.*\.\(c\|cpp\|h\|ino\)$$' \
-not -regex '.*/\(.ccls-cache\|.cache\|waveforms\|\components\|build\)/.*' \
-not -regex '.*/img_.*.h' \
-not -regex '.*/build.*' \
-not -regex '.*/\(firasans_.*.h\|opensans.*.h\|amiri.h\|alexandria.h\|dragon.h\)' \
-not -regex '.*E[DS][0-9]*[A-Za-z]*[0-9].h')

# the default headers that should come with the distribution
default: \
$(patsubst %,src/waveforms/epdiy_%.h,$(SUPPORTRED_DISPLAYS))
Expand All @@ -17,12 +24,11 @@ clean:
rm src/waveforms/eink_*.h

format:
clang-format --style=file -i $(shell find ./ -regex '.*\.\(c\|cpp\|h\|ino\)$$' \
-not -regex '.*/\(.ccls-cache\|.cache\|waveforms\|\components\|build\)/.*' \
-not -regex '.*/img_.*.h' \
-not -regex '.*/build.*' \
-not -regex '.*/\(firasans_.*.h\|opensans.*.h\|amiri.h\|alexandria.h\|dragon.h\)' \
-not -regex '.*E[DS][0-9]*[A-Za-z]*[0-9].h')
clang-format --style=file -i $(FORMATTED_FILES)

format-check:
clang-format --style=file --dry-run -Werror $(FORMATTED_FILES)


src/waveforms/epdiy_%.h: src/waveforms/epdiy_%.json
python3 scripts/waveform_hdrgen.py \
Expand Down

0 comments on commit 02c82d4

Please sign in to comment.