Use sccache for rust build

This commit is contained in:
LoveSy 2022-09-22 10:10:47 +08:00 committed by John Wu
parent 095d821240
commit 23ad611566
2 changed files with 14 additions and 24 deletions

19
.github/ccache.sh vendored
View File

@ -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'

View File

@ -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