Skip to content

Commit

Permalink
[ci] adds clang-format action (#833)
Browse files Browse the repository at this point in the history
This patch adds an action that runs clang-format on pushes to main and
when opening pull requests. The action runs `clang-format` with version
`18.1.8` on the `src/` and `test/` folders. If the pushed code contains
ill-formatted code, the actions displays the diff.

Also adds the required steps in order to install clang-format-18 in the
Dockerfile.
  • Loading branch information
philipportner committed Oct 1, 2024
1 parent 39e98e5 commit 32d4204
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/clang-format-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: check-clang-format

on:
push:
branches:
- main
pull_request:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: DoozyX/[email protected]
with:
source: 'src test'
exclude: './third_party ./external'
extensions: 'h,cpp'
clangFormatVersion: 18.1.3
3 changes: 2 additions & 1 deletion containers/daphne-dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ RUN apt-get -qq -y update && apt-get -y upgrade && apt-get -y --no-install-recom
build-essential clang gfortran lld llvm llvm-18-tools ninja-build openjdk-11-jdk-headless pkg-config python3-numpy python3-pandas \
vim nano rsync sudo iputils-ping virtualenv openssh-server iproute2 git htop gdb lldb lld gpg-agent net-tools \
software-properties-common ca-certificates file unzip wget tar zstd \
ccache python3-pip python3-networkx python3-dev graphviz-dev \
ccache python3-pip python3-networkx python3-dev graphviz-dev clang-format \
&& apt-get clean && rm -rf /var/lib/apt/lists/*

COPY --from=daphneeu/daphne-deps /usr/local/bin/ /usr/local/bin/
COPY --from=daphneeu/daphne-deps /usr/local/include/ /usr/local/include/
COPY --from=daphneeu/daphne-deps /usr/local/lib/ /usr/local/lib/
Expand Down

0 comments on commit 32d4204

Please sign in to comment.