Skip to content

Commit

Permalink
Add appveyor.yml
Browse files Browse the repository at this point in the history
After this commit AppVeyor will run all TimescaleDB tests on windows
  • Loading branch information
JLockerman authored and RobAtticus committed Dec 4, 2018
1 parent 73e0b4f commit 29eb30e
Show file tree
Hide file tree
Showing 2 changed files with 153 additions and 0 deletions.
150 changes: 150 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
version: 1.0.{build}
image: Visual Studio 2017
services:
- postgresql101
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-10 should start out running"
Get-Service -Name "postgresql-x64-10"
Write-Output "If the binary for postgres in not in 'C:\Program Files\postgresql\10' the rest of this script won't work"
reg query "HKLM\System\CurrentControlSet\Services\postgresql-x64-10" /v "ImagePath"
Stop-Service postgresql-x64-10
# postgresql-x64-10 should stop
Get-Service -Name "postgresql-x64-10"
# we preload timescale, and allow all netowrk connections to postgres
Add-Content "C:\Program Files\postgresql\10\data\postgresql.conf" "shared_preload_libraries = 'timescaledb'"
Add-Content "C:\Program Files\postgresql\10\data\postgresql.conf" "log_directory = 'pg_log'"
Add-Content "C:\Program Files\postgresql\10\data\postgresql.conf" "max_worker_processes=16"
# TODO removing the following line causes a stack overflow on appveyor
Add-Content "C:\Program Files\postgresql\10\data\postgresql.conf" "timescaledb.telemetry_level='off'"
# Add-Content "C:\Program Files\postgresql\10\data\postgresql.conf" "log_min_messages='debug5'"
Set-Content "C:\Program Files\postgresql\10\data\pg_hba.conf" "host all all ::1/128 trust"
Add-Content "C:\Program Files\postgresql\10\data\pg_hba.conf" "host all all 127.0.0.1/32 trust"
# build timescale
.\bootstrap -DPG_PATH="C:\Program Files\PostgreSQL\10" -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-10
Get-Service -Name "postgresql-x64-10"
# create pg user root b/c docker will need it
& "C:\Program Files\PostgreSQL\10\bin\psql.exe" -a -e -E -v "VERBOSITY=verbose" -c 'CREATE USER root WITH SUPERUSER IN ROLE postgres;' -U postgres
& "C:\Program Files\PostgreSQL\10\bin\psql.exe" -a -e -E -v "VERBOSITY=verbose" -c 'CREATE USER super_user WITH SUPERUSER IN ROLE postgres;' -U postgres
& "C:\Program Files\PostgreSQL\10\bin\psql.exe" -a -e -E -v "VERBOSITY=verbose" -c 'show log_directory' -U postgres
& "C:\Program Files\PostgreSQL\10\bin\psql.exe" -a -e -E -v "VERBOSITY=verbose" -c 'show log_destination;' -U postgres
& "C:\Program Files\PostgreSQL\10\bin\psql.exe" -a -e -E -v "VERBOSITY=verbose" -c 'show logging_collector;' -U postgres
docker-switch-linux
# docker run -d --name pgregress -v c:/projects/timescaledb:/timescale timescaledev/postgresdev:exec_backend-10-alpine
docker run -d --name pgregress timescaledev/postgresdev:exec_backend-10-alpine
docker exec -it pgregress /bin/bash -c "apk add cmake git diffutils"
# 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 -DPG_REGRESS=/usr/local/bin/pg_regress -DTEST_PGHOST=docker.for.win.localhost"
test_script:
- ps: >-
Set-PSDebug -Trace 1
Get-Service -Name "postgresql-x64-10"
docker exec -it pgregress /bin/bash -c "psql -a -e -E -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 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 -it pgregress /bin/bash -c "cd /timescaledb/build && make regresschecklocal"
#TESTS=drop_extension
on_failure:
- ps: >-
docker exec -it pgregress cat /timescaledb/build/test/regression.diffs /timescaledb/build/test/pgtest/regressions.diffs
Get-Content -Path "C:\Program Files\postgresql\10\data\pg_log\*"
3 changes: 3 additions & 0 deletions test/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ USER=${USER:-`whoami`}
TEST_TABLESPACE1_PATH=${TEST_TABLESPACE1_PATH:-$(mktemp -d 2>/dev/null || mktemp -d -t 'timescaledb_regress')}
TEST_TABLESPACE2_PATH=${TEST_TABLESPACE2_PATH:-$(mktemp -d 2>/dev/null || mktemp -d -t 'timescaledb_regress')}

TEST_SPINWAIT_ITERS=${TEST_SPINWAIT_ITERS:-10}

TEST_ROLE_SUPERUSER=${TEST_ROLE_SUPERUSER:-super_user}
TEST_ROLE_DEFAULT_PERM_USER=${TEST_ROLE_DEFAULT_PERM_USER:-default_perm_user}
TEST_ROLE_DEFAULT_PERM_USER_2=${TEST_ROLE_DEFAULT_PERM_USER_2:-default_perm_user_2}
Expand Down Expand Up @@ -67,6 +69,7 @@ ${PSQL} -U ${TEST_PGUSER} \
-v TEST_TABLESPACE2_PATH=\'${TEST_TABLESPACE2_PATH}\' \
-v TEST_INPUT_DIR=${TEST_INPUT_DIR} \
-v TEST_OUTPUT_DIR=${TEST_OUTPUT_DIR} \
-v TEST_SPINWAIT_ITERS=${TEST_SPINWAIT_ITERS} \
-v ROLE_SUPERUSER=${TEST_ROLE_SUPERUSER} \
-v ROLE_DEFAULT_PERM_USER=${TEST_ROLE_DEFAULT_PERM_USER} \
-v ROLE_DEFAULT_PERM_USER_2=${TEST_ROLE_DEFAULT_PERM_USER_2} \
Expand Down

0 comments on commit 29eb30e

Please sign in to comment.