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

Commitf598fae

Browse files
committed
Try running travis tests
1 parent40a47ff commitf598fae

File tree

7 files changed

+176
-0
lines changed

7 files changed

+176
-0
lines changed

‎.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
*.so
33
*.o
44
ptrack--2.0.sql
5+
Dockerfile
56

‎.travis.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
os:linux
2+
3+
dist:bionic
4+
5+
language:c
6+
7+
services:
8+
-docker
9+
10+
before_install:
11+
-cp travis/* .
12+
13+
install:
14+
-./make_dockerfile.sh
15+
-docker-compose build
16+
17+
script:
18+
-docker-compose run tests
19+
# - docker-compose run $(bash <(curl -s https://codecov.io/env)) tests
20+
# - docker run -v $(pwd):/tests --rm centos:7 /tests/travis/backup_restore.sh
21+
22+
notifications:
23+
email:
24+
on_success:change
25+
on_failure:always
26+
27+
# Default MODE is basic, i.e. all tests with PG_PROBACKUP_TEST_BASIC=ON
28+
env:
29+
-PG_VERSION=12 PG_BRANCH=REL_12_STABLE
30+
31+
jobs:
32+
allow_failures:
33+
-if:env(MODE) IN (archive, backup, delta, locking, merge, replica, retention, restore)

‎Dockerfile.in

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM ololobus/postgres-dev:stretch
2+
3+
USER root
4+
RUN apt-get update
5+
RUN apt-get -yq install python python-pip python-virtualenv
6+
7+
# Environment
8+
ENV PG_MAJOR=${PG_VERSION} PG_BRANCH=${PG_BRANCH}
9+
ENV LANG=C.UTF-8 PGHOME=/pg/testdir/pgbin
10+
11+
# Make directories
12+
RUNmkdir -p /pg/testdir
13+
14+
COPY run_tests.sh /run.sh
15+
RUN chmod 755 /run.sh
16+
17+
COPY . /pg/testdir
18+
WORKDIR /pg/testdir
19+
20+
# Grant privileges
21+
RUNchown -R postgres:postgres /pg/testdir
22+
23+
USER postgres
24+
ENTRYPOINT MODE=${MODE} /run.sh

‎README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
[![Build Status](https://travis-ci.com/postgrespro/ptrack.svg?branch=master)](https://travis-ci.com/postgrespro/ptrack)
2+
13
#ptrack
24

35
##Overview

‎docker-compose.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
tests:
2+
build:.

‎make_dockerfile.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/usr/bin/env sh
2+
3+
if [-z${PG_VERSION+x} ];then
4+
echo PG_VERSION is not set!
5+
exit 1
6+
fi
7+
8+
if [-z${PG_BRANCH+x} ];then
9+
echo PG_BRANCH is not set!
10+
exit 1
11+
fi
12+
13+
if [-z${MODE+x} ];then
14+
MODE=basic
15+
fi
16+
17+
echo PG_VERSION=${PG_VERSION}
18+
echo PG_BRANCH=${PG_BRANCH}
19+
echo MODE=${MODE}
20+
21+
sed \
22+
-e's/${PG_VERSION}/'${PG_VERSION}/g \
23+
-e's/${PG_BRANCH}/'${PG_BRANCH}/g \
24+
-e's/${MODE}/'${MODE}/g \
25+
Dockerfile.in> Dockerfile

‎run_tests.sh

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
#!/usr/bin/env bash
2+
3+
#
4+
# Copyright (c) 2019-2020, Postgres Professional
5+
#
6+
7+
8+
PG_SRC=$PWD/postgres
9+
10+
# # Here PG_VERSION is provided by postgres:X-alpine docker image
11+
# curl "https://ftp.postgresql.org/pub/source/v$PG_VERSION/postgresql-$PG_VERSION.tar.bz2" -o postgresql.tar.bz2
12+
# echo "$PG_SHA256 *postgresql.tar.bz2" | sha256sum -c -
13+
14+
# mkdir $PG_SRC
15+
16+
# tar \
17+
# --extract \
18+
# --file postgresql.tar.bz2 \
19+
# --directory $PG_SRC \
20+
# --strip-components 1
21+
22+
# Clone Postgres
23+
echo"############### Getting Postgres sources"
24+
git clone https://github.com/postgres/postgres.git -b$PG_BRANCH --depth=1
25+
26+
# Clone pg_probackup
27+
echo"############### Getting pg_probackup sources"
28+
git clone https://github.com/postgrespro/pg_probackup.git --depth=1
29+
30+
# Compile and install Postgres
31+
cd postgres# Go to postgres dir
32+
echo"############### Applying ptrack patch"
33+
git apply -v -3 ../patches/$PG_BRANCH-ptrack-core.diff
34+
35+
echo"############### Compiling Postgres"
36+
./configure --prefix=$PGHOME --enable-debug --enable-cassert --enable-depend --enable-tap-tests
37+
make -s -j$(nproc) install
38+
make -s -j$(nproc) -C contrib/ install
39+
40+
# Override default Postgres instance
41+
export PATH=$PGHOME/bin:$PATH
42+
export LD_LIBRARY_PATH=$PGHOME/lib
43+
export PG_CONFIG=$(which pg_config)
44+
45+
# Get amcheck if missing
46+
if [!-d"contrib/amcheck" ];then
47+
echo"############### Getting missing amcheck"
48+
git clone https://github.com/petergeoghegan/amcheck.git --depth=1 contrib/amcheck
49+
make USE_PGXS=1 -C contrib/amcheck install
50+
fi
51+
52+
# Get back to testdir
53+
cd ..
54+
55+
# Build and install ptrack extension
56+
echo"############### Compiling and installing ptrack extension"
57+
make USE_PGXS=1 install
58+
59+
# Show pg_config path (just in case)
60+
echo"############### pg_config path"
61+
which pg_config
62+
63+
# Show pg_config just in case
64+
echo"############### pg_config"
65+
pg_config
66+
67+
# Build and install pg_probackup (using PG_CPPFLAGS and SHLIB_LINK for gcov)
68+
echo"############### Compiling and installing pg_probackup"
69+
cd pg_probackup# Go to pg_probackup dir
70+
# make USE_PGXS=1 PG_CPPFLAGS="-coverage" SHLIB_LINK="-coverage" top_srcdir=$CUSTOM_PG_SRC install
71+
make USE_PGXS=1 top_srcdir=$PG_SRC install
72+
73+
# Setup python environment
74+
echo"############### Setting up python env"
75+
virtualenv pyenv
76+
source pyenv/bin/activate
77+
pip install testgres==1.8.2
78+
79+
echo"############### Testing"
80+
if ["$MODE"="basic" ];then
81+
export PG_PROBACKUP_TEST_BASIC=ON
82+
fi
83+
python -m unittest -v tests.ptrack
84+
85+
# Generate *.gcov files
86+
# gcov src/*.c src/*.h
87+
88+
# Send coverage stats to Codecov
89+
# bash <(curl -s https://codecov.io/bash)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp