Skip to content

Commit 24b2ae3

Browse files
committed
init CI workflow and wake up script
1 parent a46f12e commit 24b2ae3

File tree

2 files changed

+68
-0
lines changed

2 files changed

+68
-0
lines changed

.github/workflows/dbt_run.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: dbt_run CI pipeline
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened]
6+
7+
jobs:
8+
dbt-run:
9+
runs-on: [ self-hosted, linux, spellbook-trino-ci ]
10+
timeout-minutes: 90
11+
12+
steps:
13+
- name: Check out repository code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: '3.12'
20+
21+
- name: Install uv
22+
uses: astral-sh/setup-uv@v5
23+
with:
24+
enable-cache: true
25+
26+
- name: Install dependencies with uv
27+
run: uv sync
28+
29+
- name: Run dbt deps
30+
run: uv run dbt deps
31+
32+
- name: Activate Trino cluster
33+
run: "./scripts/activate-trino-cluster.sh"
34+
35+
- name: Run dbt compile
36+
run: uv run dbt compile
37+
38+
- name: Run dbt run (full refresh)
39+
run: uv run dbt run --full-refresh
40+
41+
- name: Run dbt test (after full refresh)
42+
run: uv run dbt test
43+
44+
- name: Run dbt run (incremental update)
45+
run: uv run dbt run
46+
47+
- name: Run dbt test (after incremental)
48+
run: uv run dbt test

scripts/activate-trino-cluster.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
set -euo pipefail
4+
5+
RETRY_COUNT=0
6+
# max wait: 10 minutes
7+
MAX_RETRIES=40
8+
WAIT_TIME=15
9+
10+
until [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]
11+
do
12+
uv run dbt debug && break
13+
RETRY_COUNT=$((RETRY_COUNT+1))
14+
if [ "$RETRY_COUNT" -ge "$MAX_RETRIES" ]; then
15+
echo "Max retries reached, failing..."
16+
exit 1
17+
fi
18+
echo "Retrying in $WAIT_TIME seconds... ($RETRY_COUNT/$MAX_RETRIES)"
19+
sleep $WAIT_TIME
20+
done

0 commit comments

Comments
 (0)