Use sccache for build cache and disable incremental mode in CI (#914)

Fixed #911

sccache cannot cache build artifacts if incremental mode is enabled.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-03-15 15:42:42 +11:00 committed by GitHub
parent c04b15dbc8
commit 42bffef98c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,9 +54,15 @@ runs:
shell: bash
- if: inputs.buildcache
name: Configure build cache
uses: actions/cache@v3
name: Configure sccache
uses: mozilla-actions/sccache-action@v0.0.2
with:
path: |
target/
key: ${{ runner.os }}-cargo-build-${{ hashFiles('rustc-version') }}-${{ hashFiles('**/Cargo.lock') }}-${{ inputs.cache-suffix }}
version: "v0.4.0-pre.10"
- if: inputs.buildcache
name: Export env for sccache to work
shell: bash
run: |
echo "SCCACHE_GHA_ENABLED=true" >> $GITHUB_ENV
echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
echo "CARGO_INCREMENTAL=0" >> $GITHUB_ENV