diff --git a/.github/workflows/dbt-ci.yml b/.github/workflows/dbt-ci.yml new file mode 100644 index 0000000..592773c --- /dev/null +++ b/.github/workflows/dbt-ci.yml @@ -0,0 +1,48 @@ +name: dbt CI + +on: + pull_request: + branches: + - master + +jobs: + dbt-run: + runs-on: ubuntu-latest + environment: DBT_MI + defaults: + run: + working-directory: marketing_insights + + env: + DBT_PRIVATE_KEY: ${{ secrets.DBT_PRIVATE_KEY }} + DBT_PRIVATE_KEY_PATH: /home/runner/.dbt/rsa_key.p8 + + steps: + - name: Checkout repo + uses: actions/checkout@v3 + + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.12.13" + + - name: Install dbt + run: | + python -m pip install --upgrade pip + pip install dbt-core==1.11.8 dbt-snowflake==1.11.4 + + - name: Set up dbt profile + private key + run: | + mkdir -p ~/.dbt + cp .dbt/profiles.yml ~/.dbt/profiles.yml + echo "$DBT_PRIVATE_KEY" > ~/.dbt/rsa_key.p8 + chmod 600 ~/.dbt/rsa_key.p8 + + - name: Install dbt deps + run: dbt deps + + - name: Run dbt debug + run: dbt debug --target ci + + - name: Run dbt + run: dbt build --target ci \ No newline at end of file diff --git a/.gitignore b/.gitignore index eb3d0f2..b02c6d9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,5 @@ __pycache__/ .DS_Store # VSCODE -.vscode/ \ No newline at end of file +.vscode/ + diff --git a/marketing_insights/.dbt/profiles.yml b/marketing_insights/.dbt/profiles.yml new file mode 100644 index 0000000..b9a310f --- /dev/null +++ b/marketing_insights/.dbt/profiles.yml @@ -0,0 +1,13 @@ +marketing_insights: + outputs: + ci: + account: EBIUGTJ-FN06775 + database: MARKETING_INSIGHTS_CI + private_key_path: "{{ env_var('DBT_PRIVATE_KEY_PATH') }}" + role: ACCOUNTADMIN + schema: ANALYTICS_CI + threads: 1 + type: snowflake + user: KIRANPOTHINA + warehouse: COMPUTE_WH + target: ci \ No newline at end of file