加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
appveyor.yml 9.81 KB
一键复制 编辑 原始数据 按行查看 历史
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\_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 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/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" "log_min_messages='debug5'"
# 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 -DTAP_CHECKS=OFF
# 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 -DREGRESS_CHECKS=OFF -DPG_REGRESS=/usr/local/bin/pg_regress -DTEST_PGHOST=docker.for.win.localhost -DTEST_PGPORT_LOCAL=55432 -DTAP_CHECKS=OFF"
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 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 continuous_aggs_bgw debug_notice ordered_append_join-12 remote_connection remote_txn " -e SKIPS="bgw_db_scheduler" -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\*"
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化