From 23ad611566b557f26d268920692b25aa89fc0070 Mon Sep 17 00:00:00 2001 From: LoveSy Date: Thu, 22 Sep 2022 10:10:47 +0800 Subject: [PATCH] Use sccache for rust build --- .github/ccache.sh | 19 ------------------- .github/workflows/build.yml | 19 ++++++++++++++----- 2 files changed, 14 insertions(+), 24 deletions(-) delete mode 100644 .github/ccache.sh diff --git a/.github/ccache.sh b/.github/ccache.sh deleted file mode 100644 index bfbbaba85..000000000 --- a/.github/ccache.sh +++ /dev/null @@ -1,19 +0,0 @@ -OS=$(uname) -CCACHE_VER=4.4 - -case $OS in - Darwin ) - brew install ccache - ln -s $(which ccache) ./ccache - ;; - Linux ) - sudo apt-get install -y ccache - ln -s $(which ccache) ./ccache - ;; - * ) - curl -OL https://github.com/ccache/ccache/releases/download/v${CCACHE_VER}/ccache-${CCACHE_VER}-windows-64.zip - unzip -j ccache-*-windows-64.zip '*/ccache.exe' - ;; -esac -mkdir ./.ccache -./ccache -o compiler_check='%compiler% -dumpmachine; %compiler% -dumpversion' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb3c3dc9d..672785610 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -24,8 +24,10 @@ jobs: matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] env: - NDK_CCACHE: ${{ github.workspace }}/ccache + NDK_CCACHE: ccache CCACHE_DIR: ${{ github.workspace }}/.ccache + CCACHE_COMPILERCHECK: "%compiler% -dumpmachine; %compiler% -dumpversion" + RUSTC_WRAPPER: sccache steps: - name: Check out @@ -45,7 +47,17 @@ jobs: python-version: '3.x' - name: Set up ccache - run: bash .github/ccache.sh + uses: hendrikmuhs/ccache-action@v1.2 + with: + key: ${{ runner.os }}-${{ github.sha }} + restore-keys: ${{ runner.os }} + + - name: Set up sccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + variant: sccache + key: ${{ runner.os }}-${{ github.sha }} + restore-keys: ${{ runner.os }} - name: Cache Gradle dependencies uses: actions/cache@v2 @@ -61,7 +73,6 @@ jobs: uses: actions/cache@v2 with: path: | - ${{ github.workspace }}/.ccache ~/.gradle/caches/build-cache-* key: ${{ runner.os }}-build-cache-${{ github.sha }} restore-keys: ${{ runner.os }}-build-cache- @@ -71,13 +82,11 @@ jobs: - name: Build release run: | - ./ccache -zp python build.py -vr all - name: Build debug run: | python build.py -v all - ./ccache -s - name: Stop gradle daemon run: ./gradlew --stop