-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (51 loc) · 1.86 KB
/
Copy pathci.yml
File metadata and controls
62 lines (51 loc) · 1.86 KB
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
name: CI
# Builds the image and boots the database to prove every extension installs
# and gets created successfully. Runs on push/PR.
on:
push:
branches: [main, master]
pull_request:
workflow_dispatch:
jobs:
build-and-verify:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Create .env for CI
run: |
cp .env.example .env
# Deterministic password for the throwaway CI database.
sed -i 's/^POSTGRES_PASSWORD=.*/POSTGRES_PASSWORD=ci_test_password_123/' .env
- name: Build image
run: docker compose build
- name: Start database
run: docker compose up -d
- name: Wait for healthy
run: |
for i in $(seq 1 30); do
if docker compose exec -T postgres pg_isready -U local_dev -d local_db; then
echo "ready"; exit 0
fi
echo "waiting... ($i)"; sleep 5
done
echo "database did not become ready"; docker compose logs; exit 1
- name: Assert extensions are installed
run: |
docker compose exec -T postgres psql -U local_dev -d local_db -tAc \
"SELECT extname FROM pg_extension ORDER BY extname;" | tee /tmp/ext.txt
for ext in postgres_fdw mysql_fdw tds_fdw file_fdw vector pg_cron \
pg_partman pgaudit pg_repack hypopg pg_hint_plan orafce \
pg_stat_statements; do
grep -qx "$ext" /tmp/ext.txt || { echo "MISSING extension: $ext"; exit 1; }
done
echo "All required extensions present."
- name: Dump logs on failure
if: failure()
run: docker compose logs
- name: Teardown
if: always()
run: docker compose down -v