Skip to content

Commit 0201af2

Browse files
gsmolkGrigory Smolkin
authored andcommitted
Basic CI and Readme update (#1)
* update Readme * Moving from Travis to Github-actions CI
1 parent df0cccb commit 0201af2

File tree

10 files changed

+134
-484
lines changed

10 files changed

+134
-484
lines changed

.github/scripts/regression.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
3+
set -xe
4+
5+
echo "############### Testing:"
6+
#echo PG_PROBACKUP_PARANOIA=${PG_PROBACKUP_PARANOIA}
7+
#echo ARCHIVE_COMPRESSION=${ARCHIVE_COMPRESSION}
8+
#echo PGPROBACKUPBIN_OLD=${PGPROBACKUPBIN_OLD}
9+
#echo PGPROBACKUPBIN=${PGPROBACKUPBIN}
10+
#echo PGPROBACKUP_SSH_REMOTE=${PGPROBACKUP_SSH_REMOTE}
11+
#echo PGPROBACKUP_GDB=${PGPROBACKUP_GDB}
12+
#echo PG_PROBACKUP_PTRACK=${PG_PROBACKUP_PTRACK}
13+
14+
export PG_BIN_DIR=${PWD}/pg/${PG_VERSION}
15+
export PG_CONFIG=${PG_BIN_DIR}/bin/pg_config
16+
export PG_PROBACKUP_TEST_BASIC=ON
17+
python3 -m unittest -v tests

.github/scripts/setup.sh

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
#!/usr/bin/env bash
2+
set -xe
3+
4+
if [ -z ${PG_VERSION+x} ]; then
5+
echo PG_VERSION is not set!
6+
exit 1
7+
fi
8+
export PG_BIN_DIR=${PWD}/pg/${PG_VERSION}
9+
10+
#if [ -z ${PG_BRANCH+x} ]; then
11+
# echo PG_BRANCH is not set!
12+
# exit 1
13+
#fi
14+
15+
#if [ -z ${PTRACK_PATCH_PG_BRANCH+x} ]; then
16+
# PTRACK_PATCH_PG_BRANCH=OFF
17+
#fi
18+
19+
# sanitize environment
20+
export DEBIAN_FRONTEND=noninteractive
21+
sudo apt-get update
22+
sudo apt-get purge -y $(dpkg -l | awk '{print$2}' | grep postgres) libpq5 libpq-dev
23+
24+
# install deps
25+
#apt-get install -q -y curl ca-certificates gnupg lsb-release build-essential gcc make zlib1g-dev python3 python3-pip python3-setuptools
26+
sudo apt-get install -q -y gnupg lsb-release build-essential gcc make zlib1g-dev python3 python3-pip python3-setuptools
27+
sudo pip3 install testgres
28+
29+
# Clone Postgres
30+
echo "############### Getting Postgres sources:"
31+
git clone https://github.com/postgres/postgres.git -b $PG_TAG --depth=1
32+
33+
## Clone ptrack
34+
#if [ "$PTRACK_PATCH_PG_BRANCH" != "OFF" ]; then
35+
# git clone https://github.com/postgrespro/ptrack.git -b master --depth=1 postgres/contrib/ptrack
36+
# export PG_PROBACKUP_PTRACK=ON
37+
#else
38+
# export PG_PROBACKUP_PTRACK=OFF
39+
#fi
40+
41+
# Compile and install Postgres
42+
echo "############### Compiling Postgres:"
43+
cd postgres # Go to postgres dir
44+
#if [ "$PG_PROBACKUP_PTRACK" = "ON" ]; then
45+
# git apply -3 contrib/ptrack/patches/${PTRACK_PATCH_PG_BRANCH}-ptrack-core.diff
46+
#fi
47+
CFLAGS="-Og" ./configure --prefix=$PG_BIN_DIR \
48+
--enable-debug --enable-cassert --enable-depend \
49+
--without-readline
50+
make -s -j$(nproc) install
51+
make -s -j$(nproc) -C contrib/ install
52+
53+
# Override default Postgres instance
54+
#export PATH=$PG_BIN_DIR/bin:$PATH
55+
export LD_LIBRARY_PATH=$PG_BIN_DIR/lib
56+
export PG_CONFIG=$PG_BIN_DIR/bin/pg_config
57+
58+
#if [ "$PG_PROBACKUP_PTRACK" = "ON" ]; then
59+
# echo "############### Compiling Ptrack:"
60+
# make -C contrib/ptrack install
61+
#fi
62+
63+
# Get amcheck if missing
64+
if [ ! -d "contrib/amcheck" ]; then
65+
echo "############### Getting missing amcheck:"
66+
git clone https://github.com/petergeoghegan/amcheck.git --depth=1 contrib/amcheck
67+
make -C contrib/amcheck install
68+
fi
69+
70+
# Build and install pg_probackup (using PG_CPPFLAGS and SHLIB_LINK for gcov)
71+
echo "############### Compiling and installing pg_probackup:"
72+
export PG_SRC=$PWD
73+
export PATH=$PG_BIN_DIR/bin:$PATH
74+
cd ..
75+
# make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" top_srcdir=$CUSTOM_PG_SRC install
76+
make USE_PGXS=1 top_srcdir=$PG_SRC
77+
#make USE_PGXS=1 top_srcdir=$PG_SRC install

.github/workflows/build.yml

Lines changed: 12 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,18 @@
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:
1+
name: regression
2+
on: [push]
143

154
jobs:
16-
17-
build-win2019:
18-
19-
runs-on:
20-
- windows-2019
21-
5+
pg-10:
6+
runs-on: ubuntu-18.04
227
env:
23-
zlib_dir: C:\dep\zlib
24-
8+
PG_TAG: REL_10_20
9+
PG_VERSION: 10
2510
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v3
2613

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_test
91-
} else {
92-
python -m unittest -v tests.$Env:MODE
93-
}
14+
- name: Setup
15+
run: .github/scripts/setup.sh
9416

17+
- name: Test
18+
run: .github/scripts/regression.sh

.travis.yml

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)