STL/azure-devops/checkout-sources.yml

101 строка
3.1 KiB
YAML

# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
parameters:
- name: llvmSHAVar
type: string
default: llvmSHA
- name: boostMathSHAVar
type: string
default: boostMathSHA
- name: googleBenchmarkSHAVar
type: string
default: googleBenchmarkSHA
steps:
- checkout: self
clean: true
submodules: false
- script: |
cd $(Build.SourcesDirectory)
git clean --quiet -x -d -f -f
displayName: 'Clean after checkout'
- task: PowerShell@2
displayName: 'Get submodule SHAs'
timeoutInMinutes: 1
inputs:
targetType: inline
script: |
cd $(Build.SourcesDirectory)
$regexSubmoduleSHA = '^[ \-+]([0-9a-f]+) .*$'
$llvmSHA = git submodule status --cached llvm-project | %{$_ -replace $regexSubmoduleSHA, '$1'}
Write-Host "##vso[task.setvariable variable=${{ parameters.llvmSHAVar }};]$llvmSHA"
$boostMathSHA = git submodule status --cached boost-math | %{$_ -replace $regexSubmoduleSHA, '$1'}
Write-Host "##vso[task.setvariable variable=${{ parameters.boostMathSHAVar }};]$boostMathSHA"
$googleBenchmarkSHA = git submodule status --cached benchmarks/google-benchmark `
| %{$_ -replace $regexSubmoduleSHA, '$1'}
Write-Host "##vso[task.setvariable variable=${{ parameters.googleBenchmarkSHAVar }};]$googleBenchmarkSHA"
- script: |
cd $(Build.SourcesDirectory)
if not exist "llvm-project" (
mkdir llvm-project
)
cd llvm-project
if not exist ".git" (
del /S /Q *
git init
)
git remote get-url llvm
if errorlevel 1 (
git remote add llvm https://github.com/llvm/llvm-project.git
)
git fetch --filter=tree:0 --depth=1 llvm $(${{ parameters.llvmSHAVar }})
git sparse-checkout set --cone --sparse-index libcxx/test libcxx/utils/libcxx llvm/utils/lit
git reset --quiet --hard FETCH_HEAD
git clean --quiet -x -d -f -f
displayName: "Checkout LLVM source"
- script: |
cd $(Build.SourcesDirectory)
if not exist "boost-math" (
mkdir boost-math
)
cd boost-math
if not exist ".git" (
del /S /Q *
git init
)
git remote get-url boostorg
if errorlevel 1 (
git remote add boostorg https://github.com/boostorg/math.git
)
git fetch --filter=tree:0 --depth=1 boostorg $(${{ parameters.boostMathSHAVar }})
git reset --quiet --hard FETCH_HEAD
git clean --quiet -x -d -f -f
displayName: "Checkout boost-math source"
- script: |
cd $(Build.SourcesDirectory)/benchmarks
if not exist "google-benchmark" (
mkdir google-benchmark
)
cd google-benchmark
if not exist ".git" (
del /S /Q *
git init
)
git remote get-url googlebenchmark
if errorlevel 1 (
git remote add googlebenchmark https://github.com/google/benchmark.git
)
git fetch --filter=tree:0 --depth=1 googlebenchmark $(${{ parameters.googleBenchmarkSHAVar }})
git reset --quiet --hard FETCH_HEAD
git clean --quiet -x -d -f -f
displayName: "Checkout google benchmark source"