This is an automated email from the ASF dual-hosted git repository.

ostinru pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry-pxf.git


The following commit(s) were added to refs/heads/main by this push:
     new da54b042 CI: cache deb and rpm for month (#94)
da54b042 is described below

commit da54b0426ea29f486acbe600c4cddcd938369497
Author: Nikolay Antonov <[email protected]>
AuthorDate: Fri Apr 3 17:06:34 2026 +0500

    CI: cache deb and rpm for month (#94)
    
    **Cache CPU-heavy CI steps:**
    * DEB build
    * RPM build
    
    This should speed up our CI pipelines and reduce github actions quota usage.
    
    **Implementations details:**
    * Github cache has 7 days TTL. Every build will reset expiration timeout. 
In order to force CI to build cloudberry from time to time - I am explicitly 
specifying current month in a cache key.
    * keep both: `actions/cache` and `actions/actions/upload-artifact`. In case 
cache eviction happens during build (e.g. hit 10Gb limit) we will still have 
running builds.
    * cache reused between `main` and other PRs (but not between PRs). So, 
cache will be filled only during builds in `main`.
---
 .github/workflows/pxf-ci.yml | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/.github/workflows/pxf-ci.yml b/.github/workflows/pxf-ci.yml
index ff6fc006..308de960 100644
--- a/.github/workflows/pxf-ci.yml
+++ b/.github/workflows/pxf-ci.yml
@@ -52,7 +52,21 @@ jobs:
       image: apache/incubator-cloudberry:cbdb-build-ubuntu22.04-latest
       options: --user root
     steps:
+    - name: Get month number
+      id: get-month
+      run: echo "month=$(/bin/date -u '+%Y-%m')" >> "$GITHUB_OUTPUT"
+
+    - name: Restore DEB cache
+      id: cache-deb
+      uses: actions/cache/restore@v4
+      with:
+        path: |
+          workspace/cloudberry-deb
+          workspace/cloudberry-source.tar.gz
+        key: cloudberry-deb-${{ runner.os }}-${{ steps.get-month.outputs.month 
}}
+
     - name: Checkout Cloudberry source
+      if: steps.cache-deb.outputs.cache-hit != 'true'
       uses: actions/checkout@v4
       with:
         repository: apache/cloudberry
@@ -61,11 +75,13 @@ jobs:
         submodules: true
 
     - name: Checkout PXF source (for build script)
+      if: steps.cache-deb.outputs.cache-hit != 'true'
       uses: actions/checkout@v4
       with:
         path: cloudberry-pxf
 
     - name: Build Cloudberry DEB
+      if: steps.cache-deb.outputs.cache-hit != 'true'
       run: |
         export WORKSPACE=$PWD/workspace
         export CLOUDBERRY_VERSION=99.0.0
@@ -73,10 +89,21 @@ jobs:
         bash 
cloudberry-pxf/ci/docker/pxf-cbdb-dev/ubuntu/script/build_cloudberry_deb.sh
 
     - name: Package Cloudberry source
+      if: steps.cache-deb.outputs.cache-hit != 'true'
       run: |
         cd workspace
         tar czf cloudberry-source.tar.gz cloudberry/
 
+    - name: Save DEB cache
+      # save cache from default branch only (this cache can be reused between 
PRs)
+      if: steps.cache-deb.outputs.cache-hit != 'true' && github.ref == 
'refs/heads/main'
+      uses: actions/cache/save@v4
+      with:
+        path: |
+          workspace/cloudberry-deb
+          workspace/cloudberry-source.tar.gz
+        key: cloudberry-deb-${{ runner.os }}-${{ steps.get-month.outputs.month 
}}
+
     - name: Upload DEB artifact
       uses: actions/upload-artifact@v4
       with:
@@ -98,7 +125,21 @@ jobs:
       image: apache/incubator-cloudberry:cbdb-build-rocky9-latest
       options: --user root
     steps:
+    - name: Get month number
+      id: get-month
+      run: echo "month=$(/bin/date -u '+%Y-%m')" >> "$GITHUB_OUTPUT"
+
+    - name: Restore RPM cache
+      id: cache-rpm
+      uses: actions/cache/restore@v4
+      with:
+        path: |
+          workspace/cloudberry-rpm
+          workspace/cloudberry-source-rocky9.tar.gz
+        key: cloudberry-rpm-${{ runner.os }}-${{ steps.get-month.outputs.month 
}}
+
     - name: Checkout Cloudberry source
+      if: steps.cache-rpm.outputs.cache-hit != 'true'
       uses: actions/checkout@v4
       with:
         repository: apache/cloudberry
@@ -107,11 +148,13 @@ jobs:
         submodules: true
 
     - name: Checkout PXF source (for build script)
+      if: steps.cache-rpm.outputs.cache-hit != 'true'
       uses: actions/checkout@v4
       with:
         path: cloudberry-pxf
 
     - name: Build Cloudberry RPM
+      if: steps.cache-rpm.outputs.cache-hit != 'true'
       run: |
         export WORKSPACE=$PWD/workspace
         export CLOUDBERRY_VERSION=99.0.0
@@ -119,10 +162,21 @@ jobs:
         bash 
cloudberry-pxf/ci/docker/pxf-cbdb-dev/rocky9/script/build_cloudberry_rpm.sh
 
     - name: Package Cloudberry source
+      if: steps.cache-rpm.outputs.cache-hit != 'true'
       run: |
         cd workspace
         tar czf cloudberry-source-rocky9.tar.gz cloudberry/
 
+    - name: Save RPM cache
+      # save cache from default branch only (this cache can be reused between 
PRs)
+      if: steps.cache-rpm.outputs.cache-hit != 'true' && github.ref == 
'refs/heads/main'
+      uses: actions/cache/save@v4
+      with:
+        path: |
+          workspace/cloudberry-rpm
+          workspace/cloudberry-source-rocky9.tar.gz
+        key: cloudberry-rpm-${{ runner.os }}-${{ steps.get-month.outputs.month 
}}
+
     - name: Upload RPM artifact
       uses: actions/upload-artifact@v4
       with:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to