forked from timescale/timescaledb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
appveyor.yml
217 lines (117 loc) · 9.79 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
version: 1.0.{build}
image: Visual Studio 2019 Preview
services:
- postgresql12
- docker
build_script:
- ps: >-
# Create directories for tablespaces
New-Item -ItemType directory -Path "C:\Users\$env:UserName\Documents\tablespace1\_default"
New-Item -ItemType directory -Path "C:\Users\$env:UserName\Documents\tablespace2\_default"
New-Item -ItemType directory -Path "C:\Users\$env:UserName\Documents\log"
# Permissions for the tablespace dirs will be full access to everyone
$Acl1 = Get-Acl "C:\Users\$env:UserName\Documents\tablespace1"
$Ar1 = New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl1.SetAccessRule($Ar1)
Set-Acl "C:\Users\$env:UserName\Documents\tablespace1" $Acl1
$Acl2 = Get-Acl "C:\Users\$env:UserName\Documents\tablespace2"
$Ar2 = New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl2.SetAccessRule($Ar2)
Set-Acl "C:\Users\$env:UserName\Documents\tablespace2" $Acl2
$Acl3 = Get-Acl "C:\Users\$env:UserName\Documents\log"
$Ar3 = New-Object System.Security.AccessControl.FileSystemAccessRule("everyone","FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
$Acl3.SetAccessRule($Ar3)
Set-Acl "C:\Users\$env:UserName\Documents\tablespace2" $Acl3
# open firewall for docker
New-NetFirewallRule -DisplayName "Allow postgres" -Direction Inbound -Action Allow -Protocol Any -LocalPort Any
# Set user and password for psql
SET PGUSER=postgres
SET PGPASSWORD=Password12!
Write-Output "postgresql-x64-12 should start out running"
Get-Service -Name "postgresql-x64-12"
Write-Output "If the binary for postgres in not in 'C:\Program Files\postgresql\12' the rest of this script won't work"
reg query "HKLM\System\CurrentControlSet\Services\postgresql-x64-12" /v "ImagePath"
Stop-Service postgresql-x64-12
# postgresql-x64-12 should stop
Get-Service -Name "postgresql-x64-12"
# we preload timescale, and allow all netowrk connections to postgres
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "shared_preload_libraries = 'timescaledb'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "port=55432"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "logging_collector = on"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "log_directory = 'pg_log'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "log_line_prefix = '%u [%p] %d '"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "max_worker_processes=16"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "autovacuum=false"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "fsync=false"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "random_page_cost=1.0"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "extra_float_digits=0"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "max_prepared_transactions=100"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "datestyle='postgres'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timezone='US/Pacific'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.last_tuned='1971-02-03 04:05:06.789012 -0300'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.last_tuned_version='0.0.1'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb_telemetry.cloud='ci'"
# NOTE: Removing the following line causes a stack overflow on appveyor
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.telemetry_level='off'"
# Normally we run TSL tests with SSL on and regular non-TSL tests
# with SSL off. Unfortunately, there is no easy way to run each
# suite with different setting with the AppVeyor configuration, so
# we run both suites with SSL off since the loader tests will fail
# otherwise due to different (SSL-specific) errors when a
# connection is terminated.
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "ssl='off'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "ssl_ca_file='C:/projects/timescaledb/build/tsl/test/ts_root.crt'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "ssl_cert_file='C:/projects/timescaledb/build/tsl/test/ts_data_node.crt'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "ssl_key_file='C:/projects/timescaledb/build/tsl/test/ts_data_node.key'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.ssl_dir='C:/projects/timescaledb/build/tsl/test/timescaledb/certs'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.passfile='C:/projects/timescaledb/build/tsl/test/pgpass.conf'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.license = 'apache'"
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "wal_level = 'logical'"
# Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "log_min_messages='debug5'"
# build timescale
.\bootstrap -DUSE_OPENSSL=0 -DPG_PATH="C:\Program Files\PostgreSQL\12" -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CONFIGURATION_TYPES=Debug -DCMAKE_C_FLAGS=/MP
# Filter ssl and local configuration from pg_hba.conf file since
# we have turned off SSL and local (unix domain socket)
# connections are not supported on Windows.
Get-Content "./build/test/pg_hba.conf" | Where-Object {$_ -notmatch "^hostssl|^local"} | Set-Content "C:\Program Files\postgresql\12\data\pg_hba.conf"
Write-Output "Showing pg_hba.conf"
Get-Content "C:\Program Files\postgresql\12\data\pg_hba.conf"
cmake --build ./build --config Debug
cmake --build ./build --config Debug --target install
# postgres should restart
Start-Service postgresql-x64-12
Get-Service -Name "postgresql-x64-12"
# create pg user root b/c docker will need it
& "C:\Program Files\PostgreSQL\12\bin\psql.exe" -a -e -E -p 55432 -v "VERBOSITY=verbose" -c 'CREATE USER root WITH SUPERUSER IN ROLE postgres;' -U postgres
& "C:\Program Files\PostgreSQL\12\bin\psql.exe" -a -e -p 55432 -E -v "VERBOSITY=verbose" -c 'CREATE USER super_user WITH SUPERUSER IN ROLE postgres;' -U postgres
& "C:\Program Files\PostgreSQL\12\bin\psql.exe" -a -e -p 55432 -E -v "VERBOSITY=verbose" -c 'show log_directory' -U postgres
& "C:\Program Files\PostgreSQL\12\bin\psql.exe" -a -e -p 55432 -E -v "VERBOSITY=verbose" -c 'show log_destination;' -U postgres
& "C:\Program Files\PostgreSQL\12\bin\psql.exe" -a -e -p 55432 -E -v "VERBOSITY=verbose" -c 'show logging_collector;' -U postgres
docker-switch-linux
docker run -d --name pgregress alpine:3.12 sh -c "while sleep 3600; do :; done"
docker exec -it pgregress /bin/sh -c "apk add --no-cache --virtual .build-deps bash coreutils findutils gcc libc-dev make util-linux-dev diffutils cmake curl git openssl-dev openssl postgresql-client postgresql-dev"
docker exec -it pgregress /bin/sh -c "ln -s /usr/lib/postgresql/pgxs/src/test/regress/pg_regress /usr/local/bin/pg_regress"
# we clone the current commit in the docker instance to ensure the correct tests run
# (Ideally we'd use the same folder, but that's difficult to set up)
$commit = git rev-parse HEAD
docker exec -it pgregress /bin/bash -c "git clone --depth 1 https://github.com/timescale/timescaledb.git /timescaledb && cd /timescaledb && git fetch -q origin $commit && git checkout -qf FETCH_HEAD"
docker exec -it pgregress /bin/bash -c "cd /timescaledb && ./bootstrap -DCMAKE_BUILD_TYPE=Debug -DTEST_PGHOST=docker.for.win.localhost -DTEST_PGPORT_LOCAL=55432"
test_script:
- ps: >-
Set-PSDebug -Trace 1
Get-Service -Name "postgresql-x64-12"
docker exec -it pgregress /bin/bash -c "psql -a -e -E -p 55432 -U postgres --host='docker.for.win.localhost' -v VERBOSITY=verbose -c'\dx;'"
#right now we only run timescale regression tests, others will be set up later
docker exec -e IGNORES="chunk_utils cluster-12 pg_dump loader" -e TEST_TABLESPACE1_PREFIX="C:\Users\$env:UserName\Documents\tablespace1\" -e TEST_TABLESPACE2_PREFIX="C:\Users\$env:UserName\Documents\tablespace2\" -e TEST_SPINWAIT_ITERS=10000 -e USER=postgres -it pgregress /bin/bash -c "cd /timescaledb/build && make regresschecklocal"
$TESTS1 = $?
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.license = 'timescale'"
Restart-Service postgresql-x64-12
# Windows doesn't support SIGTERM used by the node
# killer. Therefore, we need to ignore the results of the
# remote_connection and remote_txn tests.
docker exec -e IGNORES="bgw_db_scheduler compression_algos cagg_bgw debug_notice ordered_append_join-12 remote_connection" -e SKIPS="bgw_db_scheduler remote_txn" -e TEST_TABLESPACE1_PREFIX="C:\Users\$env:UserName\Documents\tablespace1\" -e TEST_TABLESPACE2_PREFIX="C:\Users\$env:UserName\Documents\tablespace2\" -e TEST_SPINWAIT_ITERS=10000 -e USER=postgres -it pgregress /bin/bash -c "cd /timescaledb/build && make -k regresschecklocal-t regresschecklocal-shared"
if( -not $? -or -not $TESTS1 ) { exit 1 }
on_failure:
- ps: >-
docker exec -it pgregress sh -c 'find /timescaledb/build -name regression.diffs -exec cat {} +'
Get-Content -Path "C:\Program Files\postgresql\12\data\pg_log\*"