-
Notifications
You must be signed in to change notification settings - Fork 6
134 lines (111 loc) · 4.23 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
#
# https://docs.github.com/en/actions/reference
# https://github.com/actions
#
# uses: https://github.com/actions/checkout @v3
# uses: https://github.com/actions/setup-python @v4
# uses: https://github.com/actions/download-artifact @v3
# uses: https://github.com/actions/upload-artifact @v3
#
name: CI
on:
pull_request: {}
push: {}
jobs:
check:
name: "Check"
runs-on: ubuntu-latest
strategy:
matrix:
test:
- {PY: "3.10", TOXENV: "lint"}
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Setup Python ${{matrix.test.PY}}"
uses: actions/setup-python@v4
with:
python-version: ${{matrix.test.PY}}
- run: python3 -m pip install -r etc/requirements.build.txt --disable-pip-version-check
- name: "Test"
env:
TOXENV: ${{matrix.test.TOXENV}}
run: python3 -m tox -r
database:
name: "Python ${{matrix.test.PY}} + PostgreSQL ${{matrix.test.PG}}"
runs-on: ubuntu-latest
strategy:
matrix:
test:
- {PY: "3.7", PG: "11", TOXENV: "py37"}
- {PY: "3.8", PG: "12", TOXENV: "py38"}
- {PY: "3.9", PG: "13", TOXENV: "py39"}
- {PY: "3.10", PG: "14", TOXENV: "py310"}
- {PY: "3.11", PG: "15", TOXENV: "py311"}
steps:
- name: "Checkout"
uses: actions/checkout@v3
- name: "Setup Python ${{matrix.test.PY}}"
uses: actions/setup-python@v4
with:
python-version: ${{matrix.test.PY}}
- run: python3 -m pip install -r etc/requirements.build.txt --disable-pip-version-check
- name: "InstallDB"
run: |
echo "::group::apt-get-update"
sudo -nH apt-get -q update
sudo -nH apt-get -q install curl ca-certificates gnupg
curl https://www.postgresql.org/media/keys/ACCC4CF8.asc \
| gpg --dearmor \
| sudo -nH tee /etc/apt/trusted.gpg.d/apt.postgresql.org.gpg
echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main ${{matrix.test.PG}}" \
| sudo -nH tee /etc/apt/sources.list.d/pgdg.list
sudo -nH apt-get -q update
echo "::endgroup::"
echo "::group::apt-get-install"
# disable new cluster creation
sudo -nH mkdir -p /etc/postgresql-common/createcluster.d
echo "create_main_cluster = false" | sudo -nH tee /etc/postgresql-common/createcluster.d/no-main.conf
sudo -nH apt-get -qyu install postgresql-${{matrix.test.PG}} postgresql-server-dev-${{matrix.test.PG}} pgqd
echo "::endgroup::"
# tune environment
echo "/usr/lib/postgresql/${{matrix.test.PG}}/bin" >> $GITHUB_PATH
echo "PGHOST=/tmp" >> $GITHUB_ENV
- name: "Install extensions"
run: |
echo "::group::install-pgq"
git clone -q https://github.com/pgq/pgq pgq-sql; make -C pgq-sql
sudo -nH bash -c "PATH='${PATH}' make install -C pgq-sql"
echo "::endgroup::"
echo "::group::install-pgq-node"
git clone -q https://github.com/pgq/pgq-node; make -C pgq-node
sudo -nH bash -c "PATH='${PATH}' make install -C pgq-node"
echo "::endgroup::"
echo "::group::install-londiste"
git clone -q https://github.com/pgq/londiste-sql; make -C londiste-sql
sudo -nH bash -c "PATH='${PATH}' make install -C londiste-sql"
echo "::endgroup::"
- name: "StartDB"
run: |
rm -rf data log
mkdir -p log
LANG=C initdb data
sed -ri -e "s,^[# ]*(unix_socket_directories).*,\\1='/tmp'," data/postgresql.conf
pg_ctl -D data -l log/pg.log start || { cat log/pg.log ; exit 1; }
sleep 1
- name: "CreateDB"
run: |
psql -d postgres -c "create database testdb"
psql -d testdb -c "create extension pgq; create extension pgq_node;"
psql -d testdb -c "select pgq.create_queue('testq')"
- name: "Test"
env:
TOXENV: ${{matrix.test.TOXENV}}
TEST_Q_NAME: testq
PGDATABASE: testdb
run: |
python3 -m tox -r -- --color=yes
- name: "StopDB"
run: |
pg_ctl -D data stop
rm -rf data log /tmp/.s.PGSQL*