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

Add a workflow to build and test probackup on Windows#484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
kulaginm merged 2 commits intorelease_2_5_6fromadd-win-tests
May 26, 2022
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions.github/workflows/build.yml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
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:LC_MESSAGES = "English"
$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"
If (!$Env:MODE -Or $Env:MODE -Eq "basic") {
$Env:PG_PROBACKUP_TEST_BASIC = "ON"
python -m unittest -v tests
python -m unittest -v tests.init
} else {
python -m unittest -v tests.$Env:MODE
}

12 changes: 6 additions & 6 deletionsgen_probackup_project.pl
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,11 +13,11 @@ BEGIN
{
$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 "Maybeneedinputthisbefore:\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 needto runthisfirst:\n";
print STDERR "CALL \"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Auxiliary\\Build\\vcvarsall.bat\" amd64\n";
exit 1;
}
}
Expand DownExpand Up@@ -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);

Expand Down
6 changes: 1 addition & 5 deletionstests/helpers/ptrack_helpers.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -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,
Expand Down
5 changes: 3 additions & 2 deletionstests/validate.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -2,6 +2,7 @@
import unittest
from .helpers.ptrack_helpers import ProbackupTest, ProbackupException
from datetime import datetime, timedelta
from pathlib import Path
import subprocess
from sys import exit
import time
Expand DownExpand Up@@ -58,7 +59,7 @@ def test_basic_validate_nullified_heap_page_backup(self):
with open(log_file_path) as f:
log_content = f.read()
self.assertIn(
'File: "{0}" blknum 1, empty page'.format(file),
'File: "{0}" blknum 1, empty page'.format(Path(file).as_posix()),
log_content,
'Failed to detect nullified block')

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

[8]ページ先頭

©2009-2025 Movatter.jp