From cc31e82fdd4c1b6b1b2eb8961aaaeb4bdb341972 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 13:29:39 +0200 Subject: [PATCH 01/11] Update run-tests.yml citus tools version --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a40c5b280..3d423ec2c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -52,7 +52,7 @@ jobs: pip3 install --user black black --version gcc --version - git clone -b v0.8.31 --depth 1 https://github.com/citusdata/tools.git ../tools + git clone -b v0.8.32 --depth 1 https://github.com/citusdata/tools.git ../tools sudo make -C ../tools install install_uncrustify rm -rf uncrustify* From 6d87b49b8520df5a44bf529ca263f84b71f6a6b5 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 14:20:17 +0200 Subject: [PATCH 02/11] review install script for uncrustify --- .github/workflows/run-tests.yml | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 3d423ec2c..6dfc861e8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -52,10 +52,19 @@ jobs: pip3 install --user black black --version gcc --version - git clone -b v0.8.32 --depth 1 https://github.com/citusdata/tools.git ../tools - sudo make -C ../tools install - install_uncrustify - rm -rf uncrustify* + # Citus style is picky, uses version 0.68.1 + cd ../tools + curl -L https://github.com/uncrustify/uncrustify/archive/uncrustify-0.68.1.tar.gz | tar xz + cd uncrustify-uncrustify-0.68.1 + mkdir build + cmake -B build .. + make -j5 + sudo make install + cd .. + + git clone --depth 1 https://github.com/citusdata/tools.git ../tools + cd tools + make uncrustify/.install - name: Check code formatting and banned function if: ${{ env.TEST == 'linting' }} @@ -73,6 +82,7 @@ jobs: make build-test-image - name: Run Test + if: false if: ${{ env.TEST != 'linting' }} timeout-minutes: 15 run: | From d7444fbf469d14980925ab697d63810b3059889b Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 14:29:29 +0200 Subject: [PATCH 03/11] fix syntax --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6dfc861e8..4a44de1c0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -83,7 +83,7 @@ jobs: - name: Run Test if: false - if: ${{ env.TEST != 'linting' }} + # if: ${{ env.TEST != 'linting' }} timeout-minutes: 15 run: | make ci-test From f5266f7467e07f0fc111a94d82407edcc3de9846 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:17:48 +0200 Subject: [PATCH 04/11] Review Citus tools install scripts for CI --- .github/workflows/run-tests.yml | 15 ++------------- ci/Dockerfile | 20 ++++++++++++++++++++ ci/tools.mk | 25 +++++++++++++++++++++++++ 3 files changed, 47 insertions(+), 13 deletions(-) create mode 100644 ci/Dockerfile create mode 100644 ci/tools.mk diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 4a44de1c0..e1d6607d9 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -52,19 +52,8 @@ jobs: pip3 install --user black black --version gcc --version - # Citus style is picky, uses version 0.68.1 - cd ../tools - curl -L https://github.com/uncrustify/uncrustify/archive/uncrustify-0.68.1.tar.gz | tar xz - cd uncrustify-uncrustify-0.68.1 - mkdir build - cmake -B build .. - make -j5 - sudo make install - cd .. - - git clone --depth 1 https://github.com/citusdata/tools.git ../tools - cd tools - make uncrustify/.install + # Install uncrustify the Citus way + make -C ci -f tools.mk tools - name: Check code formatting and banned function if: ${{ env.TEST == 'linting' }} diff --git a/ci/Dockerfile b/ci/Dockerfile new file mode 100644 index 000000000..67f445b15 --- /dev/null +++ b/ci/Dockerfile @@ -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 diff --git a/ci/tools.mk b/ci/tools.mk new file mode 100644 index 000000000..7c5b546b3 --- /dev/null +++ b/ci/tools.mk @@ -0,0 +1,25 @@ +# +# 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 + +tools: mkdir uncrustify citus-tools ; + +mkdir: + mkdir tools + +uncrustify: mkdir + curl -L $(UNCRUSTIFY) | tar -C tools -xz + mkdir tools/$(UNCRUSTIFY_DIR)/build + cmake -B tools/$(UNCRUSTIFY_DIR)/build -S tools/$(UNCRUSTIFY_DIR) + make -C tools/$(UNCRUSTIFY_DIR)/build -j5 + sudo make -C tools/$(UNCRUSTIFY_DIR)/build install + +citus-tools: mkdir + git clone --depth 1 $(CITUS_TOOLS) tools/tools + make -C tools/tools uncrustify/.install From 371f2d09eab83c26ddb0982ebe7f3132ebf2c616 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:18:36 +0200 Subject: [PATCH 05/11] de-activate test matrix --- .github/workflows/run-tests.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e1d6607d9..e59dfe6d8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,17 +18,18 @@ jobs: fail-fast: false matrix: PGVERSION: - - 13 + # - 13 - 14 - - 15 - - 16 - - 17 + # - 15 + # - 16 + # - 17 TEST: - - multi - - single - - monitor - - ssl - - citus + # - multi + # - single + # - monitor + # - ssl + # - citus + - linting include: - PGVERSION: 14 TEST: tablespaces @@ -71,8 +72,7 @@ jobs: make build-test-image - name: Run Test - if: false - # if: ${{ env.TEST != 'linting' }} + if: ${{ env.TEST != 'linting' }} timeout-minutes: 15 run: | make ci-test From cba930a41ad90ffc06f66532a80d39999af0a080 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:21:11 +0200 Subject: [PATCH 06/11] -DCMAKE_POLICY_VERSION_MINIMUM=3.5 --- ci/tools.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ci/tools.mk b/ci/tools.mk index 7c5b546b3..35c037429 100644 --- a/ci/tools.mk +++ b/ci/tools.mk @@ -8,6 +8,8 @@ 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: mkdir uncrustify citus-tools ; mkdir: @@ -16,7 +18,7 @@ mkdir: uncrustify: mkdir curl -L $(UNCRUSTIFY) | tar -C tools -xz mkdir tools/$(UNCRUSTIFY_DIR)/build - cmake -B tools/$(UNCRUSTIFY_DIR)/build -S tools/$(UNCRUSTIFY_DIR) + cd tools/$(UNCRUSTIFY_DIR)/build && cmake $(CMAKE_OPTS) .. make -C tools/$(UNCRUSTIFY_DIR)/build -j5 sudo make -C tools/$(UNCRUSTIFY_DIR)/build install From 24b713e48a0fdbd92ef09e4493a75f3ebdbe4c53 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:22:27 +0200 Subject: [PATCH 07/11] sudo make install --- ci/tools.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/tools.mk b/ci/tools.mk index 35c037429..7ad525bae 100644 --- a/ci/tools.mk +++ b/ci/tools.mk @@ -24,4 +24,4 @@ uncrustify: mkdir citus-tools: mkdir git clone --depth 1 $(CITUS_TOOLS) tools/tools - make -C tools/tools uncrustify/.install + sudo make -C tools/tools uncrustify/.install From 418039063efa5d50a70f7415008fc72d28a35b99 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:27:37 +0200 Subject: [PATCH 08/11] Exclude ci/tools from black indentation rules --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index c23abed8b..7350ca429 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -203,7 +203,7 @@ lint linting: spellcheck ; .PHONY: spellcheck spellcheck: citus_indent --check - black --check . + black --exclude=ci/tools --check . ci/banned.h.sh # From 37b2ca623e7b4916a6b1d2a309d010032ef614f7 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:31:10 +0200 Subject: [PATCH 09/11] Re-install all the unit testing --- .github/workflows/run-tests.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index e59dfe6d8..a3fdd680f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -18,17 +18,17 @@ jobs: fail-fast: false matrix: PGVERSION: - # - 13 + - 13 - 14 - # - 15 - # - 16 - # - 17 + - 15 + - 16 + - 17 TEST: - # - multi - # - single - # - monitor - # - ssl - # - citus + - multi + - single + - monitor + - ssl + - citus - linting include: - PGVERSION: 14 From 487aa75b417faff31276820a0d42124c2939c6aa Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:34:06 +0200 Subject: [PATCH 10/11] Review ci/tools.mk dependencies --- ci/tools.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/tools.mk b/ci/tools.mk index 7ad525bae..d7987d7b1 100644 --- a/ci/tools.mk +++ b/ci/tools.mk @@ -10,7 +10,7 @@ UNCRUSTIFY_DIR = uncrustify-uncrustify-0.68.1 CMAKE_OPTS = -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -tools: mkdir uncrustify citus-tools ; +tools: citus-tools ; mkdir: mkdir tools @@ -22,6 +22,6 @@ uncrustify: mkdir make -C tools/$(UNCRUSTIFY_DIR)/build -j5 sudo make -C tools/$(UNCRUSTIFY_DIR)/build install -citus-tools: mkdir +citus-tools: uncrustify git clone --depth 1 $(CITUS_TOOLS) tools/tools sudo make -C tools/tools uncrustify/.install From 100e0ebb363a8fcd63676840c64eed180a5672f2 Mon Sep 17 00:00:00 2001 From: Dimitri Fontaine Date: Wed, 2 Apr 2025 15:35:52 +0200 Subject: [PATCH 11/11] fix workflow file --- .github/workflows/run-tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index a3fdd680f..d97ad12a6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -29,7 +29,6 @@ jobs: - monitor - ssl - citus - - linting include: - PGVERSION: 14 TEST: tablespaces