Add a probackup build workflow

This commit is contained in:
Alexey Savchkov
2022-03-11 18:02:33 +07:00
parent 0834e54fc3
commit bfefcc5ca0
3 changed files with 96 additions and 11 deletions
+89
View File
@@ -0,0 +1,89 @@
name: Build Probackup
on:
push:
branches:
- "**"
# Runs triggered by pull requests are disabled to prevent executing potentially unsafe code from public pull requests
# pull_request:
# branches:
# - main
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build-win2019:
runs-on:
- windows-2019
env:
zlib_dir: C:\dep\zlib
steps:
- uses: actions/checkout@v2
- name: Install pacman packages
run: |
$env:PATH += ";C:\msys64\usr\bin"
pacman -S --noconfirm --needed bison flex
- name: Make zlib
run: |
git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib.git
cd zlib
cmake -DCMAKE_INSTALL_PREFIX:PATH=C:\dep\zlib -G "Visual Studio 16 2019" .
cmake --build . --config Release --target ALL_BUILD
cmake --build . --config Release --target INSTALL
copy C:\dep\zlib\lib\zlibstatic.lib C:\dep\zlib\lib\zdll.lib
copy C:\dep\zlib\bin\zlib.dll C:\dep\zlib\lib
- name: Get Postgres sources
run: git clone -b REL_14_STABLE https://github.com/postgres/postgres.git
# Copy ptrack to contrib to build the ptrack extension
# Convert line breaks in the patch file to LF otherwise the patch doesn't apply
- name: Get Ptrack sources
run: |
git clone -b master --depth 1 https://github.com/postgrespro/ptrack.git
Copy-Item -Path ptrack -Destination postgres\contrib -Recurse
(Get-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Raw).Replace("`r`n","`n") | Set-Content ptrack\patches\REL_14_STABLE-ptrack-core.diff -Force -NoNewline
cd postgres
git apply -3 ../ptrack/patches/REL_14_STABLE-ptrack-core.diff
- name: Build Postgres
run: |
$env:PATH += ";C:\msys64\usr\bin"
cd postgres\src\tools\msvc
(Get-Content config_default.pl) -Replace "zlib *=>(.*?)(?=,? *#)", "zlib => '${{ env.zlib_dir }}'" | Set-Content config.pl
cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && .\build.bat"
- name: Build Probackup
run: cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && perl .\gen_probackup_project.pl `"${{ github.workspace }}`"\postgres"
- name: Install Postgres
run: |
cd postgres
src\tools\msvc\install.bat postgres_install
- name: Install Testgres
run: |
git clone -b no-port-for --single-branch --depth 1 https://github.com/postgrespro/testgres.git
cd testgres
python setup.py install
# Grant the Github runner user full control of the workspace for initdb to successfully process the data folder
- name: Test Probackup
run: |
icacls.exe "${{ github.workspace }}" /grant "${env:USERNAME}:(OI)(CI)F"
$env:PATH += ";${{ github.workspace }}\postgres\postgres_install\lib;${{ env.zlib_dir }}\lib"
$Env:PG_CONFIG = "${{ github.workspace }}\postgres\postgres_install\bin\pg_config.exe"
$Env:PGPROBACKUPBIN = "${{ github.workspace }}\postgres\Release\pg_probackup\pg_probackup.exe"
$Env:PG_PROBACKUP_PTRACK = "ON"
$Env:PG_PROBACKUP_TEST_BASIC = "ON"
$Env:LC_MESSAGES = "English"
python -m unittest -v tests
+6 -6
View File
@@ -13,11 +13,11 @@ if (($#ARGV+1)==1)
{
$pgsrc = shift @ARGV;
if($pgsrc eq "--help"){
print STDERR "Usage $0 pg-source-dir \n";
print STDERR "Like this: \n";
print STDERR "$0 C:/PgProject/postgresql.10dev/postgrespro \n";
print STDERR "May be need input this before: \n";
print STDERR "CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\vcvarsall\" amd64\n";
print STDERR "Usage $0 pg-source-dir\n";
print STDERR "Like this:\n";
print STDERR "$0 C:/PgProject/postgresql.10dev/postgrespro\n";
print STDERR "May need to run this first:\n";
print STDERR "CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" amd64\n";
exit 1;
}
}
@@ -133,7 +133,7 @@ sub build_pgprobackup
unless (-d 'src/tools/msvc' && -d 'src');
# my $vsVersion = DetermineVisualStudioVersion();
my $vsVersion = '12.00';
my $vsVersion = '16.00';
$solution = CreateSolution($vsVersion, $config);
+1 -5
View File
@@ -89,11 +89,7 @@ def dir_files(base_dir):
def is_enterprise():
# pg_config --help
if os.name == 'posix':
cmd = [os.environ['PG_CONFIG'], '--help']
elif os.name == 'nt':
cmd = [[os.environ['PG_CONFIG']], ['--help']]
cmd = [os.environ['PG_CONFIG'], '--help']
p = subprocess.Popen(
cmd,