mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Add a github action and config file for running CMake-format (#6849)
* Add a github action and config file for running CMake-format
This commit is contained in:
parent
514cca5f95
commit
3cd3b319d4
28
.github/workflows/cmake-format.yml
vendored
Normal file
28
.github/workflows/cmake-format.yml
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
name: cmake-format
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
cmake-format-job:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Install cmakelang for cmake-format
|
||||||
|
run: |
|
||||||
|
python3 -m pip install --user cmakelang
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
- name: Check format - ApplicationCode
|
||||||
|
run: |
|
||||||
|
cd ApplicationCode
|
||||||
|
find -name CMake*.txt | xargs ~/.local/bin/cmake-format -c ${{ github.workspace }}/cmake/cmake-format.py -i
|
||||||
|
git diff
|
||||||
|
- name: Check format - AppFwk
|
||||||
|
run: |
|
||||||
|
cd Fwk/AppFwk
|
||||||
|
find -name CMake*.txt | xargs ~/.local/bin/cmake-format -c ${{ github.workspace }}/cmake/cmake-format.py -i
|
||||||
|
git diff
|
||||||
|
- uses: peter-evans/create-pull-request@v2
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
commit-message: 'Fixes by cmake-format'
|
||||||
|
title: 'Fixes by cmake-format'
|
||||||
|
branch: cmake-format-patches
|
20
cmake/cmake-format.py
Normal file
20
cmake/cmake-format.py
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
# -----------------------------
|
||||||
|
# Options effecting formatting.
|
||||||
|
# See: https://github.com/cheshirekow/cmake_format
|
||||||
|
# -----------------------------
|
||||||
|
with section("format"):
|
||||||
|
# How wide to allow formatted cmake files
|
||||||
|
line_width = 80
|
||||||
|
|
||||||
|
# How many spaces to tab for indent
|
||||||
|
tab_size = 2
|
||||||
|
|
||||||
|
# If true, separate flow control names from their parentheses with a space
|
||||||
|
separate_ctrl_name_with_space = False
|
||||||
|
|
||||||
|
# If true, separate function names from parentheses with a space
|
||||||
|
separate_fn_name_with_space = False
|
||||||
|
|
||||||
|
# If a statement is wrapped to more than one line, than dangle the closing
|
||||||
|
# parenthesis on its own line.
|
||||||
|
dangle_parens = False
|
Loading…
Reference in New Issue
Block a user