Skip to content

Commit 2c4157e

Browse files
committed
Update ce from master
1 parent a61df52 commit 2c4157e

10 files changed

+269
-280
lines changed

Diff for: .github/workflows/test.yml

+94
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches:
6+
- "**"
7+
pull_request:
8+
branches:
9+
- main
10+
# Allows you to run this workflow manually from the Actions tab
11+
workflow_dispatch:
12+
13+
jobs:
14+
Test:
15+
strategy:
16+
matrix:
17+
# pg_version: [15]
18+
pg_version: [11, 12, 13, 14, 15]
19+
os: [ubuntu-22.04]
20+
# tests: [tap]
21+
tests: [tap, python]
22+
# test_mode: [normal, legacy, paranoia]
23+
test_mode: [normal, paranoia]
24+
exclude:
25+
- tests: tap
26+
test_mode: paranoia
27+
- tests: python
28+
test_mode: normal
29+
- tests: python
30+
test_mode: legacy
31+
fail-fast: false
32+
name: ${{ format('Ptrack ({0}, PostgreSQL {1}, {2} tests, {3} mode)', matrix.os, matrix.pg_version, matrix.tests, matrix.test_mode) }}
33+
container:
34+
image: ${{ format('ghcr.io/postgres-dev/{0}:1.0', matrix.os) }}
35+
env:
36+
PG_BRANCH: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
37+
PGDATA: $HOME/data
38+
TEST_MODE: ${{ matrix.test_mode }}
39+
options: --privileged
40+
steps:
41+
- name: Get Postgres sources
42+
uses: actions/checkout@v3
43+
with:
44+
repository: postgres/postgres
45+
ref: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
46+
path: postgres
47+
- name: Get Ptrack sources
48+
uses: actions/checkout@v3
49+
with:
50+
path: ptrack
51+
- name: Get Pg_probackup sources
52+
uses: actions/checkout@v3
53+
with:
54+
repository: postgrespro/pg_probackup
55+
path: pg_probackup
56+
- name: Apply ptrack patches
57+
run: make patch top_builddir=../postgres
58+
working-directory: ptrack
59+
- name: Install Postgres
60+
run: |
61+
make install-postgres top_builddir=$GITHUB_WORKSPACE/postgres prefix=$HOME/pgsql &&
62+
echo $HOME/pgsql/bin >> $GITHUB_PATH
63+
working-directory: ptrack
64+
- name: Install Ptrack
65+
run: make install USE_PGXS=1 PG_CPPFLAGS=-coverage SHLIB_LINK=-coverage
66+
working-directory: ptrack
67+
- name: Install Pg_probackup
68+
run: make install-pg-probackup USE_PGXS=1 top_srcdir=../postgres
69+
working-directory: ptrack
70+
shell: bash {0}
71+
- name: Install additional packages
72+
run: |
73+
apt update &&
74+
apt install -y python3-pip python3-six python3-pytest python3-pytest-xdist curl &&
75+
pip3 install --no-input testgres
76+
# All steps have been so far executed by root but ptrack tests run from an
77+
# unprivileged user so change some permissions
78+
- name: Adjust the permissions of ptrack test folders
79+
run: |
80+
mkdir pg_probackup/tests/tmp_dirs
81+
chown -R "dev:" pg_probackup ptrack
82+
- name: Test
83+
run: make test-${{ matrix.tests }} USE_PGXS=1
84+
working-directory: ptrack
85+
shell: runuser dev {0}
86+
- name: Collect coverage results
87+
run: make coverage
88+
working-directory: ptrack
89+
shell: runuser dev {0}
90+
- name: Upload coverage results to Codecov
91+
uses: codecov/codecov-action@v3
92+
with:
93+
working-directory: ptrack
94+
runs-on: ubuntu-latest

Diff for: .travis.yml

-48
This file was deleted.

