Engineering - use sccache during the cli build (#295241)

This commit is contained in:
Ladislau Szomoru
2026-02-13 21:35:50 +01:00
committed by GitHub
parent 08de9ad064
commit ea22b3498d

View File

@@ -20,12 +20,55 @@ steps:
- script: echo "##vso[task.setvariable variable=VSCODE_CLI_PRODUCT_JSON]$(Build.SourcesDirectory)/.build/distro/mixin/${{ parameters.VSCODE_QUALITY }}/product.json"
displayName: Set product.json path
- task: Cache@2
displayName: Restore sccache cache
inputs:
key: 'sccache | "$(Agent.OS)" | "${{ parameters.VSCODE_CLI_TARGET }}" | $(Build.SourcesDirectory)/cli/Cargo.lock | $(Build.SourcesDirectory)/build/.cachesalt'
path: $(Pipeline.Workspace)/sccache
- ${{ if contains(parameters.VSCODE_CLI_TARGET, '-windows-') }}:
- pwsh: |
$version = "0.14.0"
$url = "https://github.com/mozilla/sccache/releases/download/v$version/sccache-v$version-x86_64-pc-windows-msvc.zip"
Invoke-WebRequest -Uri $url -OutFile "$env:TEMP\sccache.zip"
Expand-Archive -Path "$env:TEMP\sccache.zip" -DestinationPath "$env:TEMP\sccache" -Force
$sccacheDir = Get-ChildItem -Path "$env:TEMP\sccache" -Directory | Select-Object -First 1
Copy-Item "$($sccacheDir.FullName)\sccache.exe" -Destination "$env:USERPROFILE\.cargo\bin\sccache.exe"
sccache --version
displayName: Install sccache
- ${{ else }}:
- script: |
set -e
SCCACHE_VERSION="0.14.0"
ARCH=$(uname -m)
OS=$(uname -s)
if [ "$OS" = "Darwin" ]; then
TARGET="aarch64-apple-darwin"
elif [ "$OS" = "Linux" ]; then
if [ "$ARCH" = "aarch64" ]; then
TARGET="aarch64-unknown-linux-musl"
else
TARGET="x86_64-unknown-linux-musl"
fi
fi
FILENAME="sccache-v${SCCACHE_VERSION}-${TARGET}"
URL="https://github.com/mozilla/sccache/releases/download/v${SCCACHE_VERSION}/${FILENAME}.tar.gz"
echo "Downloading sccache from $URL"
curl -fsSL "$URL" -o /tmp/sccache.tar.gz
tar -xzf /tmp/sccache.tar.gz -C /tmp
sudo cp "/tmp/${FILENAME}/sccache" /usr/local/bin/sccache
sudo chmod +x /usr/local/bin/sccache
sccache --version
displayName: Install sccache
- ${{ if parameters.VSCODE_CHECK_ONLY }}:
- script: cargo clippy --target ${{ parameters.VSCODE_CLI_TARGET }} --bin=code
displayName: Lint ${{ parameters.VSCODE_CLI_TARGET }}
workingDirectory: $(Build.SourcesDirectory)/cli
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
RUSTC_WRAPPER: sccache
SCCACHE_DIR: $(Pipeline.Workspace)/sccache
${{ each pair in parameters.VSCODE_CLI_ENV }}:
${{ pair.key }}: ${{ pair.value }}
@@ -93,6 +136,8 @@ steps:
CARGO_NET_GIT_FETCH_WITH_CLI: true
VSCODE_CLI_COMMIT: $(Build.SourceVersion)
GITHUB_TOKEN: "$(github-distro-mixin-password)"
RUSTC_WRAPPER: sccache
SCCACHE_DIR: $(Pipeline.Workspace)/sccache
${{ each pair in parameters.VSCODE_CLI_ENV }}:
${{ pair.key }}: ${{ pair.value }}
@@ -103,6 +148,8 @@ steps:
env:
CARGO_NET_GIT_FETCH_WITH_CLI: true
VSCODE_CLI_COMMIT: $(Build.SourceVersion)
RUSTC_WRAPPER: sccache
SCCACHE_DIR: $(Pipeline.Workspace)/sccache
${{ each pair in parameters.VSCODE_CLI_ENV }}:
${{ pair.key }}: ${{ pair.value }}
@@ -161,3 +208,9 @@ steps:
archiveType: tar
tarCompression: gz
archiveFile: $(Build.ArtifactStagingDirectory)/${{ parameters.VSCODE_CLI_ARTIFACT }}.tar.gz
- script: sccache --show-stats
displayName: sccache stats
condition: succeededOrFailed()
env:
SCCACHE_DIR: $(Pipeline.Workspace)/sccache