From 68ea95a017589ca00016211ec158ad7c4443ac51 Mon Sep 17 00:00:00 2001 From: Niven Date: Thu, 30 Nov 2023 11:49:44 +0800 Subject: [PATCH] Add sccache into build-dev workflow --- .github/workflows/build-dev.yaml | 62 +++++++++++++++++++++++--------- 1 file changed, 45 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-dev.yaml b/.github/workflows/build-dev.yaml index 47cffc5de1f..ba049cba213 100644 --- a/.github/workflows/build-dev.yaml +++ b/.github/workflows/build-dev.yaml @@ -33,6 +33,7 @@ jobs: target: [x86_64-pc-linux-gnu, x86_64-w64-mingw32, x86_64-apple-darwin] env: TARGET: ${{matrix.target}} + SCCACHE_GHA_ENABLED: "true" steps: - uses: actions/checkout@v4 @@ -47,15 +48,25 @@ jobs: - name: Setup user dependencies run: ./make.sh ci-setup-user-deps - - name: Restore cpp build cache - id: cpp-cache-restore + - name: Restore depends build cache + id: depends-cache-restore uses: actions/cache/restore@v3 with: - path: | - ./build/depends - ./build/src - ~/.ccache - key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }} + path: ./build/depends + key: depends-${{ env.TARGET }}-${{ env.BUILD_TYPE }} + + # - name: Restore cpp build cache + # id: cpp-cache-restore + # uses: actions/cache/restore@v3 + # with: + # path: | + # ./build/depends + # ./build/src + # ~/.ccache + # key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }} + + - name: Run sccache-cache + uses: mozilla-actions/sccache-action@v0.0.3 - name: Rust build cache uses: Swatinem/rust-cache@v2 @@ -74,24 +85,41 @@ jobs: name: defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }} path: ./build/defichain-${{ env.BUILD_VERSION }}-${{ env.TARGET }}.${{ env.PKG_TYPE }} - - name: Delete previous cpp cache - if: ${{ github.ref == 'refs/heads/master' && steps.cpp-cache-restore.outputs.cache-hit }} + - name: Delete previous depends build cache + if: ${{ steps.cpp-cache-restore.outputs.cache-hit }} + # if: ${{ github.ref == 'refs/heads/master' && steps.cpp-cache-restore.outputs.cache-hit }} continue-on-error: true run: | gh extension install actions/gh-actions-cache - gh actions-cache delete "cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }}" --confirm + gh actions-cache delete "depends-${{ env.TARGET }}-${{ env.BUILD_TYPE }}" --confirm env: GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Save cpp cache - if: ${{ github.ref == 'refs/heads/master' }} + - name: Save depends build cache + # if: ${{ github.ref == 'refs/heads/master' }} uses: actions/cache/save@v3 with: - path: | - ./build/depends - ./build/src - ~/.ccache - key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }} + path: ./build/depends + key: depends-${{ env.TARGET }}-${{ env.BUILD_TYPE }} + + # - name: Delete previous cpp cache + # if: ${{ github.ref == 'refs/heads/master' && steps.cpp-cache-restore.outputs.cache-hit }} + # continue-on-error: true + # run: | + # gh extension install actions/gh-actions-cache + # gh actions-cache delete "cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }}" --confirm + # env: + # GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + # - name: Save cpp build cache + # if: ${{ github.ref == 'refs/heads/master' }} + # uses: actions/cache/save@v3 + # with: + # path: | + # ./build/depends + # ./build/src + # ~/.ccache + # key: cpp-${{ env.TARGET }}-${{ env.BUILD_TYPE }} docker-build: runs-on: ubuntu-latest