Skip to content

Commit 93e57f0

Browse files
author
d.kovalenko
committed
[CI] A support of travis is added
1 parent 2bbd9fe commit 93e57f0

File tree

3 files changed

+112
-0
lines changed

3 files changed

+112
-0
lines changed

.travis.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
os: linux
2+
3+
dist: bionic
4+
5+
language: python
6+
7+
services:
8+
- docker
9+
10+
install:
11+
- docker build --build-arg PYTHON_VERSION="${PYTHON_VERSION}" -t tests -f Dockerfile--${TEST_PLATFORM}.tmpl .
12+
13+
script:
14+
- docker run -t tests
15+
16+
notifications:
17+
email:
18+
on_success: change
19+
on_failure: always
20+
21+
env:
22+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.7
23+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.8
24+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.9
25+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.10
26+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.11
27+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.12
28+
- TEST_PLATFORM=alpine PYTHON_VERSION=3.13
29+

Dockerfile--alpine.tmpl

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
ARG PYTHON_VERSION
2+
3+
# --------------------------------------------- base1
4+
FROM python:${PYTHON_VERSION}-alpine as base1
5+
6+
# --------------------------------------------- base1
7+
FROM base1 as base2
8+
9+
RUN apk add python3-dev build-base musl-dev linux-headers
10+
RUN apk add git
11+
12+
# --------------------------------------------- final
13+
FROM base2 as final
14+
15+
RUN apk add mc
16+
RUN apk add bash
17+
18+
# Full version of "ps" command
19+
RUN apk add --no-cache procps
20+
21+
RUN apk add --no-cache openssh
22+
RUN apk add --no-cache sudo
23+
24+
RUN adduser -D test
25+
26+
RUN addgroup -S sudo
27+
RUN adduser test sudo
28+
29+
EXPOSE 22
30+
RUN ssh-keygen -A
31+
32+
ADD . /home/test/testgres
33+
RUN chown -R test /home/test/testgres
34+
WORKDIR /home/test/testgres
35+
36+
# It allows to use sudo without password
37+
RUN sh -c "echo \"test ALL=(ALL:ALL) NOPASSWD:ALL\"">>/etc/sudoers
38+
39+
# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
40+
RUN sh -c "echo "test:*" | chpasswd -e"
41+
42+
USER test
43+
44+
# THIS CMD IS NEEDED TO CONNECT THROUGH SSH WITHOUT PASSWORD
45+
RUN chmod 700 ~/
46+
47+
RUN mkdir -p ~/.ssh
48+
#RUN chmod 700 ~/.ssh
49+
50+
ENTRYPOINT sh -c " \
51+
set -eux; \
52+
echo HELLO FROM ENTRYPOINT; \
53+
echo HOME DIR IS [`realpath ~/`]; \
54+
ssh-keygen -t rsa -f ~/.ssh/id_rsa -q -N ''; \
55+
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys; \
56+
chmod 600 ~/.ssh/authorized_keys; \
57+
ls -la ~/.ssh/; \
58+
sudo /usr/sbin/sshd; \
59+
ssh-keyscan -H localhost >> ~/.ssh/known_hosts; \
60+
ssh-keyscan -H 127.0.0.1 >> ~/.ssh/known_hosts; \
61+
bash run_tests3.sh;"

run_tests3.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/usr/bin/env bash
2+
3+
# Copyright (c) 2017-2025 Postgres Professional
4+
5+
set -eux
6+
7+
# prepare python environment
8+
VENV_PATH="/tmp/testgres_venv"
9+
rm -rf $VENV_PATH
10+
python -m venv "${VENV_PATH}"
11+
export VIRTUAL_ENV_DISABLE_PROMPT=1
12+
source "${VENV_PATH}/bin/activate"
13+
pip install -r tests/requirements.txt
14+
15+
# install testgres' dependencies
16+
export PYTHONPATH=$(pwd)
17+
# $PIP install .
18+
19+
pytest -l -v -n 4
20+
21+
set +eux
22+

0 commit comments

Comments
 (0)