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

pengzheng pushed a commit to branch feature/614-github-cache-build-deps
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to 
refs/heads/feature/614-github-cache-build-deps by this push:
     new acc4ba6a Add Conan and ccache cache to coverage and macos-build.
acc4ba6a is described below

commit acc4ba6a5ef5bcb41f26cb375c9f50841dc61daf
Author: PengZheng <howto...@gmail.com>
AuthorDate: Wed Aug 30 22:15:54 2023 +0800

    Add Conan and ccache cache to coverage and macos-build.
---
 .github/workflows/conan_create.yml |  2 +-
 .github/workflows/coverage.yml     | 30 +++++++++++++++++++++++++
 .github/workflows/macos.yml        | 46 +++++++++++++++++++++++++++++++++++++-
 3 files changed, 76 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/conan_create.yml 
b/.github/workflows/conan_create.yml
index 93a1612a..d0786b52 100644
--- a/.github/workflows/conan_create.yml
+++ b/.github/workflows/conan_create.yml
@@ -91,7 +91,7 @@ jobs:
         run: |
           conan profile new default --detect
           conan profile update settings.build_type=Release default
-      - name: Using the builtin GitHub Cache Action for .conan
+      - name: Conan Cache
         id: cache-conan
         uses: actions/cache@v1
         env:
diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml
index 6d4e85d8..4052dbd6 100644
--- a/.github/workflows/coverage.yml
+++ b/.github/workflows/coverage.yml
@@ -2,6 +2,13 @@ name: Celix Coverage
 
 on: [push, pull_request]
 
+env:
+  CONAN_USER_HOME: "${{ github.workspace }}/release/"
+  CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"
+  CONAN_HOME: "${{ github.workspace }}/release/"
+  CCACHE_DIR: "${{ github.workspace }}/.ccache"
+  CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime
+
 jobs:
   coverage:
     runs-on: ubuntu-20.04
@@ -19,6 +26,28 @@ jobs:
           conan profile update settings.build_type=Debug default
           #Note no backwards compatiblity for gcc5 needed, setting libcxx to 
c++11.
           conan profile update settings.compiler.libcxx=libstdc++11 default
+      - name: Conan Cache
+        id: cache-conan
+        uses: actions/cache@v1
+        env:
+          cache-name: cache-conan2-modules
+        with:
+          path: ${{ env.CONAN_HOME }}
+          key: ${{ runner.os }}-gcov-builder-${{ env.cache-name }}-${{ 
hashFiles('conanfile.py') }}
+          restore-keys: ${{ runner.os }}-gcov-builder-${{ env.cache-name }}-
+      - name: Prepare ccache timestamp
+        id: ccache_cache_timestamp
+        shell: cmake -P {0} >> $GITHUB_OUTPUT
+        run: |
+          string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
+          message("timestamp=${current_date}")
+      - name: ccache Cache
+        uses: actions/cache@v1
+        with:
+          path: ${{ env.CCACHE_DIR }}
+          key: ${{ runner.os }}-gcov-ccache-${{ 
steps.ccache_cache_timestamp.outputs.timestamp }}
+          restore-keys: |
+            ${{ runner.os }}-gcov-ccache-
       - name: Install Dependencies
         env:
           CONAN_BUILD_OPTIONS: |
@@ -28,6 +57,7 @@ jobs:
             -o celix:enable_testing_for_cxx14=True
             -o celix:enable_testing_dependency_manager_for_cxx11=True
             -o celix:enable_testing_on_ci=True
+            -o celix:enable_ccache=True
         run: |
           #force require libcurl 7.64.1, due to a sha256 verify issue in 
libcurl/7.87.0
           conan install . celix/ci -pr:b default -pr:h default -if build 
${CONAN_BUILD_OPTIONS} -b missing -b cpputest --require-override=libcurl/7.64.1 
--require-override=openssl/1.1.1s
diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml
index d20ac490..93466f63 100644
--- a/.github/workflows/macos.yml
+++ b/.github/workflows/macos.yml
@@ -6,6 +6,13 @@ on:
   schedule:
     - cron:  '0 0 * * *'
 
+env:
+  CONAN_USER_HOME: "${{ github.workspace }}/release/"
+  CONAN_USER_HOME_SHORT: "${{ github.workspace }}/release/short"
+  CONAN_HOME: "${{ github.workspace }}/release/"
+  CCACHE_DIR: "${{ github.workspace }}/.ccache"
+  CCACHE_SLOPPINESS: include_file_ctime,include_file_mtime
+
 jobs:
 
   macos-build-conan:
@@ -22,6 +29,28 @@ jobs:
         run: |
           conan profile new default --detect
           conan profile update settings.build_type=Release default
+      - name: Conan Cache
+        id: cache-conan
+        uses: actions/cache@v1
+        env:
+          cache-name: cache-conan-modules
+        with:
+          path: ${{ env.CONAN_USER_HOME }}
+          key: ${{ runner.os }}-test-builder-${{ env.cache-name }}-${{ 
hashFiles('conanfile.py') }}
+          restore-keys: ${{ runner.os }}-test-builder-${{ env.cache-name }}-
+      - name: Prepare ccache timestamp
+        id: ccache_cache_timestamp
+        shell: cmake -P {0} >> $GITHUB_OUTPUT
+        run: |
+          string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
+          message("timestamp=${current_date}")
+      - name: ccache Cache
+        uses: actions/cache@v1
+        with:
+          path: ${{ env.CCACHE_DIR }}
+          key: ${{ runner.os }}-test-ccache-Release-${{ 
steps.ccache_cache_timestamp.outputs.timestamp }}
+          restore-keys: |
+            ${{ runner.os }}-test-ccache-Release-
       - name: Install Dependencies
         env:
           CONAN_BUILD_OPTIONS: |
@@ -33,6 +62,7 @@ jobs:
             -o celix:enable_cmake_warning_tests=True
             -o celix:enable_testing_on_ci=True
             -o celix:framework_curlinit=False
+            -o celix:enable_ccache=True
         run: |
           #force require libcurl 7.64.1, due to a sha256 verify issue in 
libcurl/7.87.0
           conan install . celix/ci -c 
tools.cmake.cmaketoolchain:generator=Ninja -pr:b default -pr:h default -if 
build ${CONAN_BUILD_OPTIONS} -b missing -b cpputest 
--require-override=libcurl/7.64.1 --require-override=openssl/1.1.1s
@@ -56,7 +86,20 @@ jobs:
       - name: Install dependencies
         run: |
           brew update
-          brew install lcov zeromq czmq cpputest jansson rapidjson libzip
+          brew install lcov zeromq czmq cpputest jansson rapidjson libzip 
ccache
+      - name: Prepare ccache timestamp
+        id: ccache_cache_timestamp
+        shell: cmake -P {0} >> $GITHUB_OUTPUT
+        run: |
+          string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
+          message("timestamp=${current_date}")
+      - name: ccache Cache
+        uses: actions/cache@v1
+        with:
+          path: ${{ env.CCACHE_DIR }}
+          key: ${{ runner.os }}-brew-test-ccache-Release-${{ 
steps.ccache_cache_timestamp.outputs.timestamp }}
+          restore-keys: |
+            ${{ runner.os }}-brew-test-ccache-Release-
       - name: Build
         env:
           BUILD_OPTIONS: |
@@ -66,6 +109,7 @@ jobs:
             -DENABLE_ADDRESS_SANITIZER=ON
             -DENABLE_TESTING_ON_CI=ON
             -DCMAKE_BUILD_TYPE=Release
+            -DENABLE_CCACHE=ON
         run: |
           mkdir build install
           cd build

Reply via email to