Skip to content

dbt Run

dbt Run #209

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@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.9'
- 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: steps.run_dbt.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: steps.run_dbt.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:
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"