2019-08-11 00:39:39 +00:00
|
|
|
# This template installs sccache (Shared Compilation Cache)
|
|
|
|
# More info: https://github.com/mozilla/sccache
|
|
|
|
|
2019-08-24 19:11:18 +00:00
|
|
|
# Template originally from wasm-bindgen
|
|
|
|
# https://github.com/rustwasm/wasm-bindgen/blob/master/ci/azure-install-sccache.yml
|
2019-08-11 00:39:39 +00:00
|
|
|
steps:
|
|
|
|
- bash: |
|
2019-08-24 19:11:18 +00:00
|
|
|
set -ex
|
|
|
|
curl -L https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-unknown-linux-musl.tar.gz | tar xzf -
|
|
|
|
sccache=`pwd`/sccache-0.2.10-x86_64-unknown-linux-musl/sccache
|
|
|
|
echo "##vso[task.setvariable variable=RUSTC_WRAPPER;]$sccache"
|
2020-03-30 21:18:36 +00:00
|
|
|
displayName: Install sccache - Linux X64
|
|
|
|
condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OSArchitecture'], 'X64'))
|
2020-03-31 03:41:12 +00:00
|
|
|
- bash: |
|
|
|
|
command -v sccache > /dev/null || cargo install sccache
|
|
|
|
echo "##vso[task.setvariable variable=RUSTC_WRAPPER;]sccache"
|
|
|
|
displayName: Install sccache - Linux ARM
|
|
|
|
condition: and(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OSArchitecture'], 'ARM64'))
|
2019-08-11 00:39:39 +00:00
|
|
|
- bash: |
|
|
|
|
set -ex
|
2019-08-24 19:11:18 +00:00
|
|
|
brew install openssl@1.1
|
|
|
|
curl -L https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-apple-darwin.tar.gz | tar xzf -
|
|
|
|
sccache=`pwd`/sccache-0.2.10-x86_64-apple-darwin/sccache
|
|
|
|
echo "##vso[task.setvariable variable=RUSTC_WRAPPER;]$sccache"
|
|
|
|
displayName: Install sccache - Darwin
|
|
|
|
condition: eq( variables['Agent.OS'], 'Darwin' )
|
|
|
|
- powershell: |
|
|
|
|
Invoke-WebRequest https://github.com/mozilla/sccache/releases/download/0.2.10/sccache-0.2.10-x86_64-pc-windows-msvc.tar.gz -OutFile sccache.tar.gz
|
|
|
|
tar xzf sccache.tar.gz
|
|
|
|
Write-Host "##vso[task.setvariable variable=RUSTC_WRAPPER;]$pwd/sccache-0.2.10-x86_64-pc-windows-msvc/sccache.exe"
|
|
|
|
displayName: Install sccache - Windows
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
2019-08-11 00:39:39 +00:00
|
|
|
- bash: |
|
|
|
|
set -ex
|
2019-08-24 18:57:14 +00:00
|
|
|
env
|
2019-08-24 19:11:18 +00:00
|
|
|
SCCACHE_ERROR_LOG=`pwd`/sccache.log RUST_LOG=debug $RUSTC_WRAPPER --start-server
|
|
|
|
$RUSTC_WRAPPER -s
|
2019-08-11 00:39:39 +00:00
|
|
|
cat sccache.log
|
2019-08-24 19:11:18 +00:00
|
|
|
displayName: "start sccache"
|
2020-03-31 03:41:12 +00:00
|
|
|
condition: not(eq( variables['Agent.OS'], 'Windows_NT' ))
|
2019-08-24 18:57:14 +00:00
|
|
|
env:
|
|
|
|
SCCACHE_AZURE_CONNECTION_STRING: $(SCCACHE_AZURE_CONNECTION_STRING)
|
|
|
|
SCCACHE_AZURE_BLOB_CONTAINER: $(SCCACHE_AZURE_BLOB_CONTAINER)
|
2019-09-25 20:35:11 +00:00
|
|
|
|
|
|
|
# Only use Azure pipelines cache in Windows
|
|
|
|
- bash: |
|
|
|
|
set -ex
|
|
|
|
env
|
|
|
|
mkdir -p $SCCACHE_DIR
|
|
|
|
SCCACHE_ERROR_LOG=`pwd`/sccache.log RUST_LOG=debug $RUSTC_WRAPPER --start-server
|
|
|
|
$RUSTC_WRAPPER -s
|
|
|
|
cat sccache.log
|
|
|
|
displayName: "start sccache"
|
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|
|
|
|
env:
|
2019-09-03 22:32:32 +00:00
|
|
|
SCCACHE_DIR: $(Pipeline.Workspace)/.sccache
|
|
|
|
- task: CacheBeta@0
|
|
|
|
inputs:
|
|
|
|
key: sccache | $(Agent.OS) | Cargo.lock
|
|
|
|
path: $(Pipeline.Workspace)/.sccache
|
|
|
|
displayName: Cache Cargo Target
|
2019-09-25 20:35:11 +00:00
|
|
|
condition: eq( variables['Agent.OS'], 'Windows_NT' )
|