代码拉取完成,页面将自动刷新
version: 1.0.{build}
image: Visual Studio 2019
services:
- postgresql12
- docker
build_script:
- ps: >-
# Create directories for tablespaces
New-Item -ItemType directory -Path "C:\Users\$env:UserName\Documents\tablespace1"
New-Item -ItemType directory -Path "C:\Users\$env:UserName\Documents\tablespace2"
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 passworkd 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'"
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" "log_min_messages='debug5'"
Set-Content "C:\Program Files\postgresql\12\data\pg_hba.conf" "host all all ::1/128 trust"
Add-Content "C:\Program Files\postgresql\12\data\pg_hba.conf" "host all all 127.0.0.1/32 trust"
# build timescale
.\bootstrap -DUSE_OPENSSL=0 -DPG_PATH="C:\Program Files\PostgreSQL\12" -DREGRESS_CHECKS=OFF -DCMAKE_BUILD_TYPE=Debug -DCMAKE_CONFIGURATION_TYPES=Debug -DCMAKE_C_FLAGS=/MP
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 --env POSTGRES_HOST_AUTH_METHOD=trust postgres:12.2-alpine
docker exec -it pgregress /bin/bash -c "apk add --no-cache --virtual .build-deps coreutils dpkg-dev findutils gcc libc-dev make util-linux-dev diffutils cmake bison flex curl git openssl-dev openssl postgresql-dev~=12.2"
docker exec -it pgregress /bin/bash -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 -DREGRESS_CHECKS=OFF -DPG_REGRESS=/usr/local/bin/pg_regress -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="bgw_db_scheduler chunk_utils loader" -e TEST_TABLESPACE1_PATH="C:\Users\$env:UserName\Documents\tablespace1\" -e TEST_TABLESPACE2_PATH="C:\Users\$env:UserName\Documents\tablespace2\" -e TEST_SPINWAIT_ITERS=10000 -e USER=postgres -e PG_REGRESS_OPTS="--bindir=/usr/local/bin/" -it pgregress /bin/bash -c "cd /timescaledb/build && make regresschecklocal"
$TESTS1 = $?
# Normally we use different config files for apache and enterprise tests, but Windows was having problems with that
# Thus, just append the license key to the regular config file instead
Add-Content "C:\Program Files\postgresql\12\data\postgresql.conf" "timescaledb.license_key = 'E1eyJlbmRfdGltZSI6IjIwMTgtMTAtMDEgKzAwMDAiLCAic3RhcnRfdGltZSI6IjIwMTgtMDktMDEgKzAwMDAiLCAiaWQiOiI0OTBGQjI2MC1BMjkyLTRBRDktOUFBMi0wMzYwODM1NzkxQjgiLCAia2luZCI6InRyaWFsIn0K'"
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="compression_algos continuous_aggs_bgw remote_connection remote_txn" -e TEST_TABLESPACE1_PATH="C:\Users\$env:UserName\Documents\tablespace1\" -e TEST_TABLESPACE2_PATH="C:\Users\$env:UserName\Documents\tablespace2\" -e TEST_SPINWAIT_ITERS=10000 -e USER=postgres -e PG_REGRESS_OPTS="--bindir=/usr/local/bin/" -it pgregress /bin/bash -c "cd /timescaledb/build && make regresschecklocal-t"
if( -not $? -or -not $TESTS1 ) { exit 1 }
on_failure:
- ps: >-
docker exec -it pgregress cat /timescaledb/build/test/regression.diffs /timescaledb/build/tsl/test/regression.diffs /timescaledb/build/test/pgtest/regressions.diffs
Get-Content -Path "C:\Program Files\postgresql\12\data\pg_log\*"
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。