-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
139 lines (121 loc) · 3.74 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
trigger:
tags:
include:
- 'v*'
branches:
include:
- '*'
variables:
- group: PyPi
stages:
- stage: Test
jobs:
- job: Test
strategy:
matrix:
'Python 3.8/Linux':
image: 'ubuntu-20.04'
pythonVersion: '3.8'
'Python 3.9/Linux':
image: 'ubuntu-20.04'
pythonVersion: '3.9'
'Python 3.10/Linux':
image: 'ubuntu-20.04'
pythonVersion: '3.10'
'Python 3.9/Mac OS 11':
image: 'macOS-11'
pythonVersion: '3.9'
'Windows Server 2019':
image: 'windows-2019'
pythonVersion: '3.8'
pool:
vmImage: $(image)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
- script: |
pip install -U poetry
pip install -U tox
displayName: 'Install Poetry'
- bash: |
PYENV=$(sed -e 's/\.//' <<< "py$(pythonVersion)")
tox -e $PYENV
displayName: 'Running tests via tox'
- stage: Build_Deploy
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') )
jobs:
- job: Linux
variables:
image: 'ubuntu-20.04'
pythonVersion: '3.9'
pool:
vmImage: $(image)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
- script: |
pip install -U poetry
displayName: 'Install Poetry'
- script: |
poetry config http-basic.pypi $(PYPI_USER) $(PYPI_TOKEN)
displayName: 'Config Poetry for Deployment'
- script: |
BUILDNAME=$(echo "$(System.TeamProject)-$(Build.SourceBranchName)-$(Agent.OS)-$(Agent.OSArchitecture)" | tr '[:upper:]' '[:lower:]')
echo ">>>>>>" $BUILDNAME
poetry install -v
poetry build
poetry run pyinstaller $(System.TeamProject)/cli.py -n $(System.TeamProject) --onefile --exclude-module _bootlocale
tar cvzf dist/$BUILDNAME.tar.gz dist/$(System.TeamProject)
sha256sum dist/$BUILDNAME.tar.gz > dist/$BUILDNAME.tar.gz.sha256
ls -R dist
displayName: 'Build'
- script: |
poetry publish
displayName: 'Publish to PyPI'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'github.com_stdtom (Release)'
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'gitTag'
assets: 'dist/$(System.TeamProject)-$(Build.SourceBranchName)-*.*'
addChangeLog: false
- job: Windows
dependsOn: Linux
variables:
image: 'windows-2019'
pythonVersion: '3.8'
pool:
vmImage: $(image)
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '$(pythonVersion)'
- script: |
pip install -U poetry
displayName: 'Install Poetry'
- bash: |
BUILDNAME=$(echo "$(System.TeamProject)-$(Build.SourceBranchName)-$(Agent.OS)-$(Agent.OSArchitecture)" | tr '[:upper:]' '[:lower:]')
echo ">>>>>>" $BUILDNAME
poetry install -v
poetry build
poetry run pyinstaller $(System.TeamProject)/cli.py -n $(System.TeamProject) --onefile --exclude-module _bootlocale
ls -R dist
7z a dist/$BUILDNAME.zip dist/$(System.TeamProject).exe
ls -R dist
sha256sum dist/$BUILDNAME.zip > dist/$BUILDNAME.zip.sha256
ls -R dist
displayName: 'Build'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'github.com_stdtom (Release)'
repositoryName: '$(Build.Repository.Name)'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(Build.SourceBranchName)'
assets: 'dist/$(System.TeamProject)-$(Build.SourceBranchName)-*.*'
assetUploadMode: 'replace'
addChangeLog: false