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

Commit208c5e3

Browse files
[CI] Test with python 3.8, 3.9, 3.10 and 3.11 [std2-all][alpine]
We will run all the tests to get a full information about compatibility.Some new tests may fail.---TODO: may be it is better to compile/install required python version explicitly instead using pyenv.
1 parent96ddf19 commit208c5e3

File tree

3 files changed

+165
-0
lines changed

3 files changed

+165
-0
lines changed

‎.travis.yml‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,10 @@ notifications:
1919
on_failure:always
2020

2121
env:
22+
-TEST_PLATFORM=std2-all PYTHON_VERSION=3.8 PG_VERSION=17
23+
-TEST_PLATFORM=std2-all PYTHON_VERSION=3.9 PG_VERSION=17
24+
-TEST_PLATFORM=std2-all PYTHON_VERSION=3.10 PG_VERSION=17
25+
-TEST_PLATFORM=std2-all PYTHON_VERSION=3.11 PG_VERSION=17
2226
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=16
2327
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=15
2428
-TEST_PLATFORM=std PYTHON_VERSION=3 PG_VERSION=14

‎Dockerfile--std2-all.tmpl‎

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
ARG PG_VERSION
2+
ARG PYTHON_VERSION
3+
4+
# --------------------------------------------- base1
5+
FROM postgres:${PG_VERSION}-alpine as base1
6+
7+
# --------------------------------------------- base2_with_python-3
8+
FROM base1 as base2_with_python-3
9+
RUN apk add --no-cache curl python3 python3-dev build-base musl-dev linux-headers py-virtualenv
10+
11+
# For pyenv
12+
RUN apk add build-base gcc-doc
13+
RUN apk add patch
14+
RUN apk add git
15+
RUN apk add xz-dev
16+
RUN apk add zip
17+
RUN apk add zlib-dev
18+
RUN apk add libffi-dev
19+
RUN apk add readline-dev
20+
RUN apk add openssl openssl-dev
21+
RUN apk add sqlite-dev
22+
RUN apk add bzip2-dev
23+
24+
# --------------------------------------------- base3_with_python-3.8
25+
FROM base2_with_python-3 as base3_with_python-3.8
26+
ENV PYTHON_VERSION=3.8
27+
28+
# --------------------------------------------- base3_with_python-3.9
29+
FROM base2_with_python-3 as base3_with_python-3.9
30+
ENV PYTHON_VERSION=3.9
31+
32+
# --------------------------------------------- base3_with_python-3.10
33+
FROM base2_with_python-3 as base3_with_python-3.10
34+
ENV PYTHON_VERSION=3.10
35+
36+
# --------------------------------------------- base3_with_python-3.11
37+
FROM base2_with_python-3 as base3_with_python-3.11
38+
ENV PYTHON_VERSION=3.11
39+
40+
# --------------------------------------------- final
41+
FROM base3_with_python-${PYTHON_VERSION} as final
42+
43+
#RUN apk add --no-cache mc
44+
45+
# Full version of "ps" command
46+
RUN apk add --no-cache procps
47+
48+
RUN apk add --no-cache openssh
49+
RUN apk add --no-cache sudo
50+
51+
ENV LANG=C.UTF-8
52+
53+
RUN addgroup -S sudo
54+
RUN adduser postgres sudo
55+
56+
EXPOSE 22
57+
RUN ssh-keygen -A
58+
59+
ADD . /pg/testgres
60+
WORKDIR /pg/testgres
61+
RUN chown -R postgres:postgres /pg
62+
63+
# It allows to use sudo without password
64+
RUN sh -c "echo \"postgres ALL=(ALL:ALL) NOPASSWD:ALL\"">>/etc/sudoers
65+
66+
# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
67+
RUN sh -c "echo "postgres:*" | chpasswd -e"
68+
69+
USER postgres
70+
71+
RUN curl https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash
72+
73+
RUN ~/.pyenv/bin/pyenv install ${PYTHON_VERSION}
74+
75+
# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
76+
RUN chmod 700 ~/
77+
78+
RUN mkdir -p ~/.ssh
79+
#RUN chmod 700 ~/.ssh
80+
81+
ENTRYPOINT sh -c " \
82+
set -eux; \
83+
echo HELLO FROM ENTRYPOINT; \
84+
echo HOME DIR IS [`realpath ~/`]; \
85+
ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \
86+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \
87+
chmod 600 ~/.ssh/authorized_keys; \
88+
ls -la ~/.ssh/; \
89+
sudo /usr/sbin/sshd; \
90+
ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \
91+
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \
92+
export PATH=\"~/.pyenv/bin:$PATH\"; \
93+
TEST_FILTER=\"\" bash run_tests2.sh;"

‎run_tests2.sh‎

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2017-2025 Postgres Professional
4+
5+
set -eux
6+
7+
eval"$(pyenv init -)"
8+
eval"$(pyenv virtualenv-init -)"
9+
10+
pyenv virtualenv --force${PYTHON_VERSION} cur
11+
pyenv activate cur
12+
13+
if [-z${TEST_FILTER+x} ]; \
14+
thenexport TEST_FILTER="TestTestgresLocal or (TestTestgresCommon and (not remote))"; \
15+
fi
16+
17+
# fail early
18+
echo check that pg_config isin PATH
19+
command -v pg_config
20+
21+
# prepare python environment
22+
VENV_PATH="/tmp/testgres_venv"
23+
rm -rf$VENV_PATH
24+
python -m venv"${VENV_PATH}"
25+
export VIRTUAL_ENV_DISABLE_PROMPT=1
26+
source"${VENV_PATH}/bin/activate"
27+
pip install coverage flake8 psutil Sphinx pytest pytest-xdist psycopg2 six psutil
28+
29+
# install testgres' dependencies
30+
export PYTHONPATH=$(pwd)
31+
# $PIP install .
32+
33+
# test code quality
34+
flake8.
35+
36+
37+
# remove existing coverage file
38+
export COVERAGE_FILE=.coverage
39+
rm -f$COVERAGE_FILE
40+
41+
42+
# run tests (PATH)
43+
time coverage run -a -m pytest -l -v -n 4 -k"${TEST_FILTER}"
44+
45+
46+
# run tests (PG_BIN)
47+
PG_BIN=$(pg_config --bindir) \
48+
time coverage run -a -m pytest -l -v -n 4 -k"${TEST_FILTER}"
49+
50+
51+
# run tests (PG_CONFIG)
52+
PG_CONFIG=$(pg_config --bindir)/pg_config \
53+
time coverage run -a -m pytest -l -v -n 4 -k"${TEST_FILTER}"
54+
55+
56+
# show coverage
57+
coverage report
58+
59+
# build documentation
60+
cd docs
61+
make html
62+
cd ..
63+
64+
# attempt to fix codecov
65+
set +eux
66+
67+
# send coverage stats to Codecov
68+
bash<(curl -s https://codecov.io/bash)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp