Skip to content

Commit 4478286

Browse files
committed
[WIP]
1 parent 3ef930f commit 4478286

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.github/workflows/test.yml

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Test
2+
3+
on:
4+
push:
5+
branches: ["**"]
6+
pull_request:
7+
branches: ["master"]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
strategy:
13+
matrix:
14+
pg_version: [12, 13, 14, 15, 16, 17]
15+
os: [ubuntu-22.04]
16+
build: [automake, meson]
17+
tests: [sql]
18+
fail-fast: false
19+
runs-on: ubuntu-latest
20+
container:
21+
image: ${{ format('ghcr.io/postgres-dev/{0}:1.0', matrix.os) }}
22+
options: --privileged
23+
env:
24+
PGDATA: $HOME/data
25+
PG_BRANCH: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
26+
27+
steps:
28+
# Checkout PostgreSQL sources (optional if needed for meson or custom builds)
29+
- name: Get Postgres sources
30+
uses: actions/checkout@v3
31+
with:
32+
repository: postgres/postgres
33+
ref: ${{ format('REL_{0}_STABLE', matrix.pg_version) }}
34+
path: postgres
35+
36+
# Checkout shared_ispell
37+
- name: Get shared_ispell sources
38+
uses: actions/checkout@v3
39+
40+
# Install required build tools
41+
- name: Install build tools
42+
run: |
43+
sudo apt update
44+
sudo apt install -y build-essential automake meson ninja-build pkg-config libxml2-dev wget gnupg lsb-release
45+
46+
# Set PG_CONFIG to container's PostgreSQL
47+
- name: Set PG_CONFIG
48+
run: echo "PG_CONFIG=$(which pg_config)" >> $GITHUB_ENV
49+
50+
# Build shared_ispell (automake)
51+
- name: Build (automake)
52+
if: matrix.build == 'automake'
53+
run: |
54+
make USE_PGXS=1
55+
make USE_PGXS=1 install
56+
57+
# Build shared_ispell (meson)
58+
- name: Build (meson)
59+
if: matrix.build == 'meson'
60+
run: |
61+
PREFIX=$($PG_CONFIG --pgxs | sed 's|/lib/pgxs/src/makefiles/pgxs.mk||')
62+
meson setup builddir --prefix=$PREFIX
63+
meson compile -C builddir
64+
meson install -C builddir
65+
66+
# Create test database and extension
67+
- name: Create extension
68+
run: |
69+
createdb test
70+
psql -d test -c "CREATE EXTENSION shared_ispell;"
71+
72+
# Run SQL tests
73+
- name: Run SQL tests
74+
run: |
75+
for f in sql/*.sql; do
76+
echo "Running $f"
77+
psql -d test -f "$f"
78+
done

0 commit comments

Comments
 (0)