forked from i-RIC/prepost-gui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
232 lines (205 loc) · 10.7 KB
/
appveyor.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
219
220
221
222
223
224
225
226
227
228
229
230
231
232
version: '{branch}-{build}'
environment:
scharlton2_access_token:
secure: CS9f7K3/ePypXUjKJ5S5iX2WFLNpC0IH4LEC9jYXdvcNbaM7CFl0fU5Ws/qUDgvo
iric_access_token:
secure: WDcJrM7sx9jagk006F3OtXqomb90MlJcRIs8LoAyvT0wVzvG+UxeaW+oG9GWb1t8
kskinoue0612_access_token:
secure: GzdhhFKWjeLDM22U4ZcrMkAGEEnZLMVbfBR9W8uRQ/LqOtvX2qjPXvC3nvxxWeUc
# Skipping commits affecting specific files (GitHub only).
# also can use [skip appveyor] in message to skip building
skip_commits:
files:
- .gitignore
- README.md
- manuals/*
- sdks/*
- tools/*
image: Visual Studio 2013
# called before clone
# Note that environment variables don't seem to transfer correctly from cmd to ps when
# they contain spaces
init:
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
- echo %Configuration%
- if "%Configuration%"=="Debug" (set config=debug)
- if "%Configuration%"=="Release" (set config=release)
- echo %APPVEYOR_BUILD_WORKER_IMAGE%
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2017" ( set generator="Visual Studio 15 2017 Win64" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2015" ( set generator="Visual Studio 14 2015 Win64" )
- if "%APPVEYOR_BUILD_WORKER_IMAGE%"=="Visual Studio 2013" ( set generator="Visual Studio 12 2013 Win64" )
- echo %generator%
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2017") {$env:psgenerator = "Visual Studio 15 2017 Win64"}
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2015") {$env:psgenerator = "Visual Studio 14 2015 Win64"}
- ps: if ($env:APPVEYOR_BUILD_WORKER_IMAGE -eq "Visual Studio 2013") {$env:psgenerator = "Visual Studio 12 2013 Win64"}
- ps: Write-Output $env:psgenerator
## Sometimes the plaintext of secure variables is displayed so filter out access_tokens
- ps: 'Get-ChildItem env: | Where-Object { $_.Name -NotMatch "access_token" }'
# Only commit and push to master branch or debug-appveyor branch (for testing)
- ps: $CommitAndPush = (($env:Configuration -eq "Release") -AND (($env:APPVEYOR_REPO_BRANCH -eq "master") -OR ($env:APPVEYOR_REPO_BRANCH -eq "develop") -OR ($env:APPVEYOR_REPO_BRANCH -eq "issue-destdir")) -AND (!$env:APPVEYOR_PULL_REQUEST_NUMBER))
- ps: Write-Output $CommitAndPush
configuration:
- Debug
- Release
matrix:
fast_finish: true
# Note mkdir is from Git (C:\Program Files\Git\usr\bin\mkdir.exe)
# It might give unexpected results (use md instead)
before_build:
- call C:\Qt\5.5\msvc2013_64\bin\qtenv2.bat
- call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x86_amd64
- cd %APPVEYOR_BUILD_FOLDER%
- curl -L -O https://github.com/i-RIC/iricdev/archive/master.zip
- cd \
- 7z x %APPVEYOR_BUILD_FOLDER%\master.zip
- del %APPVEYOR_BUILD_FOLDER%\master.zip
- cd \iricdev-master
- md lib
- cd lib
- ps: (New-Object Net.WebClient).DownloadFile("https://ci.appveyor.com/api/projects/i-RIC/iricdev/artifacts/lib/install.zip?branch=master&job=Configuration:+Debug", "\iricdev-master\lib\install-Debug.zip")
- ps: (New-Object Net.WebClient).DownloadFile("https://ci.appveyor.com/api/projects/i-RIC/iricdev/artifacts/lib/install.zip?branch=master&job=Configuration:+Release", "\iricdev-master\lib\install-Release.zip")
- md install
- cd install
- 7z x -aoa ..\install-Debug.zip
- 7z x -aoa ..\install-Release.zip
- cd \iricdev-master
- call create-files.cmd
- cd %APPVEYOR_BUILD_FOLDER%
- if not exist libdlls (md libdlls)
- if not exist libdlls\Debug (md libdlls\Debug)
- if not exist libdlls\Release (md libdlls\Release)
- copy /y \iricdev-master\paths.pri .
- copy /y \iricdev-master\dirExt.prop .\tools\data\.
- qmake -recursive -tp vc
build_script:
- msbuild /nologo /verbosity:minimal /maxCpuCount /target:iricGdPolyline /p:Configuration=%Configuration% src.sln
- msbuild /nologo /verbosity:minimal /maxCpuCount /p:Configuration=%Configuration% src.sln
after_build:
- cd %APPVEYOR_BUILD_FOLDER%\tools
- set SAVE_PATH=%PATH%
- set PATH=C:\Python37-x64;%PATH%
- python copydllsExt.py
- python lrelease.py
- set PATH=%SAVE_PATH%
- cd %APPVEYOR_BUILD_FOLDER%
- ps: |
if ($CommitAndPush) {
md $env:APPVEYOR_BUILD_FOLDER\dist\_build
Set-Location $env:APPVEYOR_BUILD_FOLDER\dist\_build -ErrorAction Stop
cmake --version
if ($env:APPVEYOR_REPO_BRANCH -eq "master") {
cmake -DPREPOST_GUI:PATH=$env:APPVEYOR_BUILD_FOLDER -DSRC_FOLDER:STRING=prod_src -G $env:psgenerator ..
} else {
cmake -DPREPOST_GUI:PATH=$env:APPVEYOR_BUILD_FOLDER -DSRC_FOLDER:STRING=dev_src -G $env:psgenerator ..
}
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
artifacts:
# - path: libdlls\$(Configuration)
# name: libdlls-$(Configuration)
# - path: apps\iricgui\$(config)
# name: iricgui-$(Configuration)
on_success:
- ps: |
if ($CommitAndPush) {
# online_update urls
$remote_url_iric = "https://github.com/i-RIC/online_update.git"
$remote_url_scharlton2 = "https://github.com/scharlton2/online_update.git"
$remote_url_kskinoue0612 = "https://github.com/kskinoue0612/online_update.git"
$branch = $True
if ($env:APPVEYOR_REPO_NAME -eq "i-RIC/prepost-gui") {
$remote_url = $remote_url_iric
$access_token = $env:iric_access_token
$branch = $False
}
if ($env:APPVEYOR_REPO_NAME -eq "scharlton2/prepost-gui") {
$remote_url = $remote_url_scharlton2
# online_update_2020_05_17 expires after a year if not used
$access_token = $env:scharlton2_access_token
}
if ($env:APPVEYOR_REPO_NAME -eq "kskinoue0612/prepost-gui") {
$remote_url = $remote_url_kskinoue0612
$access_token = $env:kskinoue0612_access_token
}
Set-Location \ -ErrorAction Stop
git clone -q --branch=master --depth 1 $remote_url online_update 2>&1 | Out-Null
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
Set-Location .\online_update -ErrorAction Stop
if ($branch) {
# create branch when remote is not "i-RIC/prepost-gui"
git checkout -qb $env:APPVEYOR_JOB_ID
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
# update data\definition.xml and meta\package.xml from dev_src\packages\gui.prepost or prod_src\packages\gui.prepost
if ($env:APPVEYOR_REPO_BRANCH -eq "master") {
$v=(Select-String -Path prod_src\packages\gui.prepost\meta\package.xml -Pattern "(?<=<Version>)(.*)(?=</Version>)").Matches.Value -split "\."
$files=@('prod_src\packages\gui.prepost\data\definition.xml', `
'prod_src\packages\gui.prepost\meta\package.xml')
} else {
$v=(Select-String -Path dev_src\packages\gui.prepost\meta\package.xml -Pattern "(?<=<Version>)(.*)(?=</Version>)").Matches.Value -split "\."
$files=@('dev_src\packages\gui.prepost\data\definition.xml', `
'dev_src\packages\gui.prepost\meta\package.xml')
}
$v[3] = 1 + $v[3]
$env:VERSION = $v -join "."
$tokyo_tz = [System.TimeZoneInfo]::FindSystemTimeZoneById("Tokyo Standard Time")
$tokyo_date = [System.TimeZoneInfo]::ConvertTimeFromUtc((Get-Date).ToUniversalTime(), $tokyo_tz)
$env:RELEASE_DATE = $(Get-Date $tokyo_date -Format s).Substring(0,10)
$env:RELEASE = $env:RELEASE_DATE -replace '-', '.'
$env:CAPTION = "iRIC GUI " + $v[0] + "." + $v[1] + "." + $v[2]
foreach ($file in $files) {
(Get-Content $file) | Foreach-Object {
$_ -replace "(?<=<Version>)(.*)(?=</Version>)", "$env:VERSION" `
-replace "`" version=`"([^`"]*)`"", "`" version=`"$env:VERSION`"" `
-replace "(?<=<ReleaseDate>)(.*)(?=</ReleaseDate>)", "$env:RELEASE_DATE" `
-replace "release=`"([^`"]*)`"", "release=`"$env:RELEASE`"" `
-replace "caption=`"([^`"]*)`"", "caption=`"$env:CAPTION`"" `
-replace "github-sha1=`"([^`"]*)`"", "github-sha1=`"$env:APPVEYOR_REPO_COMMIT`""
} | Set-Content $file
}
# distribute files built by prepost-gui
Set-Location $env:APPVEYOR_BUILD_FOLDER\dist\_build -ErrorAction Stop
msbuild /nologo /verbosity:minimal /p:Configuration=Release INSTALL.vcxproj
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
if ($env:APPVEYOR_REPO_BRANCH -eq "master") {
# run repogen to build packages and Updates.xml
Set-Location \online_update\prod_src -ErrorAction Stop
# run repogen
C:\Qt\Tools\QtInstallerFramework\2.0\bin\repogen.exe -p packages --update --include gui.prepost ..\prod
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
} else {
# run repogen to build packages and Updates.xml
Set-Location \online_update\dev_src -ErrorAction Stop
# run repogen
C:\Qt\Tools\QtInstallerFramework\2.0\bin\repogen.exe -p packages --update --include gui.prepost ..\dev
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}
# run normalize_updatexml.py to normalize Updates.xml.
Set-Location \online_update -ErrorAction Stop
py normalize_updatexml.py
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# commit and push to https://github.com/i-RIC/online_update.git
git config --global credential.helper store
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# configure git for commit and push
Add-Content "$HOME\.git-credentials" "https://$($access_token):[email protected]`n" -ErrorAction Stop
git config --global user.email "[email protected]"
git config --global user.name "iric.appveyor"
git config --global core.safecrlf false
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
git add -A *.7z *.sha1 *.xml *.dll *.exe *.qm
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
# Qt dictionaries are now included in gui.runtime package.
git reset **/qt_*.qm
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
git commit -m "built by iric.appveyor"
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
if ($branch) {
git push --set-upstream origin $env:APPVEYOR_JOB_ID 2>&1 | Out-Null
} else {
git push --set-upstream origin master 2>&1 | Out-Null
}
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
git status
if ($LastExitCode -ne 0) { $host.SetShouldExit($LastExitCode) }
}