Skip to content

Commit 1b515b9

Browse files
cursoragentNikolayS
andcommitted
Add GitHub Actions workflow for testing PostgreSQL versions 13-17 and beta
Co-authored-by: nik <[email protected]>
1 parent b21e613 commit 1b515b9

File tree

1 file changed

+156
-0
lines changed

1 file changed

+156
-0
lines changed

.github/workflows/test.yml

Lines changed: 156 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,156 @@
1+
name: Test PostgreSQL Versions
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
postgres-version: ['13', '14', '15', '16', '17']
16+
fail-fast: false
17+
18+
services:
19+
postgres:
20+
image: postgres:${{ matrix.postgres-version }}
21+
env:
22+
POSTGRES_PASSWORD: postgres
23+
POSTGRES_DB: test
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
- 5432:5432
31+
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v4
35+
36+
- name: Install PostgreSQL client
37+
run: |
38+
sudo apt-get update
39+
sudo apt-get install -y postgresql-client-${{ matrix.postgres-version }}
40+
41+
- name: Prepare test database
42+
run: |
43+
export PGPASSWORD=postgres
44+
psql -h localhost -U postgres -d test -c 'CREATE EXTENSION IF NOT EXISTS pg_stat_statements;'
45+
psql -h localhost -U postgres -d test -c 'CREATE EXTENSION IF NOT EXISTS pgstattuple;'
46+
psql -h localhost -U postgres -d test -c "CREATE TABLE align1 AS SELECT 1::int4, 2::int8, 3::int4 AS more FROM generate_series(1, 100000) _(i);"
47+
psql -h localhost -U postgres -d test -c "CREATE TABLE align2 AS SELECT 1::int4, 3::int4 AS more, 2::int8 FROM generate_series(1, 100000) _(i);"
48+
env:
49+
PGPASSWORD: postgres
50+
51+
- name: Test wide mode
52+
run: |
53+
export PGPASSWORD=postgres
54+
echo "\set postgres_dba_wide true" > ~/.psqlrc
55+
echo "\set postgres_dba_interactive_mode false" >> ~/.psqlrc
56+
for f in sql/*; do
57+
echo "Testing $f in wide mode..."
58+
psql -h localhost -U postgres -d test -f warmup.psql -f "$f" > /dev/null
59+
done
60+
env:
61+
PGPASSWORD: postgres
62+
63+
- name: Test normal mode
64+
run: |
65+
export PGPASSWORD=postgres
66+
echo "\set postgres_dba_wide false" > ~/.psqlrc
67+
echo "\set postgres_dba_interactive_mode false" >> ~/.psqlrc
68+
for f in sql/*; do
69+
echo "Testing $f in normal mode..."
70+
psql -h localhost -U postgres -d test -f warmup.psql -f "$f" > /dev/null
71+
done
72+
env:
73+
PGPASSWORD: postgres
74+
75+
- name: Run regression tests
76+
run: |
77+
export PGPASSWORD=postgres
78+
echo "\set postgres_dba_wide false" > ~/.psqlrc
79+
echo "\set postgres_dba_interactive_mode false" >> ~/.psqlrc
80+
81+
echo "Running regression test for 0_node.sql..."
82+
diff -b test/regression/0_node.out <(psql -h localhost -U postgres -d test -f warmup.psql -f sql/0_node.sql | grep Role)
83+
84+
echo "Running regression test for p1_alignment_padding.sql..."
85+
diff -b test/regression/p1_alignment_padding.out <(psql -h localhost -U postgres -d test -f warmup.psql -f sql/p1_alignment_padding.sql | grep align)
86+
87+
echo "Running regression test for a1_activity.sql..."
88+
diff -b test/regression/a1_activity.out <(psql -h localhost -U postgres -d test -f warmup.psql -f sql/a1_activity.sql | grep User)
89+
env:
90+
PGPASSWORD: postgres
91+
92+
test-beta:
93+
runs-on: ubuntu-latest
94+
continue-on-error: true # Allow beta tests to fail without breaking CI
95+
96+
strategy:
97+
matrix:
98+
postgres-version: ['18-beta']
99+
100+
services:
101+
postgres:
102+
image: postgres:${{ matrix.postgres-version }}
103+
env:
104+
POSTGRES_PASSWORD: postgres
105+
POSTGRES_DB: test
106+
options: >-
107+
--health-cmd pg_isready
108+
--health-interval 10s
109+
--health-timeout 5s
110+
--health-retries 5
111+
ports:
112+
- 5432:5432
113+
114+
steps:
115+
- name: Checkout code
116+
uses: actions/checkout@v4
117+
118+
- name: Install PostgreSQL client (beta)
119+
run: |
120+
sudo apt-get update
121+
# Install latest PostgreSQL client for beta testing
122+
sudo apt-get install -y postgresql-client
123+
124+
- name: Prepare test database
125+
run: |
126+
export PGPASSWORD=postgres
127+
psql -h localhost -U postgres -d test -c 'CREATE EXTENSION IF NOT EXISTS pg_stat_statements;'
128+
psql -h localhost -U postgres -d test -c 'CREATE EXTENSION IF NOT EXISTS pgstattuple;'
129+
psql -h localhost -U postgres -d test -c "CREATE TABLE align1 AS SELECT 1::int4, 2::int8, 3::int4 AS more FROM generate_series(1, 100000) _(i);"
130+
psql -h localhost -U postgres -d test -c "CREATE TABLE align2 AS SELECT 1::int4, 3::int4 AS more, 2::int8 FROM generate_series(1, 100000) _(i);"
131+
env:
132+
PGPASSWORD: postgres
133+
134+
- name: Test wide mode (beta)
135+
run: |
136+
export PGPASSWORD=postgres
137+
echo "\set postgres_dba_wide true" > ~/.psqlrc
138+
echo "\set postgres_dba_interactive_mode false" >> ~/.psqlrc
139+
for f in sql/*; do
140+
echo "Testing $f in wide mode (PostgreSQL 18 beta)..."
141+
psql -h localhost -U postgres -d test -f warmup.psql -f "$f" > /dev/null
142+
done
143+
env:
144+
PGPASSWORD: postgres
145+
146+
- name: Test normal mode (beta)
147+
run: |
148+
export PGPASSWORD=postgres
149+
echo "\set postgres_dba_wide false" > ~/.psqlrc
150+
echo "\set postgres_dba_interactive_mode false" >> ~/.psqlrc
151+
for f in sql/*; do
152+
echo "Testing $f in normal mode (PostgreSQL 18 beta)..."
153+
psql -h localhost -U postgres -d test -f warmup.psql -f "$f" > /dev/null
154+
done
155+
env:
156+
PGPASSWORD: postgres

0 commit comments

Comments
 (0)