mirror of
https://github.com/esp8266/Arduino.git
synced 2025-04-19 23:22:16 +03:00
CI - clang-format-15 (#9085)
Stop CI from pulling LLVM repos and using GNUPG keyservers, ubuntu-latest already has clang-format-{13,14,15} Fixes long-standing issue with -style=file:...
This commit is contained in:
parent
16e19181b9
commit
e6df345584
12
.github/workflows/style-check.yml
vendored
12
.github/workflows/style-check.yml
vendored
@ -24,20 +24,8 @@ jobs:
|
||||
with:
|
||||
python-version: '3.x'
|
||||
- name: Style check
|
||||
env:
|
||||
LLVM_SNAPSHOT_KEY: "6084F3CF814B57C1CF12EFD515CF4D18AF4F7421"
|
||||
run: |
|
||||
export GNUPGHOME=$(mktemp -d)
|
||||
gpg --batch --keyserver keyserver.ubuntu.com --recv-keys "$LLVM_SNAPSHOT_KEY"
|
||||
gpg --batch --armor --export "$LLVM_SNAPSHOT_KEY" | \
|
||||
sudo tee /etc/apt/trusted.gpg.d/llvm-snapshot.gpg.asc
|
||||
gpgconf --kill all
|
||||
rm -r $GNUPGHOME
|
||||
echo "deb http://apt.llvm.org/focal/ llvm-toolchain-focal-13 main" | \
|
||||
sudo tee /etc/apt/sources.list.d/llvm.list
|
||||
sudo apt update
|
||||
sudo apt install clang-format-13
|
||||
pip3 install pyyaml
|
||||
bash ./tests/ci/style_check.sh
|
||||
|
||||
# Validate orthography
|
||||
|
@ -398,7 +398,9 @@ bool ENC28J60::reset(void)
|
||||
|
||||
/* Wait for OST */
|
||||
PRINTF("waiting for ESTAT_CLKRDY\n");
|
||||
while ((readreg(ESTAT) & ESTAT_CLKRDY) == 0) { };
|
||||
while ((readreg(ESTAT) & ESTAT_CLKRDY) == 0)
|
||||
{
|
||||
};
|
||||
PRINTF("ESTAT_CLKRDY\n");
|
||||
|
||||
setregbank(ERXTX_BANK);
|
||||
|
@ -6,7 +6,6 @@ KeepEmptyLinesAtTheStartOfBlocks: false
|
||||
SpaceAfterTemplateKeyword: false
|
||||
SpaceBeforeInheritanceColon: false
|
||||
SpacesBeforeTrailingComments: 2
|
||||
AlignTrailingComments: true
|
||||
AllowShortBlocksOnASingleLine: Empty
|
||||
AllowShortFunctionsOnASingleLine: Empty
|
||||
AllowShortIfStatementsOnASingleLine: false
|
||||
|
@ -7,14 +7,9 @@ root=$(git rev-parse --show-toplevel)
|
||||
test -d ${root}/cores/esp8266
|
||||
test -d ${root}/libraries
|
||||
|
||||
# allow `env CLANG_FORMAT=clang-format-13`, or some other version
|
||||
# default to v13, latest stable version from https://apt.llvm.org
|
||||
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-13}
|
||||
|
||||
# TODO: waiting for llvm-14 to allow --style=file:<path-to-file>
|
||||
makeClangFormatStyle() {
|
||||
python3 -c 'import sys,yaml; sys.stdout.write(yaml.dump(yaml.safe_load(open(sys.argv[1], "r")), default_flow_style=True)); sys.stdout.flush();' $1
|
||||
}
|
||||
# allow `env CLANG_FORMAT=clang-format-N`, or some other version
|
||||
# default to v15, latest stable version from ubuntu-latest Github Actions image
|
||||
CLANG_FORMAT=${CLANG_FORMAT:-clang-format-15}
|
||||
|
||||
#########################################
|
||||
# 'all' variable should be "cores/esp8266 libraries"
|
||||
@ -37,14 +32,14 @@ tests
|
||||
|
||||
cd $root
|
||||
|
||||
style=$(makeClangFormatStyle ${root}/tests/clang-format-core.yaml)
|
||||
style=${root}/tests/clang-format-core.yaml
|
||||
for target in $all; do
|
||||
if [ -d "$target" ]; then
|
||||
find $target \
|
||||
'(' -name "*.cpp" -o -name "*.c" -o -name "*.h" ')' \
|
||||
-exec $CLANG_FORMAT --verbose --style="$style" -i {} \;
|
||||
-exec $CLANG_FORMAT --verbose --style="file:$style" -i {} \;
|
||||
else
|
||||
$CLANG_FORMAT --verbose --style="$style" -i $target
|
||||
$CLANG_FORMAT --verbose --style="file:$style" -i $target
|
||||
fi
|
||||
done
|
||||
|
||||
@ -55,12 +50,12 @@ done
|
||||
# exclude=$(git submodule --quiet foreach git rev-parse --show-toplevel | grep libraries)
|
||||
|
||||
if [ -z $1 ] ; then
|
||||
style=$(makeClangFormatStyle ${root}/tests/clang-format-arduino.yaml)
|
||||
style=${root}/tests/clang-format-arduino.yaml
|
||||
find libraries \
|
||||
-path libraries/ESP8266SdFat -prune -o \
|
||||
-path libraries/Ethernet -prune -o \
|
||||
-path libraries/SoftwareSerial -prune -o \
|
||||
-name '*.ino' -exec $CLANG_FORMAT --verbose --style="$style" -i {} \;
|
||||
-name '*.ino' -exec $CLANG_FORMAT --verbose --style="file:$style" -i {} \;
|
||||
fi
|
||||
|
||||
#########################################
|
||||
|
Loading…
x
Reference in New Issue
Block a user