Browse Source

CI - use ccache for macOS/Makefile build config.

Yao Wei Tjong 姚伟忠 5 years ago
parent
commit
2260d93c57
1 changed files with 20 additions and 1 deletions
  1. 20 1
      .github/workflows/main.yml

+ 20 - 1
.github/workflows/main.yml

@@ -168,10 +168,29 @@ jobs:
         uses: actions/checkout@v2
         uses: actions/checkout@v2
         with: { fetch-depth: 0 }
         with: { fetch-depth: 0 }
       - name: Install dependencies
       - name: Install dependencies
-        run: while ! brew install doxygen graphviz; do sleep 1; done
+        run: |
+          while ! brew install doxygen graphviz; do sleep 1; done
+          if [[ $PLATFORM == macOS-make ]]; then
+            while ! brew install ccache; do sleep 1; done
+            brew info ccache |grep -o '\S*lib\S*' >>$GITHUB_PATH
+            echo USE_CCACHE=1 >>$GITHUB_ENV
+          fi
       - name: Install headers
       - name: Install headers
         run: sudo cp -rp $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/* /usr/local/include
         run: sudo cp -rp $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/* /usr/local/include
         if: matrix.platform == 'macOS-make'
         if: matrix.platform == 'macOS-make'
+      - name: Source checksum
+        id: source_checksum
+        run: rake source_checksum
+        if: matrix.platform == 'macOS-make'
+      - name: Cache
+        uses: actions/cache@v2
+        with:
+          path: ~/.ccache
+          key: |
+            ${{ matrix.platform }}-${{ matrix.lib-type }}-${{ steps.source_checksum.outputs.hexdigest }}
+          restore-keys: |
+            ${{ matrix.platform }}-${{ matrix.lib-type }}
+        if: matrix.platform == 'macOS-make'
       - name: CMake
       - name: CMake
         run: rake cmake
         run: rake cmake
       - name: Build
       - name: Build