Diff for: AUTHORS.md

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# Authors
2+
3+
This list is sorted by the number of commits per contributor in _descending_ order.
4+
5+
Avatar|Contributor|Contributions
6+
:-:|---|:-:
7+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/912790?v=4' width='36' height='36' alt='@ololobus'>|[@ololobus](https://github.com/ololobus)|62
8+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/249427?v=4' width='36' height='36' alt='@funny-falcon'>|[@funny-falcon](https://github.com/funny-falcon)|15
9+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/25385449?v=4' width='36' height='36' alt='@alubennikova'>|[@alubennikova](https://github.com/alubennikova)|9
10+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/16117281?v=4' width='36' height='36' alt='@kulaginm'>|[@kulaginm](https://github.com/kulaginm)|5
11+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/10120779?v=4' width='36' height='36' alt='@daniel-95'>|[@daniel-95](https://github.com/daniel-95)|4
12+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/26730675?v=4' width='36' height='36' alt='@ziva777'>|[@ziva777](https://github.com/ziva777)|2
13+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/11221961?v=4' width='36' height='36' alt='@vegebird'>|[@vegebird](https://github.com/vegebird)|2
14+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/86721802?v=4' width='36' height='36' alt='@kovdb75'>|[@kovdb75](https://github.com/kovdb75)|1
15+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/1192276?v=4' width='36' height='36' alt='@MarinaPolyakova'>|[@MarinaPolyakova](https://github.com/MarinaPolyakova)|1
16+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/43462737?v=4' width='36' height='36' alt='@rzharkov'>|[@rzharkov](https://github.com/rzharkov)|1
17+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/2743340?v=4' width='36' height='36' alt='@vbwagner'>|[@vbwagner](https://github.com/vbwagner)|1
18+
<img class='float-left rounded-1' src='https://avatars.githubusercontent.com/u/3983891?v=4' width='36' height='36' alt='@waaeer'>|[@waaeer](https://github.com/waaeer)|1
19+
20+
---
21+
22+
Auto-generated by [gaocegege/maintainer](https://github.com/maintainer-org/maintainer) on 2023-08-03.

Diff for: Dockerfile.in

-25
This file was deleted.

Diff for: Makefile

+60-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
# contrib/ptrack/Makefile
23

34
MODULE_big = ptrack
@@ -15,13 +16,70 @@ TAP_TESTS = 1
1516
# with Mkvcbuild.pm on PGv15+
1617
PG_LIBS_INTERNAL += $(libpq_pgport)
1718

18-
ifdef USE_PGXS
1919
PG_CONFIG ?= pg_config
20+
21+
ifdef USE_PGXS
2022
PGXS := $(shell $(PG_CONFIG) --pgxs)
2123
include $(PGXS)
2224
else
23-
subdir = contrib/ptrack
2425
top_builddir = ../..
26+
# Makefile.global is a build artifact and initially may not be available
27+
ifneq ($(wildcard $(top_builddir)/src/Makefile.global), )
2528
include $(top_builddir)/src/Makefile.global
2629
include $(top_srcdir)/contrib/contrib-global.mk
2730
endif
31+
endif
32+
33+
# Assuming make is started in the ptrack directory
34+
patch:
35+
@cd $(top_builddir) && \
36+
echo Applying the ptrack patch... && \
37+
git apply --3way -v $(CURDIR)/patches/${PG_BRANCH}-ptrack-core.diff
38+
ifeq ($(MODE), paranoia)
39+
@echo Applying turn-off-hint-bits.diff for the paranoia mode... && \
40+
git apply --3way -v $(CURDIR)/patches/turn-off-hint-bits.diff
41+
endif
42+
43+
NPROC ?= $(shell nproc)
44+
prefix := $(abspath $(top_builddir)/pgsql)
45+
TEST_MODE ?= normal
46+
# Postgres Makefile skips some targets depending on the MAKELEVEL variable so
47+
# reset it when calling install targets as if they are started directly from the
48+
# command line
49+
install-postgres:
50+
@cd $(top_builddir) && \
51+
if [ "$(TEST_MODE)" = legacy ]; then \
52+
./configure CFLAGS='-DEXEC_BACKEND' --disable-atomics --prefix=$(prefix) --enable-debug --enable-cassert --enable-depend --enable-tap-tests --quiet; \
53+
else \
54+
./configure --prefix=$(prefix) --enable-debug --enable-cassert --enable-depend --enable-tap-tests; \
55+
fi && \
56+
$(MAKE) -sj $(NPROC) install MAKELEVEL=0 && \
57+
$(MAKE) -sj $(NPROC) -C contrib/ install MAKELEVEL=0
58+
59+
# Now when Postgres is built call all remainig targets with USE_PGXS=1
60+
61+
test-tap:
62+
ifeq ($(TEST_MODE), legacy)
63+
setarch x86_64 --addr-no-randomize $(MAKE) installcheck USE_PGXS=$(USE_PGXS) PG_CONFIG=$(PG_CONFIG)
64+
else
65+
$(MAKE) installcheck USE_PGXS=$(USE_PGXS) PG_CONFIG=$(PG_CONFIG)
66+
endif
67+
68+
pg_probackup_dir = ../pg_probackup
69+
# Pg_probackup's Makefile uses top_srcdir when building via PGXS so set it when calling this target
70+
# At the moment building pg_probackup with multiple threads may run some jobs too early and end with an error so do not set the -j option
71+
install-pg-probackup:
72+
$(MAKE) -C $(pg_probackup_dir) install USE_PGXS=$(USE_PGXS) PG_CONFIG=$(PG_CONFIG) top_srcdir=$(top_srcdir)
73+
74+
test-python:
75+
cd $(pg_probackup_dir); \
76+
env="PG_PROBACKUP_PTRACK=ON PG_CONFIG=$(PG_CONFIG)"; \
77+
if [ "$(TEST_MODE)" = normal ]; then \
78+
env="$$env PG_PROBACKUP_TEST_BASIC=ON"; \
79+
elif [ "$(TEST_MODE)" = paranoia ]; then \
80+
env="$$env PG_PROBACKUP_PARANOIA=ON"; \
81+
fi; \
82+
env $$env python3 -m pytest -svv$(if $(shell python3 -m pytest --help | grep '\-n '), -n $(NPROC))$(if $(TESTS), -k '$(TESTS)') tests/ptrack_test.py
83+
84+
coverage:
85+
gcov *.c *.h

0 commit comments

Comments
 (0)