-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (49 loc) · 1.5 KB
/
.dbt-ci.yml
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
name: Our first dbt PR job
on:
pull_request:
types:
- opened
- reopened
- synchronize
- ready_for_review
push:
branches:
- '!main'
jobs:
dbt_ci:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set Up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
# Step 1: Set up SSH key manually
- name: Add SSH private key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/production_ddp
chmod 600 ~/.ssh/production_ddp
# Step 2: Establish SSH tunnel
- name: Establish SSH tunnel
run: |
ssh -fN \
-i ~/.ssh/production_ddp \
-L 5432:${{ secrets.POSTGRES_HOST }}:5432 \
${{ secrets.DB_USER }}@${{ secrets.SSH_HOST }}
- name: Install requirements
run: pip install -r requirements.txt
- name: Install dbt dependencies
run: dbt deps
- name: dbt build
run: dbt build --full-refresh --profiles-dir ./
env:
POSTGRES_DBNAME: ${{ secrets.POSTGRES_DBNAME }}
POSTGRES_USER: ${{ secrets.POSTGRES_USER }}
POSTGRES_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }}
POSTGRES_HOST: 127.0.0.1 # Use localhost since we are tunneling via SSH
- name: Benchmarking models
run: "sqlfluff lint models --bench"
- name: Lint models
run: "sqlfluff lint models -f human"