[CI] Unify all the setup steps in a template. (#13835)

This commit is contained in:
Manuel de la Pena 2022-01-21 21:31:35 -05:00 коммит произвёл GitHub
Родитель d442e95079
Коммит 02598ae1f3
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
3 изменённых файлов: 91 добавлений и 99 удалений

Просмотреть файл

@ -68,50 +68,9 @@ steps:
git remote # don't add -v else we see the pat
displayName: 'Clean git mess from VSTS'
- powershell: |
Write-Host "IsMacOS: ${IsMacOS}"
Write-Host "IsWindows: ${IsWindows}"
Write-Host "IsLinux: ${IsLinux}"
if ($IsMacOS -or $IsLinux) {
Write-Host "HOSTNAME: $(hostname)"
} else {
Write-Host "COMPUTERNAME: ${env:COMPUTERNAME}"
}
gci env: | format-table -autosize -wrap
displayName: 'Show Environment'
- powershell: |
Write-Host "Python version"
python --version
Write-Host "Python location"
which python
Write-Host "Python2 location"
which python2
Write-Host "Python3 location"
which python3
Write-Host "Pip3 version"
pip3 -V
displayName: 'Show Python information'
- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/clean-bot.sh
displayName: 'Clean bot'
env:
BUILD_REVISION: 'jenkins'
continueOnError: true
timeoutInMinutes: 60
- bash: |
security set-key-partition-list -S apple-tool:,apple: -s -k $OSX_KEYCHAIN_PASS login.keychain
env:
OSX_KEYCHAIN_PASS: ${{ parameters.keyringPass }}
displayName: 'Remove security UI-prompt (http://stackoverflow.com/a/40039594/183422)'
condition: succeededOrFailed() # we do not care about the previous process cleanup
- template: ../common/setup.yml
parameters:
keyringPass: ${{ parameters.keyringPass }}
- template: install-certificates.yml@templates
parameters:
@ -121,8 +80,6 @@ steps:
MacDeveloper: $(mac-developer)
HostedMacKeychainPassword: ${{ parameters.keyringPass }}
- template: agent-cleanser/v1.yml@templates # Uninstalls mono, Xamarin.Mac (if installed) plus cleanses the Provisionator Xcode cache
- task: xamops.azdevex.provisionator-task.provisionator@2
displayName: 'Provision Brew components'
inputs:
@ -131,18 +88,6 @@ steps:
timeoutInMinutes: 30
enabled: true
# was the current xcode deleted (has happened due to a bug in the clean step)? then set the default so
# that we can call make and generated the provisionator config files.
- bash: |
XCODE_SELECT=$(xcode-select -p)
if [[ -d $XCODE_SELECT ]]; then
echo "Using Xcode in path $XCODE_SELECT"
else
echo "Setting Xcode to point to the default location."
xcode-select -s "/Applications/Xcode.app/Contents/Developer"
fi
displayName: 'Ensure Xcode is selected.'
- bash: |
make -C $(Build.SourcesDirectory)/xamarin-macios/tools/devops build-provisioning.csx
displayName: 'Generate provisionator files.'
@ -160,22 +105,6 @@ steps:
$(Build.SourcesDirectory)/xamarin-macios/system-dependencies.sh --provision-simulators
displayName: 'Provision simulators'
- bash: |
set -x
sudo rm -Rf /Developer/MonoTouch
sudo rm -Rf /Library/Frameworks/Xamarin.iOS.framework
sudo rm -Rf /Library/Frameworks/Xamarin.Mac.framework
displayName: 'Delete library folders'
timeoutInMinutes: 5
- bash:
set -x
set -e
rm -Rvf $(Build.SourcesDirectory)/package
time make -C $(Build.SourcesDirectory)/xamarin-macios/ git-clean-all
displayName: 'Clear results directory'
timeoutInMinutes: 5
# Use the env variables that were set by the label parsing in the configure step
# print some useful logging to allow to know what is going on AND allow make some
# choices, there are labels that contradict each other (skip-package vs build-packages)

Просмотреть файл

@ -0,0 +1,85 @@
# Template that does all the boiler plate needed to build and execute tests on macOS bots
parameters:
- name: keyringPass
type: string
steps:
- template: agent-cleanser/v1.yml@templates # Uninstalls mono, Xamarin.Mac (if installed) plus cleanses the Provisionator Xcode cache
- bash: cd $(System.DefaultWorkingDirectory)/xamarin-macios/ && git clean -xdf
displayName: 'Clean workspace'
- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/clean-bot.sh
displayName: 'Clean bot'
env:
BUILD_REVISION: 'jenkins'
continueOnError: true
timeoutInMinutes: 60
- powershell: |
Write-Host "IsMacOS: ${IsMacOS}"
Write-Host "IsWindows: ${IsWindows}"
Write-Host "IsLinux: ${IsLinux}"
if ($IsMacOS -or $IsLinux) {
Write-Host "HOSTNAME: $(hostname)"
} else {
Write-Host "COMPUTERNAME: ${env:COMPUTERNAME}"
}
gci env: | format-table -autosize -wrap
displayName: 'Show Environment'
- powershell: |
Write-Host "Python version"
python --version
Write-Host "Python location"
which python
Write-Host "Python2 location"
which python2
Write-Host "Python3 location"
which python3
Write-Host "Pip3 version"
pip3 -V
displayName: 'Show Python information'
- bash: |
set -x
sudo rm -Rf /Developer/MonoTouch
sudo rm -Rf /Library/Frameworks/Xamarin.iOS.framework
sudo rm -Rf /Library/Frameworks/Xamarin.Mac.framework
displayName: 'Delete library folders'
timeoutInMinutes: 5
- bash:
set -x
set -e
rm -Rvf $(Build.SourcesDirectory)/package
time make -C $(Build.SourcesDirectory)/xamarin-macios/ git-clean-all
displayName: 'Clear results directory'
timeoutInMinutes: 5
- bash: |
security set-key-partition-list -S apple-tool:,apple: -s -k $OSX_KEYCHAIN_PASS login.keychain
env:
OSX_KEYCHAIN_PASS: ${{ parameters.keyringPass }}
displayName: 'Remove security UI-prompt (http://stackoverflow.com/a/40039594/183422)'
condition: succeededOrFailed() # we do not care about the previous process cleanup
# was the current xcode deleted (has happened due to a bug in the clean step)? then set the default so
# that we can call make and generated the provisionator config files.
- bash: |
XCODE_SELECT=$(xcode-select -p)
if [[ -d $XCODE_SELECT ]]; then
echo "Using Xcode in path $XCODE_SELECT"
else
echo "Setting Xcode to point to the default location."
xcode-select -s "/Applications/Xcode.app/Contents/Developer"
fi
displayName: 'Ensure Xcode is selected.'

Просмотреть файл

@ -50,31 +50,9 @@ steps:
- checkout: maccore
persistCredentials: true # hugely important, else there are some scripts that check a single file from maccore that will fail
- template: agent-cleanser/v1.yml@templates # Uninstalls mono, Xamarin.Mac (if installed) plus cleanses the Provisionator Xcode cache
- bash: $(System.DefaultWorkingDirectory)/xamarin-macios/tools/devops/automation/scripts/bash/clean-bot.sh
displayName: 'Clean bot'
env:
BUILD_REVISION: 'jenkins'
continueOnError: true
timeoutInMinutes: 60
- bash: cd $(System.DefaultWorkingDirectory)/xamarin-macios/ && git clean -xdf
displayName: 'Clean workspace'
- pwsh : |
Write-Host "IsMacOS: ${IsMacOS}"
Write-Host "IsWindows: ${IsWindows}"
Write-Host "IsLinux: ${IsLinux}"
if ($IsMacOS -or $IsLinux) {
Write-Host "HOSTNAME: $(hostname)"
} else {
Write-Host "COMPUTERNAME: ${env:COMPUTERNAME}"
}
gci env: | format-table -autosize -wrap
displayName: 'Show Environment'
- template: ../common/setup.yml
parameters:
keyringPass: ${{ parameters.keyringPass }}
# Use a cmdlet to check if the space available in the devices root system is larger than 50 gb. If there is not
# enough space available it: