2021-10-18 07:24:54 +02:00
|
|
|
# Syntax reference https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
|
|
|
|
# Environment reference https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
|
|
|
|
name: format
|
|
|
|
|
2023-09-01 18:52:20 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- 'main'
|
|
|
|
- 'releases/**'
|
|
|
|
tags:
|
|
|
|
- '2.*'
|
|
|
|
pull_request:
|
2021-10-18 07:24:54 +02:00
|
|
|
|
2022-08-26 23:25:07 +02:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2021-10-18 07:24:54 +02:00
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
|
2022-05-31 19:55:57 +02:00
|
|
|
runs-on: ubuntu-22.04
|
2021-10-18 07:24:54 +02:00
|
|
|
|
|
|
|
steps:
|
2022-10-11 19:50:59 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-10-18 07:24:54 +02:00
|
|
|
|
|
|
|
- name: Cache uncrustify
|
2022-10-11 19:50:59 +02:00
|
|
|
uses: actions/cache@v3
|
2021-10-18 07:24:54 +02:00
|
|
|
id: cache-uncrustify
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/uncrustify
|
|
|
|
key: ${{ runner.os }}-uncrustify
|
|
|
|
|
|
|
|
- name: build uncrustify
|
|
|
|
if: steps.cache-uncrustify.outputs.cache-hit != 'true'
|
|
|
|
run: |
|
|
|
|
wget https://github.com/uncrustify/uncrustify/archive/refs/tags/uncrustify-0.72.0.tar.gz
|
|
|
|
tar xzvf uncrustify-0.72.0.tar.gz && cd uncrustify-uncrustify-0.72.0
|
2022-09-04 10:27:20 +02:00
|
|
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
|
|
|
cmake --build build -- -j$(nproc) -s
|
2021-10-18 07:24:54 +02:00
|
|
|
mkdir ~/uncrustify
|
2022-09-04 10:27:20 +02:00
|
|
|
cd build && cp uncrustify ~/uncrustify/
|
2021-10-18 07:24:54 +02:00
|
|
|
|
|
|
|
- name: Uncrustify check
|
|
|
|
run: |
|
2022-05-04 21:14:43 +02:00
|
|
|
~/uncrustify/uncrustify -c .uncrustify.cfg -l CPP --no-backup --replace */*.cpp */*.h
|
|
|
|
git diff
|
|
|
|
git diff | diff - /dev/null &> /dev/null
|