Hi,

I attached the second version of the patch.

On Mon, 11 Sept 2023 at 15:11, Daniel Gustafsson <dan...@yesql.se> wrote:
>
> > On 11 Sep 2023, at 13:03, Nazir Bilal Yavuz <byavu...@gmail.com> wrote:
>
> >> Almost, but not entirely.  There are a set of scripts which generate 
> >> content
> >> for the docs based on files in src/, like 
> >> src/backend/catalog/sql_features.txt
> >> and src/include/parser/kwlist.h.  If those source files change, or their
> >> scripts, it would be helpful to build docs.
> >
> > Thanks! Are these the only files that are not in the doc subfolders
> > but effect docs?
>
> I believe so, the list of scripts and input files can be teased out of the
> doc/src/sgml/meson.build file.

Now the files mentioned in the doc/src/sgml/meson.build file will
trigger building the docs task. Also, if the changes are only in the
README files, CI will be skipped completely.

Any kind of feedback would be appreciated.

Regards,
Nazir Bilal Yavuz
Microsoft
From 843d0c132c0f95dfee50eaaf667a92fffe400eeb Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavu...@gmail.com>
Date: Mon, 11 Sep 2023 13:29:33 +0300
Subject: [PATCH v2 2/2] Skip CI if changes are only in docs or in the READMEs

When changes are only in docs or in the READMEs, skip all the tasks.

This skip is overriden in 'SanityCheck' and 'Build the Docs' tasks. So,
these two tasks might have not been skipped.
---
 .cirrus.tasks.yml | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index d7c45224af9..ec6bcd5af70 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -3,6 +3,11 @@
 # For instructions on how to enable the CI integration in a repository and
 # further details, see src/tools/ci/README
 
+# When changes are only in docs or in the READMEs, skip all the tasks.
+#
+# This skip is overriden in 'SanityCheck' and 'Build the Docs' tasks. So,
+# these two tasks might have not been skipped.
+skip: changesIncludeOnly('doc/**', '**/README')
 
 env:
   # The lower depth accelerates git clone. Use a bit of depth so that
@@ -54,12 +59,12 @@ on_failure_meson: &on_failure_meson
 # broken commits, have a minimal task that all others depend on.
 task:
   name: SanityCheck
-
-  # If a specific OS is requested, don't run the sanity check. This shortens
+  # If a specific OS is requested or if there are changes only in the docs
+  # or in the READMEs, don't run the sanity check. This shortens
   # push-wait-for-ci cycle time a bit when debugging operating system specific
   # failures. Uses skip instead of only_if, as cirrus otherwise warns about
   # only_if conditions not matching.
-  skip: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*'
+  skip: $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*' || changesIncludeOnly('doc/**', '**/README')
 
   env:
     CPUS: 4
-- 
2.40.1

From 31fcd0c5b588e9c4ef968e7a92489cfb86740228 Mon Sep 17 00:00:00 2001
From: Nazir Bilal Yavuz <byavu...@gmail.com>
Date: Thu, 7 Sep 2023 17:58:06 +0300
Subject: [PATCH v2 1/2] Only built the docs if there are changes are in the
 docs

Building the docs triggered although there are no changes in the docs.
So, the new 'Building the Docs' task is created. This task only
run if a specific OS is not requested and if there are changes in docs
or in the CI files.
---
 .cirrus.tasks.yml | 77 ++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 62 insertions(+), 15 deletions(-)

diff --git a/.cirrus.tasks.yml b/.cirrus.tasks.yml
index e137769850d..d7c45224af9 100644
--- a/.cirrus.tasks.yml
+++ b/.cirrus.tasks.yml
@@ -740,21 +740,6 @@ task:
       make -s -j${BUILD_JOBS} clean
       time make -s -j${BUILD_JOBS} world-bin
 
-  ###
-  # Verify docs can be built
-  ###
-  # XXX: Only do this if there have been changes in doc/ since last build
-  always:
-    docs_build_script: |
-      time ./configure \
-        --cache gcc.cache \
-        CC="ccache gcc" \
-        CXX="ccache g++" \
-        CLANG="ccache clang"
-      make -s -j${BUILD_JOBS} clean
-      time make -s -j${BUILD_JOBS} -C doc
-
-  ###
   # Verify headerscheck / cpluspluscheck succeed
   #
   # - Don't use ccache, the files are uncacheable, polluting ccache's
@@ -777,3 +762,65 @@ task:
 
   always:
     upload_caches: ccache
+
+
+task:
+  name: Build the Docs
+  depends_on: SanityCheck
+  # Only run if a specific OS is not requested and if there are changes in docs
+  # or in the CI files.
+  skip: >
+    $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:.*' ||
+    !changesInclude('doc/**',
+                    '.cirrus.yml',
+                    '.cirrus.tasks.yml',
+                    'src/backend/catalog/sql_feature_packages.txt',
+                    'src/backend/catalog/sql_features.txt',
+                    'src/backend/utils/errcodes.txt',
+                    'src/backend/utils/activity/wait_event_names.txt',
+                    'src/backend/utils/activity/generate-wait_event_types.pl',
+                    'src/include/parser/kwlist.h')
+
+  env:
+    CPUS: 4
+    BUILD_JOBS: 4
+    IMAGE_FAMILY: pg-ci-bullseye
+    CCACHE_MAXSIZE: "10M"
+    CCACHE_DIR: "/tmp/ccache_dir"
+
+    LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
+    LINUX_MESON_FEATURES: *LINUX_MESON_FEATURES
+
+  <<: *linux_task_template
+
+  sysinfo_script: |
+    id
+    uname -a
+    cat /proc/cmdline
+    ulimit -a -H && ulimit -a -S
+    gcc -v
+    clang -v
+    export
+
+  ccache_cache:
+    folder: $CCACHE_DIR
+
+  setup_additional_packages_script: |
+    #apt-get update
+    #DEBIAN_FRONTEND=noninteractive apt-get -y install ...
+
+  setup_script: echo "COPT=-Werror" > src/Makefile.custom
+
+  # Verify docs can be built
+  always:
+    docs_build_script: |
+      time ./configure \
+        --cache gcc.cache \
+        CC="ccache gcc" \
+        CXX="ccache g++" \
+        CLANG="ccache clang"
+      make -s -j${BUILD_JOBS} clean
+      time make -s -j${BUILD_JOBS} -C doc
+
+  always:
+    upload_caches: ccache
-- 
2.40.1

Reply via email to