clang format #13
This file contains hidden or 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
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| name: lint | |
| permissions: read-all | |
| jobs: | |
| format-check: | |
| runs-on: ubuntu-latest | |
| name: clang-format | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Install clang-format | |
| run: | | |
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc | |
| sudo add-apt-repository "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format-21 | |
| - name: Check formatting | |
| run: clang-format-21 --dry-run -Werror src/*.cpp src/*.h | |
| # clang-tidy: | |
| # runs-on: ubuntu-latest | |
| # name: clang-tidy | |
| # steps: | |
| # - uses: actions/checkout@v6 | |
| # - name: Install system dependencies | |
| # run: | | |
| # sudo apt-get update | |
| # sudo apt-get install -y clang-tidy libpng-dev zlib1g-dev libcairo2-dev libtiff-dev | |
| # - uses: r-lib/actions/setup-r@v2 | |
| # with: | |
| # r-version: release | |
| # - name: Install R package dependencies | |
| # run: Rscript -e 'install.packages(c("cpp11", "systemfonts"), repos = "https://cloud.r-project.org")' | |
| # - name: Resolve include paths | |
| # id: includes | |
| # run: | | |
| # R_INCLUDE=$(Rscript -e 'cat(R.home("include"))') | |
| # CPP11_INCLUDE=$(Rscript -e 'cat(system.file("include", package = "cpp11"))') | |
| # SYSFONTS_INCLUDE=$(Rscript -e 'cat(system.file("include", package = "systemfonts"))') | |
| # echo "r_include=$R_INCLUDE" >> "$GITHUB_OUTPUT" | |
| # echo "cpp11_include=$CPP11_INCLUDE" >> "$GITHUB_OUTPUT" | |
| # echo "sysfonts_include=$SYSFONTS_INCLUDE" >> "$GITHUB_OUTPUT" | |
| # - name: Run clang-tidy | |
| # run: | | |
| # clang-tidy src/*.cpp \ | |
| # --extra-arg=-std=c++14 \ | |
| # --extra-arg=-DFMT_HEADER_ONLY \ | |
| # --extra-arg=-Isrc/lib \ | |
| # --extra-arg=-Iinst/include \ | |
| # --extra-arg=-I${{ steps.includes.outputs.r_include }} \ | |
| # --extra-arg=-I${{ steps.includes.outputs.cpp11_include }} \ | |
| # --extra-arg=-I${{ steps.includes.outputs.sysfonts_include }} \ | |
| # --warnings-as-errors='*' |