-
Notifications
You must be signed in to change notification settings - Fork 2
76 lines (66 loc) · 2.31 KB
/
dbt_run.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
name: dbt Run
on:
schedule:
- cron: "0 8 * * *"
workflow_dispatch:
jobs:
run_dbt:
name: Run dbt
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Install dbt dependencies
run: cd levergreen_dbt && dbt deps
- name: Run dbt models
id: run_dbt_step
run: cd levergreen_dbt && dbt run
env:
PG_DATABASE: ${{ secrets.PG_DATABASE }}
PG_HOST: ${{ secrets.PG_HOST }}
PG_PASSWORD: ${{ secrets.PG_PASSWORD }}
PG_USER: ${{ secrets.PG_USER }}
- name: Test dbt models
run: cd levergreen_dbt && dbt test
env:
PG_DATABASE: ${{ secrets.PG_DATABASE }}
PG_HOST: ${{ secrets.PG_HOST }}
PG_PASSWORD: ${{ secrets.PG_PASSWORD }}
PG_USER: ${{ secrets.PG_USER }}
- name: Check Freshness of dbt models
if: ${{ always() && steps.run_dbt_step.conclusion == 'success'}}
run: cd levergreen_dbt && dbt source freshness
env:
PG_DATABASE: ${{ secrets.PG_DATABASE }}
PG_HOST: ${{ secrets.PG_HOST }}
PG_PASSWORD: ${{ secrets.PG_PASSWORD }}
PG_USER: ${{ secrets.PG_USER }}
- name: Run Elementary
if: ${{ always() && steps.run_dbt_step.conclusion == 'success'}}
uses: elementary-data/[email protected]
env:
PG_DATABASE: ${{ secrets.PG_DATABASE }}
PG_HOST: ${{ secrets.PG_HOST }}
PG_PASSWORD: ${{ secrets.PG_PASSWORD }}
PG_USER: ${{ secrets.PG_USER }}
with:
warehouse-type: postgres
project-dir: levergreen_dbt
profiles-dir: levergreen_dbt
edr-command:
edr send-report
--aws-access-key-id "${{ secrets.AWS_ACCESS_KEY_ID }}"
--aws-secret-access-key "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
--s3-bucket-name "${{ secrets.ELEMENTARY_S3_BUCKET }}"
--update-bucket-website "true"
--env "prod"