From de27350224261c70b9db113938a5ed6b57b0b81f Mon Sep 17 00:00:00 2001 From: muxator Date: Fri, 29 Sep 2023 14:03:33 +0200 Subject: [PATCH] docker: check code formatting before building the images --- .dockerignore | 2 ++ Dockerfile.fedora38 | 3 +++ Dockerfile.ubuntu22.04 | 7 +++++++ 3 files changed, 12 insertions(+) diff --git a/.dockerignore b/.dockerignore index 241dd5b..2ae211d 100644 --- a/.dockerignore +++ b/.dockerignore @@ -22,10 +22,12 @@ # is explicitly mentioned in the Dockerfile) or will not grab it (if the # file is indirectly referenced through a wildcard). +!/.clang-format !/cmake !/CMakeLists.txt !/engine !/infra +!/Makefile !/README.md !/scripts !/specs diff --git a/Dockerfile.fedora38 b/Dockerfile.fedora38 index 3d05df1..850415c 100644 --- a/Dockerfile.fedora38 +++ b/Dockerfile.fedora38 @@ -7,6 +7,7 @@ FROM fedora:38 RUN dnf install -y \ autoconf \ automake \ + clang-tools-extra \ cmake \ g++ \ gcc \ @@ -48,6 +49,8 @@ WORKDIR /itcoin-fbft COPY . /itcoin-fbft +RUN make check-code-formatting + RUN mkdir /itcoin-fbft/build WORKDIR /itcoin-fbft/build diff --git a/Dockerfile.ubuntu22.04 b/Dockerfile.ubuntu22.04 index 87de3eb..37369e4 100644 --- a/Dockerfile.ubuntu22.04 +++ b/Dockerfile.ubuntu22.04 @@ -9,6 +9,7 @@ RUN apt update && apt install --no-install-recommends -y \ automake \ bsdextrautils \ ca-certificates \ + clang-format-15 \ cmake \ g++ \ gcc \ @@ -38,12 +39,18 @@ RUN apt install --no-install-recommends -y \ libzmq3-dev \ swi-prolog +# link clang-format-15 as clang-format +RUN update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-15 10 && \ + update-alternatives --set clang-format /usr/bin/clang-format-15 + RUN mkdir /itcoin-fbft WORKDIR /itcoin-fbft COPY . /itcoin-fbft +RUN make check-code-formatting + RUN mkdir /itcoin-fbft/build WORKDIR /itcoin-fbft/build