Skip to content

Commit af94ea0

Browse files
committed
Add pre-commit to clang-format
For now do not rename the image; it makes more sense after rippled have switched to pre-commit
1 parent 7bbc568 commit af94ea0

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

.github/workflows/tools-rippled.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ env:
1010
CONTAINER_REGISTRY: ghcr.io
1111
BUILDKIT_PROGRESS: plain
1212
CLANG_FORMAT_VERSION: 18.1.8
13+
PRE_COMMIT_VERSION: 4.2.0
1314
NONROOT_USER: ci
1415
UBUNTU_VERSION: noble
1516

@@ -74,6 +75,7 @@ jobs:
7475
NONROOT_USER=${{ env.NONROOT_USER }}
7576
UBUNTU_VERSION=${{ env.UBUNTU_VERSION }}
7677
CLANG_FORMAT_VERSION=${{ env.CLANG_FORMAT_VERSION }}
78+
PRE_COMMIT_VERSION=${{ env.PRE_COMMIT_VERSION }}
7779
context: docker/tools-rippled
7880
outputs: type=image,name=${{ env.CONTAINER_IMAGE }},push-by-digest=true,name-canonical=true,push=true
7981
platforms: ${{ matrix.architecture.platform }}

docker/tools-rippled/Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ FROM base AS clang-format
5353

5454
# Install clang-format.
5555
ARG CLANG_FORMAT_VERSION
56-
RUN pipx install --pip-args='--no-cache' clang-format==${CLANG_FORMAT_VERSION}
56+
ARG PRE_COMMIT_VERSION
57+
RUN pipx install --pip-args='--no-cache' clang-format==${CLANG_FORMAT_VERSION} \
58+
pipx install --pip-args='--no-cache' pre-commit==${PRE_COMMIT_VERSION}
5759

5860
# Switch to the non-root user.
5961
USER ${NONROOT_USER}

docker/tools-rippled/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Currently this Dockerfile can be used to build one image:
2929
* `clang-format` with C++ formatting tools. This image requires parameters:
3030
* `UBUNTU_VERSION` for selection of Ubuntu release (recommended `noble`)
3131
* `CLANG_FORMAT_VERSION` for [clang-format](http://clang.llvm.org/docs/ClangFormat.html) version
32+
* `PRE_COMMIT_VERSION` for [pre-commit](https://pre-commit.com/) version
3233

3334
Run the commands below from the current directory containing the Dockerfile to build an image.
3435

@@ -41,13 +42,15 @@ registry.
4142
NONROOT_USER=${USER}
4243
UBUNTU_VERSION=noble
4344
CLANG_FORMAT_VERSION=18.1.8
45+
PRE_COMMIT_VERSION=4.2.0
4446
CONTAINER_IMAGE=xrplf/ci/tools-rippled-clang-format:latest
4547

4648
docker buildx build . \
4749
--target clang-format \
4850
--build-arg BUILDKIT_DOCKERFILE_CHECK=skip=InvalidDefaultArgInFrom \
4951
--build-arg BUILDKIT_INLINE_CACHE=1 \
5052
--build-arg CLANG_FORMAT_VERSION=${CLANG_FORMAT_VERSION} \
53+
--build-arg PRE_COMMIT_VERSION=${PRE_COMMIT_VERSION} \
5154
--build-arg NONROOT_USER=${NONROOT_USER} \
5255
--build-arg UBUNTU_VERSION=${UBUNTU_VERSION} \
5356
--tag ${CONTAINER_REGISTRY}/${CONTAINER_IMAGE}

0 commit comments

Comments
 (0)