2021-11-22 08:52:18 -05:00
|
|
|
name: Verify code formatting
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
pull_request:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
verify-formatting:
|
2022-03-07 10:04:59 -05:00
|
|
|
if: ${{ github.event_name != 'pull_request' || github.repository != github.event.pull_request.head.repo.full_name }}
|
2024-04-08 18:18:13 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-11-22 08:52:18 -05:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2023-11-02 11:03:37 +01:00
|
|
|
uses: actions/checkout@v4
|
2021-11-22 08:52:18 -05:00
|
|
|
with:
|
|
|
|
persist-credentials: false
|
|
|
|
fetch-depth: 0
|
2023-11-10 15:37:23 +01:00
|
|
|
- name: Checkout astyle
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
with:
|
|
|
|
repository: szepeviktor/astyle
|
|
|
|
path: astyle
|
2024-03-10 07:46:40 +01:00
|
|
|
ref: v3.4.12
|
2021-11-22 08:52:18 -05:00
|
|
|
- name: Install astyle
|
|
|
|
run: |
|
2023-11-10 15:37:23 +01:00
|
|
|
cd astyle/build/gcc/
|
|
|
|
make
|
|
|
|
sudo make install
|
|
|
|
astyle --version
|
2021-11-22 08:52:18 -05:00
|
|
|
- name: Format code
|
2021-11-25 03:19:09 +08:00
|
|
|
run: python code-format.py
|
2021-11-22 08:52:18 -05:00
|
|
|
working-directory: scripts
|
|
|
|
- name: Check that repository is clean
|
2021-12-12 21:44:14 -05:00
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
set -o pipefail
|
|
|
|
if ! (git diff --exit-code --color=always | tee /tmp/lvgl_diff.patch); then
|
2022-01-25 04:01:56 -06:00
|
|
|
echo "Please apply the preceding diff to your code or run scripts/code-format.py"
|
2021-12-12 21:44:14 -05:00
|
|
|
exit 1
|
|
|
|
fi
|