-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathazure-pipelines.yml
148 lines (134 loc) · 4.87 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# We want builds to trigger for 3 reasons:
# - The master branch sees new commits
# - Each PR should get rebuilt when commits are added to it.
# - When we tag something
trigger:
branches:
include:
- master
tags:
include:
# Tags must start with "v"
- v*
pr:
branches:
include:
- "*"
# The github_ci_token variable is defined in the Azure Pipeline web page as a
# secret variable and is a github personal token.
jobs:
- job: 'Build'
strategy:
matrix:
# Define all the platform/python version we need
MacPython39:
platform: 'osx' # Short name for us
imageName: 'macOS-latest'
python.version: '3.9'
WinPython39:
platform: 'win' # Short name for us
imageName: 'windows-latest'
python.version: '3.9'
LinuxPython39:
platform: 'linux' # Short name for us
imageName: 'ubuntu-latest'
python.version: '3.9'
MacPython311:
platform: 'osx' # Short name for us
imageName: 'macOS-latest'
python.version: '3.11'
WinPython311:
platform: 'win' # Short name for us
imageName: 'windows-latest'
python.version: '3.11'
LinuxPython311:
platform: 'linux' # Short name for us
imageName: 'ubuntu-latest'
python.version: '3.11'
maxParallel: 1
pool:
# Retrieve the value set by the strategy above
vmImage: $(imageName)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(python.version)'
architecture: 'x64'
- script: |
python -m pip install --upgrade pip
displayName: 'Install dependencies'
# Not needed for Python 3, virtual env are built with python3 -m venv
- script: |
pip install virtualenv
condition: eq( variables['python.version'], '2.7' )
displayName: 'Install virtualenv'
# Couldn't get the script to be found using a bash task.
- script: |
./build_packages.sh -b
workingDirectory: "resources"
displayName: 'Build'
env:
# Pass the variable into the environment
GITHUB_CI_TOKEN: $(github_ci_token)
condition: in( variables['Agent.OS'], 'Darwin', 'Linux' )
# Couldn't get the script to be found using a bash task.
- script: |
bash.exe ./build_packages.sh -b
workingDirectory: resources
displayName: 'Build Windows'
env:
# Pass the variable into the environment
GITHUB_CI_TOKEN: $(github_ci_token)
condition: eq( variables['Agent.OS'], 'Windows_NT' )
# Delete files
# Delete folders, or files matching a pattern
- task: DeleteFiles@1
inputs:
Contents: |
.git
resources/packagevenv_osx_3.11
resources/packagevenv_windows_3.11
resources/packagevenv_linux_3.11
# Archive files
# Compress files into .7z, .tar.gz, or .zip
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.SourcesDirectory)'
includeRootFolder: false
archiveType: 'zip' # Options: zip, 7z, tar, wim
#tarCompression: 'gz' # Optional. Options: gz, bz2, xz, none
# archive name will be something like v2.1.2-py2.7-osx.zip
archiveFile: '$(Build.ArtifactStagingDirectory)/$(Build.SourceBranchName)-py$(python.version)-$(platform).zip'
replaceExistingArchive: true
verbose: true
#quiet: # Optional
- bash: |
echo Source branch is ${BUILD_SOURCEBRANCHNAME} for ${PLATFORM}
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')
# Create, edit, or delete a GitHub release
- task: GitHubRelease@0
displayName: 'Create GitHub Release'
inputs:
# Note: the service connection needs to be created manually with curl
# not from the Azure web UI
# https://github.com/microsoft/azure-pipelines-tasks/issues/11558
gitHubConnection: "Github release"
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)' # Required when action == Create || Action == Edit
tagSource: 'auto' # Required when action == Create# Options: auto, manual
assets: '$(Build.ArtifactStagingDirectory)/$(Build.SourceBranchName)-py$(python.version)-$(platform).zip'
assetUploadMode: 'replace' # Optional. Options: delete, replace
tag: '$(Build.SourceBranchName)'
#tagPattern: # Optional
#tag: # Required when action == Edit || Action == Delete || TagSource == Manual
#title: # Optional
#releaseNotesSource: 'file' # Optional. Options: file, input
#releaseNotesFile: # Optional
#releaseNotes: # Optional
#isDraft: false # Optional
#isPreRelease: false # Optional
#addChangeLog: true # Optional
#compareWith: 'lastFullRelease' # Required when addChangeLog == True. Options: lastFullRelease, lastRelease, lastReleaseByTag
#releaseTag: # Required when compareWith == LastReleaseByTag
condition: startsWith(variables['build.sourceBranch'], 'refs/tags/')