mirror of
https://github.com/actions/python-versions.git
synced 2025-04-08 00:09:39 +00:00
mplement script to build and prepare packages for Python
This commit is contained in:
22
azure-pipelines/templates/build-job.yml
Normal file
22
azure-pipelines/templates/build-job.yml
Normal file
@ -0,0 +1,22 @@
|
||||
jobs:
|
||||
- job: Build_Python
|
||||
timeoutInMinutes: 90
|
||||
pool:
|
||||
name: Azure Pipelines
|
||||
vmImage: $(VmImage)
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: true
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Build Python $(VERSION)'
|
||||
inputs:
|
||||
targetType: filePath
|
||||
filePath: './builders/build-python.ps1'
|
||||
arguments: '-Version $(VERSION) -Platform $(Platform) -Architecture $(Architecture)'
|
||||
|
||||
- task: PublishPipelineArtifact@1
|
||||
displayName: 'Publish Artifact: Python $(VERSION)'
|
||||
inputs:
|
||||
targetPath: '$(Build.ArtifactStagingDirectory)'
|
||||
artifactName: 'python-$(VERSION)-$(Platform)-$(Architecture)'
|
80
azure-pipelines/templates/test-job.yml
Normal file
80
azure-pipelines/templates/test-job.yml
Normal file
@ -0,0 +1,80 @@
|
||||
jobs:
|
||||
- job: Test_Python
|
||||
pool:
|
||||
name: Azure Pipelines
|
||||
vmImage: $(VmImage)
|
||||
steps:
|
||||
- checkout: self
|
||||
submodules: true
|
||||
|
||||
- task: DownloadPipelineArtifact@2
|
||||
inputs:
|
||||
source: 'current'
|
||||
artifact: 'python-$(VERSION)-$(Platform)-$(Architecture)'
|
||||
path: $(Build.BinariesDirectory)
|
||||
|
||||
- task: ExtractFiles@1
|
||||
inputs:
|
||||
archiveFilePatterns: '$(Build.BinariesDirectory)/python-$(VERSION)-$(Platform)-$(Architecture).*'
|
||||
destinationFolder: $(Build.BinariesDirectory)
|
||||
cleanDestinationFolder: false
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Apply build artifact to the local machines'
|
||||
inputs:
|
||||
TargetType: inline
|
||||
script: |
|
||||
if ($env:PLATFORM -match 'windows') { powershell ./setup.ps1 } else { sh ./setup.sh }
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
|
||||
- task: UsePythonVersion@0
|
||||
displayName: 'Use Python $(VERSION)'
|
||||
inputs:
|
||||
versionSpec: '$(VERSION)'
|
||||
architecture: '$(Architecture)'
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Verbose sysconfig dump'
|
||||
inputs:
|
||||
TargetType: inline
|
||||
script: |
|
||||
Invoke-Expression "python ./sources/python-config-output.py"
|
||||
workingDirectory: '$(Build.SourcesDirectory)/tests'
|
||||
condition: ne(variables['Platform'], 'windows-2016')
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Verbose python binary links'
|
||||
inputs:
|
||||
TargetType: inline
|
||||
script: |
|
||||
$pythonLocation = which python
|
||||
if ($env:PLATFORM -match 'macos') { otool -L $pythonLocation } else { ldd $pythonLocation }
|
||||
workingDirectory: '$(Build.BinariesDirectory)'
|
||||
condition: ne(variables['Platform'], 'windows-2016')
|
||||
|
||||
- task: PowerShell@2
|
||||
displayName: 'Run tests'
|
||||
inputs:
|
||||
TargetType: inline
|
||||
script: |
|
||||
Install-Module Pester -Force -Scope CurrentUser
|
||||
Import-Module Pester
|
||||
$pesterParams = @{
|
||||
Path="./python-tests.ps1";
|
||||
Parameters=@{
|
||||
Version="$(VERSION)";
|
||||
Platform="$(Platform)";
|
||||
}
|
||||
}
|
||||
Invoke-Pester -Script $pesterParams -OutputFile "test_results.xml" -OutputFormat NUnitXml
|
||||
workingDirectory: '$(Build.SourcesDirectory)/tests'
|
||||
|
||||
- task: PublishTestResults@2
|
||||
displayName: 'Publish test results'
|
||||
inputs:
|
||||
testResultsFiles: '*.xml'
|
||||
testResultsFormat: NUnit
|
||||
searchFolder: 'tests'
|
||||
failTaskOnFailedTests: true
|
||||
testRunTitle: "$(TestRunTitle)"
|
||||
condition: always()
|
Reference in New Issue
Block a user