-
Notifications
You must be signed in to change notification settings - Fork 3
/
azure-pipelines.yml
166 lines (156 loc) · 5.61 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
# Build pipeline for Ubuntu and Windows
trigger:
tags:
include:
- v*
jobs:
- job: 'Windows'
pool:
vmImage: 'windows-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.5'
addToPath: true
- task: DownloadGitHubRelease@0
inputs:
connection: 'Github service connection'
userRepository: 'pyinstaller/pyinstaller'
defaultVersionType: 'specificTag'
version: 'v4.2'
itemPattern: '*.tar.gz'
downloadPath: '$(Pipeline.Workspace)'
- task: ExtractFiles@1
inputs:
archiveFilePatterns: '$(Pipeline.Workspace)\*.tar.gz'
destinationFolder: '$(Pipeline.Workspace)\pyinstaller'
cleanDestinationFolder: true
overwriteExistingFiles: false
- task: CmdLine@2
inputs:
script: |
chdir
python -m pip install --upgrade pip
python -m pip install --upgrade setuptools
python -m pip install matplotlib
python -m pip install PyQt5
cd pyinstaller\pyinstaller-4.2\bootloader
python waf distclean all
cd ..
python setup.py install
workingDirectory: '$(Pipeline.Workspace)'
- task: CmdLine@2
inputs:
script: 'python -m PyInstaller ChronoPlotter.py --onefile -w --icon=images\icon.ico -n ChronoPlotter'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)\s\dist\ChronoPlotter.exe'
artifact: 'build-win'
publishLocation: 'pipeline'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'Github service connection'
repositoryName: 'mncoppola/ChronoPlotter'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(Build.SourceBranchName)'
assets: '$(Pipeline.Workspace)\s\dist\ChronoPlotter.exe'
assetUploadMode: 'replace'
addChangeLog: false
- job: 'MacOS'
pool:
vmImage: 'macos-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.5'
addToPath: true
- task: InstallAppleCertificate@2
inputs:
certSecureFile: 'Certificates.p12'
certPwd: '$(cert_password)'
keychain: 'temp'
- task: CmdLine@2
inputs:
script: |
python -m pip install --upgrade pip
python -m pip install matplotlib
python -m pip install PyQt5
python -m pip install PyInstaller
npm install --global create-dmg
- task: CmdLine@2
inputs:
script: 'python -m PyInstaller ChronoPlotter.py -w --icon=images\icon.icns -n ChronoPlotter --osx-bundle-identifier ChronoPlotter'
- task: CmdLine@2
inputs:
script: |
sed -e s/0.0.0/$(Build.SourceBranchName)/ -i "" Info.plist
chmod +x MacOS/ChronoPlotter
rm -rf MacOS/lib MacOS/include
ln -s ../Resources/lib MacOS/lib
ln -s ../Resources/include MacOS/include
cp $(Pipeline.Workspace)/s/images/icon.icns Resources/imagesicon.icns
workingDirectory: '$(Pipeline.Workspace)/s/dist/ChronoPlotter.app/Contents/'
- task: CmdLine@2
inputs:
script: |
codesign -v -s "$(developer_id)" --options=runtime --deep --entitlements $(Pipeline.Workspace)/s/entitlements.plist ChronoPlotter.app
workingDirectory: '$(Pipeline.Workspace)/s/dist/'
- task: CmdLine@2
inputs:
script: |
create-dmg ChronoPlotter.app --identity="$(developer_id)"
mv "ChronoPlotter $(Build.SourceBranchName).dmg" "ChronoPlotter.dmg"
workingDirectory: '$(Pipeline.Workspace)/s/dist/'
- task: CmdLine@2
inputs:
script: |
RESULT=$(xcrun altool --notarize-app --primary-bundle-id ChronoPlotter -u "$(dev_username)" -p "$(dev_password)" --file "ChronoPlotter.dmg" --output-format xml)
if [ $? -ne 0 ]; then
echo "Submitting for notarization failed 1"
echo "$RESULT"
exit 1
fi
REQUEST_UUID=$(echo "$RESULT" | xpath "//key[normalize-space(text()) = 'RequestUUID']/following-sibling::string[1]/text()" 2> /dev/null)
if [ -z "$REQUEST_UUID" ]; then
echo "Submitting for notarization failed 2"
echo "$RESULT"
exit 1
fi
echo "$RESULT" | xpath "//key[normalize-space(text()) = 'success-message']/following-sibling::string[1]/text()" 2> /dev/null
echo "Submitted notarization request $REQUEST_UUID, waiting for response..."
TOTAL_SLEEP=0
while true
do
sleep 20
TOTAL_SLEEP=$((TOTAL_SLEEP + 20))
RESULT=$(xcrun altool --notarization-info "$REQUEST_UUID" -u "$(dev_username)" -p "$(dev_password)" --output-format xml)
STATUS=$(echo "$RESULT" | xpath "//key[normalize-space(text()) = 'Status']/following-sibling::string[1]/text()" 2> /dev/null)
if [ "$STATUS" = "success" ]; then
echo "Notarization succeeded, $TOTAL_SLEEP sec"
break
elif [ "$STATUS" = "in progress" ]; then
echo "Notarization in progress, $TOTAL_SLEEP sec"
else
echo "Notarization failed"
echo "$RESULT"
exit 1
fi
done
xcrun stapler staple "ChronoPlotter.dmg"
workingDirectory: '$(Pipeline.Workspace)/s/dist/'
- task: PublishPipelineArtifact@1
inputs:
targetPath: '$(Pipeline.Workspace)/s/dist/ChronoPlotter.dmg'
artifact: 'build-macos'
publishLocation: 'pipeline'
- task: GitHubRelease@1
inputs:
gitHubConnection: 'Github service connection'
repositoryName: 'mncoppola/ChronoPlotter'
action: 'edit'
target: '$(Build.SourceVersion)'
tag: '$(Build.SourceBranchName)'
assets: '$(Pipeline.Workspace)/s/dist/ChronoPlotter.dmg'
assetUploadMode: 'replace'
addChangeLog: false