From 4089104ead6eeb8937151b862f9023e161747a38 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 | 9 +++++++++ Makefile | 18 ++++++++++++------ 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index bb5d808e..137790c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,6 +3,14 @@ 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: make format-check + build: runs-on: ubuntu-latest strategy: @@ -11,6 +19,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 \