mirror of
https://github.com/git/git
synced 2024-11-05 18:59:29 +00:00
b819f1d2ce
The fact that Git's test suite is implemented in Unix shell script that is as portable as we can muster, combined with the fact that Unix shell scripting is foreign to Windows (and therefore has to be emulated), results in pretty abysmal speed of the test suite on that platform, for pretty much no other reason than that language choice. For comparison: while the Linux build & test is typically done within about 8 minutes, the Windows build & test typically lasts about 80 minutes in Azure Pipelines. To help with that, let's use the Azure Pipeline feature where you can parallelize jobs, make jobs depend on each other, and pass artifacts between them. The tests are distributed using the following heuristic: listing all test scripts ordered by size in descending order (as a cheap way to estimate the overall run time), every Nth script is run (where N is the total number of parallel jobs), starting at the index corresponding to the parallel job. This slicing is performed by a new function that is added to the `test-tool`. To optimize the overall runtime of the entire Pipeline, we need to move the Windows jobs to the beginning (otherwise there would be a very decent chance for the Pipeline to be run only the Windows build, while all the parallel Windows test jobs wait for this single one). We use Azure Pipelines Artifacts for both the minimal Git for Windows SDK as well as the built executables, as deduplication and caching close to the agents makes that really fast. For comparison: while downloading and unpacking the minimal Git for Windows SDK via PowerShell takes only one minute (down from anywhere between 2.5 to 7 when using a shallow clone), uploading it as Pipeline Artifact takes less than 30s and downloading and unpacking less than 20s (sometimes even as little as only twelve seconds). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
387 lines
14 KiB
YAML
387 lines
14 KiB
YAML
resources:
|
|
- repo: self
|
|
fetchDepth: 1
|
|
|
|
jobs:
|
|
- job: windows_build
|
|
displayName: Windows Build
|
|
condition: succeeded()
|
|
pool: Hosted
|
|
timeoutInMinutes: 240
|
|
steps:
|
|
- powershell: |
|
|
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
|
|
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
|
|
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
|
|
}
|
|
displayName: 'Mount test-cache'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- powershell: |
|
|
$urlbase = "https://dev.azure.com/git-for-windows/git/_apis/build/builds"
|
|
$id = ((Invoke-WebRequest -UseBasicParsing "${urlbase}?definitions=22&statusFilter=completed&resultFilter=succeeded&`$top=1").content | ConvertFrom-JSON).value[0].id
|
|
$downloadUrl = ((Invoke-WebRequest -UseBasicParsing "${urlbase}/$id/artifacts").content | ConvertFrom-JSON).value[1].resource.downloadUrl
|
|
(New-Object Net.WebClient).DownloadFile($downloadUrl,"git-sdk-64-minimal.zip")
|
|
Expand-Archive git-sdk-64-minimal.zip -DestinationPath . -Force
|
|
Remove-Item git-sdk-64-minimal.zip
|
|
|
|
# Let Git ignore the SDK and the test-cache
|
|
"/git-sdk-64-minimal/`n/test-cache/`n" | Out-File -NoNewLine -Encoding ascii -Append "$(Build.SourcesDirectory)\.git\info\exclude"
|
|
displayName: 'Download git-sdk-64-minimal'
|
|
- powershell: |
|
|
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
|
|
ci/make-test-artifacts.sh artifacts
|
|
"@
|
|
if (!$?) { exit(1) }
|
|
displayName: Build
|
|
env:
|
|
HOME: $(Build.SourcesDirectory)
|
|
MSYSTEM: MINGW64
|
|
DEVELOPER: 1
|
|
NO_PERL: 1
|
|
- task: PublishPipelineArtifact@0
|
|
displayName: 'Publish Pipeline Artifact: test artifacts'
|
|
inputs:
|
|
artifactName: 'windows-artifacts'
|
|
targetPath: '$(Build.SourcesDirectory)\artifacts'
|
|
- task: PublishPipelineArtifact@0
|
|
displayName: 'Publish Pipeline Artifact: git-sdk-64-minimal'
|
|
inputs:
|
|
artifactName: 'git-sdk-64-minimal'
|
|
targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
|
|
- powershell: |
|
|
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
|
|
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
|
|
}
|
|
displayName: 'Unmount test-cache'
|
|
condition: true
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
|
|
- job: windows_test
|
|
displayName: Windows Test
|
|
dependsOn: windows_build
|
|
condition: succeeded()
|
|
pool: Hosted
|
|
timeoutInMinutes: 240
|
|
strategy:
|
|
parallel: 10
|
|
steps:
|
|
- powershell: |
|
|
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
|
|
net use s: \\gitfileshare.file.core.windows.net\test-cache "$GITFILESHAREPWD" /user:AZURE\gitfileshare /persistent:no
|
|
cmd /c mklink /d "$(Build.SourcesDirectory)\test-cache" S:\
|
|
}
|
|
displayName: 'Mount test-cache'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact: test artifacts'
|
|
inputs:
|
|
artifactName: 'windows-artifacts'
|
|
targetPath: '$(Build.SourcesDirectory)'
|
|
- task: DownloadPipelineArtifact@0
|
|
displayName: 'Download Pipeline Artifact: git-sdk-64-minimal'
|
|
inputs:
|
|
artifactName: 'git-sdk-64-minimal'
|
|
targetPath: '$(Build.SourcesDirectory)\git-sdk-64-minimal'
|
|
- powershell: |
|
|
& git-sdk-64-minimal\usr\bin\bash.exe -lc @"
|
|
test -f artifacts.tar.gz || {
|
|
echo No test artifacts found\; skipping >&2
|
|
exit 0
|
|
}
|
|
tar xf artifacts.tar.gz || exit 1
|
|
|
|
# Let Git ignore the SDK and the test-cache
|
|
printf '%s\n' /git-sdk-64-minimal/ /test-cache/ >>.git/info/exclude
|
|
|
|
ci/run-test-slice.sh `$SYSTEM_JOBPOSITIONINPHASE `$SYSTEM_TOTALJOBSINPHASE || {
|
|
ci/print-test-failures.sh
|
|
exit 1
|
|
}
|
|
"@
|
|
if (!$?) { exit(1) }
|
|
displayName: 'Test (parallel)'
|
|
env:
|
|
HOME: $(Build.SourcesDirectory)
|
|
MSYSTEM: MINGW64
|
|
NO_SVN_TESTS: 1
|
|
GIT_TEST_SKIP_REBASE_P: 1
|
|
- powershell: |
|
|
if ("$GITFILESHAREPWD" -ne "" -and "$GITFILESHAREPWD" -ne "`$`(gitfileshare.pwd)") {
|
|
cmd /c rmdir "$(Build.SourcesDirectory)\test-cache"
|
|
}
|
|
displayName: 'Unmount test-cache'
|
|
condition: true
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'windows'
|
|
platform: Windows
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: linux_clang
|
|
displayName: linux-clang
|
|
condition: succeeded()
|
|
pool: Hosted Ubuntu 1604
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
sudo apt-get update &&
|
|
sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev apache2-bin &&
|
|
|
|
export CC=clang || exit 1
|
|
|
|
ci/install-dependencies.sh || exit 1
|
|
ci/run-build-and-tests.sh || {
|
|
ci/print-test-failures.sh
|
|
exit 1
|
|
}
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/run-build-and-tests.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'linux-clang'
|
|
platform: Linux
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: linux_gcc
|
|
displayName: linux-gcc
|
|
condition: succeeded()
|
|
pool: Hosted Ubuntu 1604
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
sudo add-apt-repository ppa:ubuntu-toolchain-r/test &&
|
|
sudo apt-get update &&
|
|
sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev apache2 language-pack-is git-svn gcc-8 || exit 1
|
|
|
|
ci/install-dependencies.sh || exit 1
|
|
ci/run-build-and-tests.sh || {
|
|
ci/print-test-failures.sh
|
|
exit 1
|
|
}
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/run-build-and-tests.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'linux-gcc'
|
|
platform: Linux
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: osx_clang
|
|
displayName: osx-clang
|
|
condition: succeeded()
|
|
pool: Hosted macOS
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
export CC=clang
|
|
|
|
ci/install-dependencies.sh || exit 1
|
|
ci/run-build-and-tests.sh || {
|
|
ci/print-test-failures.sh
|
|
exit 1
|
|
}
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/run-build-and-tests.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'osx-clang'
|
|
platform: macOS
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: osx_gcc
|
|
displayName: osx-gcc
|
|
condition: succeeded()
|
|
pool: Hosted macOS
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
ci/install-dependencies.sh || exit 1
|
|
ci/run-build-and-tests.sh || {
|
|
ci/print-test-failures.sh
|
|
exit 1
|
|
}
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/run-build-and-tests.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'osx-gcc'
|
|
platform: macOS
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: gettext_poison
|
|
displayName: GETTEXT_POISON
|
|
condition: succeeded()
|
|
pool: Hosted Ubuntu 1604
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
sudo apt-get update &&
|
|
sudo apt-get -y install git gcc make libssl-dev libcurl4-openssl-dev libexpat-dev tcl tk gettext git-email zlib1g-dev &&
|
|
|
|
export jobname=GETTEXT_POISON || exit 1
|
|
|
|
ci/run-build-and-tests.sh || {
|
|
ci/print-test-failures.sh
|
|
exit 1
|
|
}
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/run-build-and-tests.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'gettext-poison'
|
|
platform: Linux
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: linux32
|
|
displayName: Linux32
|
|
condition: succeeded()
|
|
pool: Hosted Ubuntu 1604
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
res=0
|
|
sudo AGENT_OS="$AGENT_OS" BUILD_BUILDNUMBER="$BUILD_BUILDNUMBER" BUILD_REPOSITORY_URI="$BUILD_REPOSITORY_URI" BUILD_SOURCEBRANCH="$BUILD_SOURCEBRANCH" BUILD_SOURCEVERSION="$BUILD_SOURCEVERSION" SYSTEM_PHASENAME="$SYSTEM_PHASENAME" SYSTEM_TASKDEFINITIONSURI="$SYSTEM_TASKDEFINITIONSURI" SYSTEM_TEAMPROJECT="$SYSTEM_TEAMPROJECT" CC=$CC MAKEFLAGS="$MAKEFLAGS" bash -lxc ci/run-linux32-docker.sh || res=1
|
|
|
|
sudo chmod a+r t/out/TEST-*.xml
|
|
test ! -d t/failed-test-artifacts || sudo chmod a+r t/failed-test-artifacts
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || res=1
|
|
exit $res
|
|
displayName: 'ci/run-linux32-docker.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
- task: PublishTestResults@2
|
|
displayName: 'Publish Test Results **/TEST-*.xml'
|
|
inputs:
|
|
mergeTestResults: true
|
|
testRunTitle: 'linux32'
|
|
platform: Linux
|
|
publishRunAttachments: false
|
|
condition: succeededOrFailed()
|
|
- task: PublishBuildArtifacts@1
|
|
displayName: 'Publish trash directories of failed tests'
|
|
condition: failed()
|
|
inputs:
|
|
PathtoPublish: t/failed-test-artifacts
|
|
ArtifactName: failed-test-artifacts
|
|
|
|
- job: static_analysis
|
|
displayName: StaticAnalysis
|
|
condition: succeeded()
|
|
pool: Hosted Ubuntu 1604
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
sudo apt-get update &&
|
|
sudo apt-get install -y coccinelle &&
|
|
|
|
export jobname=StaticAnalysis &&
|
|
|
|
ci/run-static-analysis.sh || exit 1
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/run-static-analysis.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|
|
|
|
- job: documentation
|
|
displayName: Documentation
|
|
condition: succeeded()
|
|
pool: Hosted Ubuntu 1604
|
|
steps:
|
|
- bash: |
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || ci/mount-fileshare.sh //gitfileshare.file.core.windows.net/test-cache gitfileshare "$GITFILESHAREPWD" "$HOME/test-cache" || exit 1
|
|
|
|
sudo apt-get update &&
|
|
sudo apt-get install -y asciidoc xmlto asciidoctor &&
|
|
|
|
export ALREADY_HAVE_ASCIIDOCTOR=yes. &&
|
|
export jobname=Documentation &&
|
|
|
|
ci/test-documentation.sh || exit 1
|
|
|
|
test "$GITFILESHAREPWD" = '$(gitfileshare.pwd)' || sudo umount "$HOME/test-cache" || exit 1
|
|
displayName: 'ci/test-documentation.sh'
|
|
env:
|
|
GITFILESHAREPWD: $(gitfileshare.pwd)
|