2020-05-30 02:40:03 +08:00
|
|
|
name: Code Formatting
|
|
|
|
|
|
|
|
on: [push]
|
|
|
|
# push:
|
|
|
|
# branches: [ master ]
|
|
|
|
# pull_request:
|
|
|
|
# branches: [ master ]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2020-05-30 02:44:04 +08:00
|
|
|
- name: requirements
|
|
|
|
run: |
|
|
|
|
sudo apt -qq -y update
|
|
|
|
sudo apt -qq install clang-format
|
|
|
|
- uses: actions/checkout@master
|
|
|
|
with:
|
|
|
|
submodules: true
|
|
|
|
- name: Formatter
|
2020-05-30 02:57:18 +08:00
|
|
|
run: |
|
|
|
|
export line1='{ BasedOnStyle: LLVM, UseTab: Never,'
|
|
|
|
export line2='IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman,'
|
|
|
|
export line3='AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false,'
|
|
|
|
export line4='ColumnLimit: 80, AccessModifierOffset: -4 }'
|
2020-05-30 03:13:56 +08:00
|
|
|
for fname in $(find . -name '*.c' -o -name '*.h'); do clang-format -i --style="$line1 $line2 $line3 $line4" $fname; done
|
2020-05-30 02:57:18 +08:00
|
|
|
|
2020-05-30 02:44:04 +08:00
|
|
|
- name: test
|
|
|
|
run: git diff
|
2020-05-30 02:40:03 +08:00
|
|
|
|