-
Notifications
You must be signed in to change notification settings - Fork 1
64 lines (56 loc) · 1.54 KB
/
Copy pathci.yml
File metadata and controls
64 lines (56 loc) · 1.54 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
63
64
name: SQL Pipeline CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
run-sql-pipeline:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
env:
POSTGRES_DB: sql_data_engineering
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres -d sql_data_engineering"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install PostgreSQL client
run: |
sudo apt-get update
sudo apt-get install -y postgresql-client
- name: Wait for PostgreSQL readiness
env:
PGPASSWORD: postgres
run: |
for i in {1..30}; do
if pg_isready -h 127.0.0.1 -p 5432 -U postgres -d sql_data_engineering; then
exit 0
fi
sleep 2
done
echo "PostgreSQL service did not become ready in time."
exit 1
- name: Create CI .env
run: |
cat > .env <<'EOF'
DB_HOST=127.0.0.1
DB_PORT=5432
DB_NAME=sql_data_engineering
DB_USER=postgres
DB_PASSWORD=postgres
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/sql_data_engineering
EOF
- name: Run full SQL pipeline
run: |
chmod +x run_all.sh
./run_all.sh