From 02c82d448e52a1918d5a45053a687c5eeb120ab0 Mon Sep 17 00:00:00 2001 From: Valentin Roland Date: Sat, 25 May 2024 14:27:33 +0200 Subject: [PATCH] add format check --- .github/workflows/main.yml | 11 +++++++++++ Makefile | 18 ++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb5d808e..a50dc97e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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: @@ -11,6 +21,7 @@ jobs: version: - release-v4.4 - release-v5.1 + - release-v5.2 example: - calibration_helper - demo diff --git a/Makefile b/Makefile index ad19a5f5..385cc55f 100644 --- a/Makefile +++ b/Makefile @@ -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)) @@ -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 \