Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0b5b37e

Browse files
asavchkovpostgres-devkulaginm
authored
Add a workflow to build and test probackup on Windows (#484)
* Add a workflow to build and test probackup on Windows* [PBCKP-149] fix test_basic_validate_nullified_heap_page_backup for windowsCo-authored-by: Alexey Savchkov <a.savchkov@postgrespro.ru>Co-authored-by: Mikhail A. Kulagin <m.kulagin@postgrespro.ru>
1 parent68b77a0 commit0b5b37e

File tree

4 files changed

+104
-13
lines changed

4 files changed

+104
-13
lines changed

‎.github/workflows/build.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name:Build Probackup
2+
3+
on:
4+
push:
5+
branches:
6+
-"**"
7+
# Runs triggered by pull requests are disabled to prevent executing potentially unsafe code from public pull requests
8+
# pull_request:
9+
# branches:
10+
# - main
11+
12+
# Allows you to run this workflow manually from the Actions tab
13+
workflow_dispatch:
14+
15+
jobs:
16+
17+
build-win2019:
18+
19+
runs-on:
20+
-windows-2019
21+
22+
env:
23+
zlib_dir:C:\dep\zlib
24+
25+
steps:
26+
27+
-uses:actions/checkout@v2
28+
29+
-name:Install pacman packages
30+
run:|
31+
$env:PATH += ";C:\msys64\usr\bin"
32+
pacman -S --noconfirm --needed bison flex
33+
34+
-name:Make zlib
35+
run:|
36+
git clone -b v1.2.11 --depth 1 https://github.com/madler/zlib.git
37+
cd zlib
38+
cmake -DCMAKE_INSTALL_PREFIX:PATH=C:\dep\zlib -G "Visual Studio 16 2019" .
39+
cmake --build . --config Release --target ALL_BUILD
40+
cmake --build . --config Release --target INSTALL
41+
copy C:\dep\zlib\lib\zlibstatic.lib C:\dep\zlib\lib\zdll.lib
42+
copy C:\dep\zlib\bin\zlib.dll C:\dep\zlib\lib
43+
44+
-name:Get Postgres sources
45+
run:git clone -b REL_14_STABLE https://github.com/postgres/postgres.git
46+
47+
# Copy ptrack to contrib to build the ptrack extension
48+
# Convert line breaks in the patch file to LF otherwise the patch doesn't apply
49+
-name:Get Ptrack sources
50+
run:|
51+
git clone -b master --depth 1 https://github.com/postgrespro/ptrack.git
52+
Copy-Item -Path ptrack -Destination postgres\contrib -Recurse
53+
(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
54+
cd postgres
55+
git apply -3 ../ptrack/patches/REL_14_STABLE-ptrack-core.diff
56+
57+
-name:Build Postgres
58+
run:|
59+
$env:PATH += ";C:\msys64\usr\bin"
60+
cd postgres\src\tools\msvc
61+
(Get-Content config_default.pl) -Replace "zlib *=>(.*?)(?=,? *#)", "zlib => '${{ env.zlib_dir }}'" | Set-Content config.pl
62+
cmd.exe /s /c "`"C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat`" amd64 && .\build.bat"
63+
64+
-name:Build Probackup
65+
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"
66+
67+
-name:Install Postgres
68+
run:|
69+
cd postgres
70+
src\tools\msvc\install.bat postgres_install
71+
72+
-name:Install Testgres
73+
run:|
74+
git clone -b no-port-for --single-branch --depth 1 https://github.com/postgrespro/testgres.git
75+
cd testgres
76+
python setup.py install
77+
78+
# Grant the Github runner user full control of the workspace for initdb to successfully process the data folder
79+
-name:Test Probackup
80+
run:|
81+
icacls.exe "${{ github.workspace }}" /grant "${env:USERNAME}:(OI)(CI)F"
82+
$env:PATH += ";${{ github.workspace }}\postgres\postgres_install\lib;${{ env.zlib_dir }}\lib"
83+
$Env:LC_MESSAGES = "English"
84+
$Env:PG_CONFIG = "${{ github.workspace }}\postgres\postgres_install\bin\pg_config.exe"
85+
$Env:PGPROBACKUPBIN = "${{ github.workspace }}\postgres\Release\pg_probackup\pg_probackup.exe"
86+
$Env:PG_PROBACKUP_PTRACK = "ON"
87+
If (!$Env:MODE -Or $Env:MODE -Eq "basic") {
88+
$Env:PG_PROBACKUP_TEST_BASIC = "ON"
89+
python -m unittest -v tests
90+
python -m unittest -v tests.init
91+
} else {
92+
python -m unittest -v tests.$Env:MODE
93+
}
94+

‎gen_probackup_project.pl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ BEGIN
1313
{
1414
$pgsrc =shift@ARGV;
1515
if($pgsrceq"--help"){
16-
printSTDERR"Usage$0 pg-source-dir\n";
17-
printSTDERR"Like this:\n";
18-
printSTDERR"$0 C:/PgProject/postgresql.10dev/postgrespro\n";
19-
printSTDERR"Maybeneedinputthisbefore:\n";
20-
printSTDERR"CALL\"C:\\Program Files (x86)\\Microsoft Visual Studio 12.0\\VC\\vcvarsall\" amd64\n";
16+
printSTDERR"Usage$0 pg-source-dir\n";
17+
printSTDERR"Like this:\n";
18+
printSTDERR"$0 C:/PgProject/postgresql.10dev/postgrespro\n";
19+
printSTDERR"May needto runthisfirst:\n";
20+
printSTDERR"CALL\"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" amd64\n";
2121
exit 1;
2222
}
2323
}
@@ -133,7 +133,7 @@ sub build_pgprobackup
133133
unless (-d'src/tools/msvc' &&-d'src');
134134

135135
# my $vsVersion = DetermineVisualStudioVersion();
136-
my$vsVersion ='12.00';
136+
my$vsVersion ='16.00';
137137

138138
$solution = CreateSolution($vsVersion,$config);
139139

‎tests/helpers/ptrack_helpers.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,7 @@ def dir_files(base_dir):
8989

9090
defis_enterprise():
9191
# pg_config --help
92-
ifos.name=='posix':
93-
cmd= [os.environ['PG_CONFIG'],'--help']
94-
95-
elifos.name=='nt':
96-
cmd= [[os.environ['PG_CONFIG']], ['--help']]
92+
cmd= [os.environ['PG_CONFIG'],'--help']
9793

9894
p=subprocess.Popen(
9995
cmd,

‎tests/validate.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
importunittest
33
from .helpers.ptrack_helpersimportProbackupTest,ProbackupException
44
fromdatetimeimportdatetime,timedelta
5+
frompathlibimportPath
56
importsubprocess
67
fromsysimportexit
78
importtime
@@ -58,7 +59,7 @@ def test_basic_validate_nullified_heap_page_backup(self):
5859
withopen(log_file_path)asf:
5960
log_content=f.read()
6061
self.assertIn(
61-
'File: "{0}" blknum 1, empty page'.format(file),
62+
'File: "{0}" blknum 1, empty page'.format(Path(file).as_posix()),
6263
log_content,
6364
'Failed to detect nullified block')
6465

@@ -4247,4 +4248,4 @@ def test_no_validate_tablespace_map(self):
42474248
# 715 MAXALIGN(header.compressed_size), in);
42484249
# 716 if (read_len != MAXALIGN(header.compressed_size))
42494250
# -> 717 elog(ERROR, "cannot read block %u of \"%s\" read %lu of %d",
4250-
# 718 blknum, file->path, read_len, header.compressed_size);
4251+
# 718 blknum, file->path, read_len, header.compressed_size);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp