Skip to content

Commit 1333272

Browse files
author
kipruto45
committed
ci: add GitHub Actions workflow for full SQL pipeline
1 parent 21b9f69 commit 1333272

2 files changed

Lines changed: 69 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: SQL Pipeline CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches: [main]
8+
9+
jobs:
10+
run-sql-pipeline:
11+
runs-on: ubuntu-latest
12+
13+
services:
14+
postgres:
15+
image: postgres:16
16+
env:
17+
POSTGRES_DB: sql_data_engineering
18+
POSTGRES_USER: postgres
19+
POSTGRES_PASSWORD: postgres
20+
ports:
21+
- 5432:5432
22+
options: >-
23+
--health-cmd "pg_isready -U postgres -d sql_data_engineering"
24+
--health-interval 10s
25+
--health-timeout 5s
26+
--health-retries 10
27+
28+
steps:
29+
- name: Checkout repository
30+
uses: actions/checkout@v4
31+
32+
- name: Install PostgreSQL client
33+
run: |
34+
sudo apt-get update
35+
sudo apt-get install -y postgresql-client
36+
37+
- name: Wait for PostgreSQL readiness
38+
env:
39+
PGPASSWORD: postgres
40+
run: |
41+
for i in {1..30}; do
42+
if pg_isready -h 127.0.0.1 -p 5432 -U postgres -d sql_data_engineering; then
43+
exit 0
44+
fi
45+
sleep 2
46+
done
47+
echo "PostgreSQL service did not become ready in time."
48+
exit 1
49+
50+
- name: Create CI .env
51+
run: |
52+
cat > .env <<'EOF'
53+
DB_HOST=127.0.0.1
54+
DB_PORT=5432
55+
DB_NAME=sql_data_engineering
56+
DB_USER=postgres
57+
DB_PASSWORD=postgres
58+
DATABASE_URL=postgresql://postgres:postgres@127.0.0.1:5432/sql_data_engineering
59+
EOF
60+
61+
- name: Run full SQL pipeline
62+
run: |
63+
chmod +x run_all.sh
64+
./run_all.sh

README.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ sql-data-engineering-project/
2424
- SQL (psql-compatible scripts)
2525
- Optional Python tools (linting/automation)
2626

27+
## CI
28+
29+
- GitHub Actions workflow: `.github/workflows/ci.yml`
30+
- Runs the full pipeline (`./run_all.sh`) on pushes and pull requests to `main`.
31+
2732
## Quick Start
2833

2934
One command end-to-end (recommended):

0 commit comments

Comments
 (0)