Skip to content

Commit

Permalink
Add sccache into build-dev workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
sieniven committed Nov 30, 2023
1 parent 48b016d commit 68ea95a
Showing 1 changed file with 45 additions and 17 deletions.
62 changes: 45 additions & 17 deletions .github/workflows/build-dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 68ea95a

Please sign in to comment.