forked from postgres-plr/plr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
191 lines (176 loc) · 6.83 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
image: Visual Studio 2015
configuration: Release
platform: x64
clone_depth: 1
environment:
PGUSER: postgres
PGPASSWORD: Password12!
rversion: 4.1.0
matrix:
- pg: master
PlatformToolset: v141
configuration: Debug
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- pg: REL_13_0
PlatformToolset: v141
configuration: Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- pg: REL_12_0
PlatformToolset: v141
configuration: Release
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- pg: 9.6.13-1
PlatformToolset: v120
- pg: 11.11-2
PlatformToolset: v140
- pg: 12.6-2
PlatformToolset: v141
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
- pg: 13.2-2
PlatformToolset: v141
APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
matrix:
allow_failures:
- pg: master
init: # Make %x64% available for caching
- ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
- if %PLATFORM%==x64 ( set pf=%ProgramFiles%&& set x64=-x64) else set pf=%ProgramFiles(x86)%
- set exe=postgresql-%pg%-windows%x64%.exe
- setx /m exe %exe%
install:
- if not exist R-%rversion%-win.exe appveyor downloadfile https://cran.r-project.org/bin/windows/base/old/%rversion%/R-%rversion%-win.exe
- R-%rversion%-win.exe /VERYSILENT
# We could have used RTools many R users have, but let's use msys64 existing on Appveyor intead
#- if not exist Rtools35.exe appveyor downloadfile https://cran.r-project.org/bin/windows/Rtools/Rtools35.exe
#- Rtools35.exe /VERYSILENT
- Set mingw=C:\msys64\mingw
#
# From the EnterpriseDB version name,
# if any, strip off the: right-most part dot, then numbers, then one hyphen, then numbers.
- ps: $env:pgversion = $env:pg -replace "[.]\d+-\d+$", ""
#
- echo pgversion=%pgversion%
- set pgroot=%pf%\PostgreSQL\%pgversion%
- echo %pgroot%
- SET R_HOME=%ProgramFiles%\R\R-%rversion%
- set RBIN=%PLATFORM:x86=i386%
- SET sed=C:\msys64\usr\bin\sed
# R in the path is not required: msvc compilation
# R in the path is required: find Rscript
- set PATH=%R_HOME%\bin\%rbin%;%PATH%
# environment variable "postgresrcroot" is required for msvc.diff.R
- set postgresrcroot=C:\projects\postgresql
- ps: |
# notmatch - if no "dot is found" in pg name, then pg is a: git: branch, tag, or commit.
if ("${env:pg}" -notmatch "[.]") {
$env:Path += ";C:\msys64\usr\bin;C:\msys64\mingw64\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\amd64"
git config --global advice.detachedHead false
#
# git commit
#
if(("${env:pg}" -cmatch "^[a-z0-9]+$") -and ("${env:pghint}" -eq "commit")) {
git clone -q https://git.postgresql.org/git/postgresql.git c:\projects\postgresql
pushd c:\projects\postgresql
git checkout -q ${env:pg} -b ${env:pg}
popd
#
# git branch or tag(detached head)
# PostgreSQL case - git branches and tags have at least one capital letter - but expect mostly CAPS
#
} else {
git clone -q --depth 1 --branch ${env:pg} https://git.postgresql.org/git/postgresql.git c:\projects\postgresql
}
gendef - "$env:R_HOME\bin\$env:rbin\R.dll" > "R$env:PLATFORM.def" 2> $null
lib "/def:R$env:PLATFORM.def" "/out:R$env:PLATFORM.lib" "/MACHINE:$env:PLATFORM"
pushd c:\projects\postgresql
cmd /c mklink /J contrib\plr $env:APPVEYOR_BUILD_FOLDER
Rscript --vanilla "${env:APPVEYOR_BUILD_FOLDER}\msvc.diff.R"
perl contrib\plr\buildsetup.pl
popd
$env:PROJ="C:\projects\postgresql\pgsql.sln"
$env:dll="c:\projects\postgresql\$env:CONFIGURATION\plr\plr.dll"
} else {
$env:PROJ="plr.vcxproj"
$env:dll="$($env:PLATFORM.replace('x86', '.'))\$env:CONFIGURATION\plr.dll"
if (-not (Test-Path "$env:pgroot\bin")) {
if (-not (Test-Path "$env:exe")) {
Start-FileDownload "http://get.enterprisedb.com/postgresql/$env:exe"
}
& ".\$env:exe" --unattendedmodeui none --mode unattended --superpassword "$env:PGPASSWORD" --servicepassword "$env:PGPASSWORD" | Out-Null
Stop-Service "postgresql$env:x64-$env:pgversion"
}
}
#on_finish:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))
cache:
- '%exe%'
- R-%rversion%-win.exe
build_script:
- msbuild /p:PlatformToolset=%PlatformToolset% /p:configuration=%CONFIGURATION% /p:platform=%PLATFORM%
%PROJ%
/verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
after_build:
- appveyor AddMessage Packing -Category Information
- md tmp\share\extension
- copy *.sql tmp\share\extension\
- copy *.control tmp\share\extension\
- copy LICENSE tmp\PLR_LICENSE
- md tmp\lib
- md tmp\symbols
- copy %dll% tmp\lib
- copy %dll:.dll=.pdb% tmp\symbols
- set zip=plr-%APPVEYOR_REPO_COMMIT:~0,8%-pg%pgversion%-R%rversion%-%PLATFORM%-%CONFIGURATION%.zip
- 7z a -r %zip% .\tmp\* > nul
- ps: |
if ("$env:pg" -notmatch "[.]") {
pushd c:\projects\postgresql\src\tools\msvc
perl install.pl "$env:pgroot"
popd
}
test_script:
- path %pgroot%\bin;%PATH%
- ps: |
if ("$env:pg" -notmatch "[.]") {
Set-Content -path pg.pass -value "$env:pgpassword" -encoding ascii
initdb -A md5 -U "$env:PGUSER" --pwfile=pg.pass C:\pgdata
pg_ctl register -S demand -N "postgresql$env:x64-$env:pgversion" -D c:\pgdata
} else {
Add-AppveyorMessage "Copying the extension files to the PostgreSQL directories." -Category Information
7z x "$env:zip" "-o$env:pgroot"
}
- appveyor AddMessage "Starting the database server." -Category Information
- setx /M PATH "%R_HOME%\bin\%rbin%;%PATH%"
- net start postgresql%x64%-%pgversion%
- ps: |
Add-AppveyorTest Regression -Framework pg_regress -FileName sql\ -Outcome Running
if (("9.3", "9.4").Contains("$env:pgversion")) {
$env:psqlopt="--psqldir"
} else {
$env:psqlopt="--bindir"
}
$env:Outcome="Passed"
$elapsed=(Measure-Command {
pg_regress "$env:psqlopt=$env:pgroot\bin" --dbname=pl_regression plr `
bad_fun opt_window do out_args plr_transaction opt_window_frame 2>&1 |
%{ if ($_ -is [System.Management.Automation.ErrorRecord]) { $_.Exception.Message } else { $_ } } |
Out-Default
if ($LASTEXITCODE -ne 0) {
$env:Outcome="Failed"
}
}).TotalMilliseconds
Update-AppVeyorTest Regression -Framework pg_regress -FileName sql\ -Outcome "$env:Outcome" -Duration $elapsed
if ("$env:Outcome" -ne "Passed") {
type regression.diffs
$host.SetShouldExit($LastExitCode)
}
artifacts:
- path: '*.zip'
deploy:
provider: GitHub
release: $(appveyor_repo_tag_name)
draft: false
prerelease: false
auth_token:
secure: sFXG3dBiC2S9bnHbDfg2fS0OdaxiSr6fGSlMQvQPb0lJGyKM3E5UZum4rik60zyi
on:
appveyor_repo_tag: true