cmake formatting #322
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Formatting | |
on: | |
workflow_dispatch: | |
push: | |
branches: [develop] | |
pull_request: | |
jobs: | |
clang-format: | |
runs-on: [ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qq clang-format colordiff | |
- name: Run clang-format | |
run: | | |
clang-format --version | |
base_hash="${{ github.event.pull_request.base.sha }}" | |
# if base is not provided, do whole source formatting | |
if [ "$base_hash" == "" ]; then | |
base_hash=$(git rev-list --max-parents=0 HEAD) | |
fi | |
./clang-format-all.sh "$base_hash" | |
cmake-format: | |
runs-on: [ubuntu-22.04] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qq cmake-format | |
- name: Run cmake-format | |
run: | | |
cmake-format --version | |
cmake-format --check $(find ${{github.workspace}} -name CMakeLists.txt) | |
code=$? | |
if [[ $code == 0 ]]; then | |
exit 0 | |
fi | |
# show why the formatting changes, for some reason local formatting not always match repo formatting | |
cmake-format -i $(find ${{github.workspace}} -name CMakeLists.txt) | |
git diff | |
exit 1 | |
clang-tidy: | |
if: false # skip job until it's properly setup to be runnable locally | |
runs-on: [ubuntu-22.04] # Change to ubuntu-latest when that changes over | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -qq gnuradio-dev python3-packaging libusb-1.0-0-dev libwxgtk3.2-dev libsoapysdr-dev clang-tidy | |
- name: Run clang-tidy (everything but GTest tests) | |
run: | | |
cmake -B build -S . -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ | |
for file in $(find plugins/gr-limesdr/python/bindings -name "*.cc"); do echo "" > "$file"; done # Fail due to missing headers which get generated when compiling; replacing instead of deleting because missing files error out | |
run-clang-tidy -warnings-as-errors '*' -p build/ -j $(nproc) | |
- name: Run clang-tidy (only library and GTest tests) | |
run: | | |
cmake -B build -S . -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DBUILD_SHARED_LIBS=0 -DENABLE_HEADERS=0 -DENABLE_USB_FTDI=0 -DENABLE_USB_FX3=0 -DENABLE_LITE_PCIE=0 -DENABLE_CLI=0 -DENABLE_GUI=0 -DENABLE_AMARISOFT_PLUGIN=0 -DENABLE_SOAPYSDR=0 -DENABLE_EXAMPLES=0 -DENABLE_UDEV_RULES=0 | |
run-clang-tidy -warnings-as-errors '*' -p build/ -j $(nproc) |