Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ jobs:
pip3 install --user black
black --version
gcc --version
git clone -b v0.8.31 --depth 1 https://github.com/citusdata/tools.git ../tools
sudo make -C ../tools install
install_uncrustify
rm -rf uncrustify*
# Install uncrustify the Citus way
make -C ci -f tools.mk tools

- name: Check code formatting and banned function
if: ${{ env.TEST == 'linting' }}
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ endif
.PHONY: indent
indent:
citus_indent
black .
black --exclude=ci/tools .

# make lint; is an alias for make spellcheck
# make linting; is an alias for make spellcheck
Expand All @@ -203,7 +203,7 @@ lint linting: spellcheck ;
.PHONY: spellcheck
spellcheck:
citus_indent --check
black --check .
black --exclude=ci/tools --check .
ci/banned.h.sh

#
Expand Down
20 changes: 20 additions & 0 deletions ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM debian:bullseye-slim

RUN apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
build-essential \
ca-certificates \
curl \
git \
gawk \
make \
cmake \
python3 \
sudo \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /usr/src/pg_auto_failover/ci
COPY tools.mk ./

WORKDIR /usr/src/pg_auto_failover
RUN make -C ci -f tools.mk tools
27 changes: 27 additions & 0 deletions ci/tools.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#
# Install CI tools, mostly Citus style checker and linter for C code.
#
# See https://github.com/citusdata/citus/blob/main/STYLEGUIDE.md
#

CITUS_TOOLS = https://github.com/citusdata/tools.git
UNCRUSTIFY = https://github.com/uncrustify/uncrustify/archive/uncrustify-0.68.1.tar.gz
UNCRUSTIFY_DIR = uncrustify-uncrustify-0.68.1

CMAKE_OPTS = -DCMAKE_POLICY_VERSION_MINIMUM=3.5

tools: citus-tools ;

mkdir:
mkdir tools

uncrustify: mkdir
curl -L $(UNCRUSTIFY) | tar -C tools -xz
mkdir tools/$(UNCRUSTIFY_DIR)/build
cd tools/$(UNCRUSTIFY_DIR)/build && cmake $(CMAKE_OPTS) ..
make -C tools/$(UNCRUSTIFY_DIR)/build -j5
sudo make -C tools/$(UNCRUSTIFY_DIR)/build install

citus-tools: uncrustify
git clone --depth 1 $(CITUS_TOOLS) tools/tools
sudo make -C tools/tools uncrustify/.install