Skip to content

dbt Run

dbt Run #636

Workflow file for this run

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"