forked from sharppy/SHARPpy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathazure-pipelines.yml
218 lines (195 loc) · 7.91 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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# MUST CHANGE TRIGGER SO BUILDS HAPPEN ON OTHER BRANCHES AND PULL REQUESTS
trigger:
branches:
include:
- master
tags:
include:
- v*
# Setup build strategy (listing the various VMs and configurations we'll use)
strategy:
matrix:
linux-1280x1024:
# Ubuntu 16.04
imageName: 'ubuntu-latest'
screen_w: 1280
screen_h: 1024
screen_d: 16
mac-defaultres:
# macOS 10.13
imageName: 'macos-latest'
# screen_w: 1280
# screen_h: 1024
# screen_d: 16
windows-1280x1024:
# Windows Docker Container not Visual Studio 2017 on Windows Server 2016
imageName: 'windows-latest' #'vs2017-win2016' # 'vs2015-win2012r2'
screen_w: 1280
screen_h: 1024
screen_d: 16
# Set up the pool of VMs for CI
pool:
vmImage: $(imageName)
# Describe the steps to install conda, the code, do tests, and deploy the artifacts
steps:
- bash: echo "##vso[task.prependpath]/usr/share/miniconda/bin"
displayName: Add conda to PATH
condition: eq( variables['Agent.OS'], 'Linux')
- bash: |
echo "##vso[task.prependpath]$CONDA/bin"
sudo chown -R $USER $CONDA
displayName: Add conda to PATH
condition: eq( variables['Agent.OS'], 'Darwin')
- powershell: Write-Host "##vso[task.prependpath]$env:CONDA\Scripts"
displayName: Add conda to PATH
condition: eq( variables['Agent.OS'], 'Windows_NT')
# Setup the conda environment and install the needed packages (use conda-forge)
#- task: CondaEnvironment@1
# displayName: 'Install Conda and packages'
# inputs:
# packageSpecs: 'python=3 numpy=1.15.* pyside pytest pip python-dateutil requests setuptools pyinstaller'
# installOptions: '-q -c conda-forge'
# environmentName: 'test-env'
# createCustomEnvironment: true
- script: conda env create --quiet --file environment.yml
displayName: Create Anaconda environment (*nix)
condition: or( eq( variables['Agent.OS'], 'Darwin' ), eq( variables['Agent.OS'], 'Linux' ))
- script: conda env create --quiet --file ci/env-win-binary.yml
displayName: Create Anaconda environment (Windows)
condition: eq( variables['Agent.OS'], 'Windows_NT')
# Output the conda environment packages and which python and pip is being used (for diagnostic purposes)
- script: which python & which pip & which pyinstaller & conda list
displayName: "Show python and conda configuration"
# Install and test scripts for Ubuntu/Linuxs
- script: |
source activate devel
pip install -e . # Install the
Xvfb :99 -screen 0 $(screen_w)x$(screen_h)x$(screen_d) & # Spin up a virtual screen with the correct dimensions
export DISPLAY=:99 # Set up the DISPLAY variable
sleep 3 # give xvfb some time to start
xdpyinfo | grep dimensions # Check display dimensions
python ci/screen.py # Check display dimensions as seen by PySide
pytest -v --junitxml=junit/test-results.xml
mv examples/data/14061619.png examples/data/14061619_linux.png
displayName: "Installing code and running tests (Linux)"
condition: eq( variables['Agent.OS'], 'Linux')
# Install and test scripts for macOS
#
# Unable to handle the screen resolution changes in macOS
# Must use sudo for python-dependent stuff because conda permissions have
# stupid bug under macOS.
- script: |
source activate devel
conda install -y -q -c anaconda python.app
which python.app
ls /usr/local/miniconda/python.app/Contents/Resources
system_profiler SPDisplaysDataType | grep Resolution # Check display dimensions using OS tools
python ci/screen.py # Check display dimensions as seen by PySide
pip install -e .
sudo pytest -v --junitxml=junit/test-results.xml
sudo mv examples/data/14061619.png examples/data/14061619_mac.png
cd runsharp
pyinstaller SHARPpy-osx.spec --noconsole --onefile --log-level DEBUG
cd ..
#sudo chmod 777 dist/SHARPpy.app
#cd runsharp
#ls -lh dist
displayName: "Installing code and running tests (macOS)"
condition: eq( variables['Agent.OS'], 'Darwin')
# Set display resolution on Windows
- powershell: |
iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/set-screenresolution.ps1'))
Set-ScreenResolution $(screen_w) $(screen_h)
displayName: "Run Powershell script to set Windows screen size"
condition: eq( variables['Agent.OS'], 'Windows_NT')
# Install and test scripts for Windows
- script: |
call activate devel
python ci/screen.py
python -c "import ssl; print(ssl.__file__)"
#SET PYTHONPATH=%PYTHONPATH%;%CD%
pip install -e .
pytest -v --junitxml=junit/test-results.xml
move examples\\data\\14061619.png examples\\data\\14061619_win.png
cd runsharp
pyinstaller SHARPpy-win7-64.spec --log-level DEBUG
cd ..
displayName: "Installing code and running tests (Windows)"
condition: eq( variables['Agent.OS'], 'Windows_NT')
# Publish test results to Azure Pipelines
- task: PublishTestResults@2
condition: succeededOrFailed()
inputs:
testResultsFiles: '**/test-*.xml'
testRunTitle: 'Publish test results for $(Agent.OS)'
# Zipping Windows files
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: runsharp/dist/SHARPpy.exe
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/SHARPpy-win-64.zip'
displayName: "Zipping Windows .exe"
condition: eq( variables['Agent.OS'], 'Windows_NT')
# Zipping MacOS .app
- task: ArchiveFiles@2
inputs:
rootFolderOrFile: runsharp/dist/SHARPpy.app
archiveType: zip
archiveFile: '$(Build.ArtifactStagingDirectory)/SHARPpy-osx-64.zip'
displayName: "Zipping macOS .app"
condition: eq( variables['Agent.OS'], 'Darwin')
# Wait till the ArtifactStagingDirectory has both zip files using Python.
#- script: python ci/check_artifact_dir.py
# displayName: "Waiting till all artifacts needed for Github Releases have been built."
# Deploy to Github Releases
- task: GithubRelease@0
inputs:
gitHubConnection: releases
repositoryName: sharppy/SHARPpy
action: 'edit' # Options: create, edit, discard
target: '$(build.sourceVersion)' # Required when action == create || action == edit
tagSource: 'manual' # Required when action == create. Options: auto, manual
tag: azure-test # Required when action == edit || action == discard || tagSource == manual
title: # Optional
#releaseNotesSource: 'file' # Optional. Options: file, input
#releaseNotesFile: # Optional
#releaseNotes: # Optional
assetUploadMode: 'replace' # Optional. Options: delete, replace
isDraft: true # Optional
isPreRelease: true # Optional
addChangeLog: true # Optional
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/')
# Copy GUI screenshots to the artifacts directory
- task: CopyFiles@2
inputs:
contents: examples/data/14*.png
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: "Copy screenshots to staging directory"
# Copy PyInstaller build leftovers the artifacts directory
- task: CopyFiles@2
inputs:
contents: runsharp/build/**/*
targetFolder: $(Build.ArtifactStagingDirectory)
displayName: "Copy PyInstaller build artifacts to staging dir"
# Publish those artifacts for this build so testers can view them.
- task: PublishBuildArtifacts@1
inputs:
artifactName: 'screenshots'
targetPath: $(Build.ArtifactStagingDirectory)/examples/data
displayName: "Publishing screenshots"
# Publish those artifacts for this build so testers can view them.
- task: PublishBuildArtifacts@1
inputs:
artifactName: 'pyinstaller'
targetPath: $(Build.ArtifactStagingDirectory)/build
displayName: "Publishing PyInstaller build artifacts"
# Old code trying to change the macOS display resolution (didn't work)
# sudo brew cask install xquartz
# sudo python ci/screen.py
# sudo chmod +x ci/cscreen
# ./ci/cscreen -v
# ./ci/cscreen -x $(screen_w) -y $(screen_h) -d $(screen_d) -f -s a
# Could try Xvfb that comes distributed with xquartz, but
# since we develop on macOS we really care more about how
# SHARPpy behaves on Windows and Linux.
#