mirror of
https://github.com/bkaradzic/bgfx.cmake.git
synced 2026-02-17 21:12:35 +01:00
Add cmake-format config
Improve formatting. Use Tabs. Make copyright one whole comment block. Remove spaces inside of functions and after if. Remove excessive whitespace. Add github action to validate formatting.
This commit is contained in:
55
.github/workflows/format.yml
vendored
Normal file
55
.github/workflows/format.yml
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# https://github.com/openblack/bgfx.cmake/blob/master/.github/workflows/format.yml
|
||||
name: Format
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
pull_request_target:
|
||||
branches: [ master ]
|
||||
|
||||
jobs:
|
||||
job:
|
||||
cmake-format-check:
|
||||
name: cmake-format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
- name: Add base repo to git config
|
||||
run: git remote add upstream ${{ github.event.pull_request.base.repo.html_url }}
|
||||
if: startsWith(github.event_name, 'pull_request')
|
||||
- name: Format CMake files
|
||||
id: cmake-format
|
||||
uses: PuneetMatharu/cmake-format-lint-action@main
|
||||
with:
|
||||
args: --config-files .cmake-format.py --check
|
||||
# Run only if a PR and cmake-format has failed
|
||||
cmake-format-action-suggester:
|
||||
name: cmake-format fix suggester
|
||||
runs-on: ubuntu-latest
|
||||
needs: cmake-format-check
|
||||
if: always() && startsWith(github.event_name, 'pull_request') && needs.cmake-format-check.result == 'failure'
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
repository: ${{ github.event.pull_request.head.repo.full_name }}
|
||||
- name: Add base repo to git config
|
||||
run: git remote add upstream ${{ github.event.pull_request.base.repo.html_url }}
|
||||
if: startsWith(github.event_name, 'pull_request')
|
||||
- name: Format CMake files
|
||||
id: cmake-format
|
||||
uses: PuneetMatharu/cmake-format-lint-action@v1.0.0
|
||||
with:
|
||||
args: --config-files .cmake-format.py --in-place
|
||||
- run: |
|
||||
git diff > cmake-format.patch
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: formatting-fix-${{github.sha}}
|
||||
path: cmake-format.patch
|
||||
- uses: reviewdog/action-suggester@v1
|
||||
with:
|
||||
tool_name: cmake-format
|
||||
Reference in New Issue
Block a user