ci: extract installing sccache into a script
This commit is contained in:
parent
c1fb42add5
commit
a36077235e
@ -1,21 +0,0 @@
|
||||
steps:
|
||||
|
||||
- bash: |
|
||||
set -e
|
||||
curl -fo /usr/local/bin/sccache https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2018-04-02-sccache-x86_64-apple-darwin
|
||||
chmod +x /usr/local/bin/sccache
|
||||
displayName: Install sccache (OSX)
|
||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Darwin'))
|
||||
|
||||
- script: |
|
||||
md sccache
|
||||
powershell -Command "$ProgressPreference = 'SilentlyContinue'; iwr -outf sccache\sccache.exe https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc/2018-04-26-sccache-x86_64-pc-windows-msvc"
|
||||
echo ##vso[task.prependpath]%CD%\sccache
|
||||
displayName: Install sccache (Windows)
|
||||
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
|
||||
|
||||
# Note that we don't install sccache on Linux since it's installed elsewhere
|
||||
# through all the containers.
|
||||
#
|
||||
# FIXME: we should probably install sccache outside the containers and then
|
||||
# mount it inside the containers so we can centralize all installation here.
|
@ -51,7 +51,12 @@ steps:
|
||||
- bash: src/ci/scripts/dump-environment.sh
|
||||
displayName: Show the current environment
|
||||
|
||||
- template: install-sccache.yml
|
||||
- bash: src/ci/scripts/install-sccache.sh
|
||||
env:
|
||||
AGENT_OS: $(Agent.OS)
|
||||
displayName: Install sccache
|
||||
condition: and(succeeded(), not(variables.SKIP_JOB))
|
||||
|
||||
- template: install-clang.yml
|
||||
|
||||
# Switch to XCode 9.3 on OSX since it seems to be the last version that supports
|
||||
|
20
src/ci/scripts/install-sccache.sh
Executable file
20
src/ci/scripts/install-sccache.sh
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
# This script installs sccache on the local machine. Note that we don't install
|
||||
# sccache on Linux since it's installed elsewhere through all the containers.
|
||||
|
||||
set -euo pipefail
|
||||
IFS=$'\n\t'
|
||||
|
||||
source "$(cd "$(dirname "$0")" && pwd)/../shared.sh"
|
||||
|
||||
if isMacOS; then
|
||||
curl -fo /usr/local/bin/sccache "${MIRRORS_BASE}/2018-04-02-sccache-x86_64-apple-darwin"
|
||||
chmod +x /usr/local/bin/sccache
|
||||
elif isWindows; then
|
||||
mkdir -p sccache
|
||||
curl -fo sccache/sccache.exe "${MIRRORS_BASE}/2018-04-26-sccache-x86_64-pc-windows-msvc"
|
||||
ciCommandAddPath "$(pwd)/sccache"
|
||||
fi
|
||||
|
||||
# FIXME: we should probably install sccache outside the containers and then
|
||||
# mount it inside the containers so we can centralize all installation here.
|
@ -4,6 +4,8 @@
|
||||
# `source shared.sh`, hence the invalid shebang and not being
|
||||
# marked as an executable file in git.
|
||||
|
||||
export MIRRORS_BASE="https://rust-lang-ci-mirrors.s3-us-west-1.amazonaws.com/rustc"
|
||||
|
||||
# See http://unix.stackexchange.com/questions/82598
|
||||
# Duplicated in docker/dist-various-2/shared.sh
|
||||
function retry {
|
||||
@ -32,6 +34,24 @@ function isOSX {
|
||||
[ "$AGENT_OS" = "Darwin" ]
|
||||
}
|
||||
|
||||
function isMacOS {
|
||||
isOSX
|
||||
}
|
||||
|
||||
function isWindows {
|
||||
[ "$AGENT_OS" = "Windows_NT" ]
|
||||
}
|
||||
|
||||
function getCIBranch {
|
||||
echo "$BUILD_SOURCEBRANCHNAME"
|
||||
}
|
||||
|
||||
function ciCommandAddPath {
|
||||
if [[ $# -ne 1 ]]; then
|
||||
echo "usage: $0 <path>"
|
||||
exit 1
|
||||
fi
|
||||
path="$1"
|
||||
|
||||
echo "##vso[task.prependpath]${path}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user