Support Postgresql 17. #202
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Run Windows Tests | |
on: [push, pull_request] | |
jobs: | |
build: | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
pg-version: | |
- 9.3.25-1 | |
- 9.4.26-1 | |
- 9.5.25-1 | |
- 9.6.24-1 | |
- 10.23-1 | |
- 11.21-1 | |
- 12.16-1 | |
- 13.12-1 | |
- 14.9-1 | |
- 15.4-1 | |
- 16.0-1 | |
- 17.0-1 | |
platform: | |
- x64 | |
include: | |
- pg-version: 9.3.25-1 | |
platform: x86 | |
- pg-version: 9.4.26-1 | |
platform: x86 | |
- pg-version: 9.5.25-1 | |
platform: x86 | |
- pg-version: 9.6.24-1 | |
platform: x86 | |
- pg-version: 10.23-1 | |
platform: x86 | |
steps: | |
- name: Install PostgreSQL | |
run: | | |
$ErrorActionPreference = "Stop" | |
$pg_full_version = "${{ matrix.pg-version }}" | |
$pg_version = $pg_full_version.Substring(0, $pg_full_version.lastIndexOf('.')) | |
if ("${{ matrix.platform }}" -eq "x64") { | |
$x64 = "-x64" | |
$pg_root = "C:\Program Files\PostgreSQL\$pg_version" | |
$release_dir = "x64\Release" | |
} else { | |
$pg_root = "C:\Program Files (x86)\PostgreSQL\$pg_version" | |
$release_dir = "Release" | |
} | |
if (("$pg_version" -eq "9.3") -or ("$pg_version" -eq "9.4")) { | |
$psql_opt = "--psqldir" | |
} else { | |
$psql_opt = "--bindir" | |
} | |
if ("$pg_version" -eq "14") { | |
& "C:\Program Files\PostgreSQL\14\uninstall-postgresql.exe" --mode unattended 2>&1 | Out-Default | |
Remove-Item -Recurse -Force "C:\Program Files\PostgreSQL\14" | |
} | |
"PG_VERSION=$pg_version" >> $env:GITHUB_ENV | |
"PG_ROOT=$pg_root" >> $env:GITHUB_ENV | |
"X64=$x64" >> $env:GITHUB_ENV | |
"RELEASE_DIR=$release_dir" >> $env:GITHUB_ENV | |
"PSQL_OPT=$psql_opt" >> $env:GITHUB_ENV | |
if ("$pg_version" -eq "17") { | |
"PG_REGRESS=$pg_root\lib\pgxs\src\test\regress\pg_regress.exe" >> $env:GITHUB_ENV | |
} else { | |
"PG_REGRESS=$pg_root\bin\pg_regress.exe" >> $env:GITHUB_ENV | |
} | |
Invoke-webrequest -uri https://get.enterprisedb.com/postgresql/postgresql-${pg_full_version}-windows${x64}.exe -OutFile postgresql.exe | |
if ("$pg_version" -eq "9.6") { | |
& ".\postgresql.exe" --unattendedmodeui none --mode unattended --superpassword password --servicepassword password --install_runtimes 0 2>&1 | Out-Default | |
} else { | |
& ".\postgresql.exe" --unattendedmodeui none --mode unattended --superpassword password --servicepassword password 2>&1 | Out-Default | |
} | |
- uses: actions/checkout@v3 | |
- uses: microsoft/[email protected] | |
- name: Build app for release | |
run: | | |
msbuild temporal_tables.vcxproj -t:rebuild -verbosity:minimal -property:Configuration=Release -property:Platform=${{ matrix.platform }} -property:PlatformToolset=v143 | |
env: | |
pgversion: ${{ matrix.pg-version }} | |
pgroot: ${{ env.PG_ROOT }} | |
- name: Run Tests | |
run: | | |
$ErrorActionPreference = "Stop" | |
Stop-Service -Name "postgresql$env:X64-$env:PG_VERSION" | |
Copy ".\$env:RELEASE_DIR\temporal_tables.dll" "$env:PG_ROOT\lib" | |
Copy ".\*.sql" "$env:PG_ROOT\share\extension" | |
Copy ".\*.control" "$env:PG_ROOT\share\extension" | |
Set-Content -path pg.pass -value $env:PGPASSWORD -encoding ascii | |
& "$env:PG_ROOT\bin\initdb.exe" -A md5 -U postgres --pwfile=pg.pass C:\pgdata 2>&1 | Out-Default | |
& "$env:PG_ROOT\bin\pg_ctl.exe" register -S demand -N "postgresql$env:X64-$env:PG_VERSION" -D c:\pgdata 2>&1 | Out-Default | |
Start-Service -Name "postgresql$env:X64-$env:PG_VERSION" | |
Get-ChildItem "$env:PG_REGRESS" | |
& "C:\Program Files\PostgreSQL\17\lib\pgxs\src\test\regress\pg_regress.exe" --help 2>&1 | Out-Default | |
& "$env:PG_REGRESS" "$env:PSQL_OPT=$env:PG_ROOT\bin" --dbname=pl_regression install no_system_period invalid_system_period no_history_table no_history_system_period invalid_types invalid_system_period_values versioning versioning_custom_system_time structure uninstall 2>&1 | Out-Default | |
if ($LASTEXITCODE -ne 0) { | |
Get-Content -Path ".\regression.diffs" | Out-Printer | |
Write-Error "Tests failed" | |
} | |
env: | |
PGUSER: postgres | |
PGPASSWORD: password | |
- name: Package Artifacts | |
if: startsWith(github.ref, 'refs/tags/') | |
run: | | |
$ErrorActionPreference = "Stop" | |
New-Item -ItemType Directory -Force -Path .\package\lib | |
New-Item -ItemType Directory -Force -Path .\package\share\extension | |
Copy ".\LICENSE" ".\package\TEMPORAL_TABLES_LICENSE" | |
Copy ".\$env:RELEASE_DIR\temporal_tables.dll" ".\package\lib" | |
Copy ".\*.sql" ".\package\share\extension" | |
Copy ".\*.control" ".\package\share\extension" | |
Compress-Archive -Path ".\package\*" -DestinationPath temporal_tables-pg${{ env.PG_VERSION }}-${{ matrix.platform }}.zip | |
- name: Deploy Artifacts | |
uses: softprops/action-gh-release@v1 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
temporal_tables-pg${{ env.PG_VERSION }}-${{ matrix.platform }}.zip |