#========================================================================================================================
# -- Create date: 23-Aug-2021
# -- Description: This workflow is used to trigger DBT jobs via a rest API
#=========================================================================================================================
#---------------------------------------------------------------------------------------------------------------------------
#Change Log
#Version No Date Resource_Name Description of Change
#---------------------------------------------------------------------------------------------------------------------------
#0.1 23-Aug-2021 Kelvin Langford Initial code
#---------------------------------------------------------------------------------------------------------------------------
name: rest_workflow
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
workflow_dispatch:
inputs:
tag:
default: "daily"
description: "This is used to trigger a workflow using a tag. default is daily"
# Environment variable values are retrived from Github secrets
env:
DBT_TARGET: PROD
DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }}
DBT_USER: ${{ secrets.DBT_PROD_USER }}
DBT_PASSWORD: ${{ secrets.DBT_PROD_PASSWORD }}
DBT_ROLE: DEV_TRANSFORMER
DBT_DB: ONEDB_DEV
DBT_SCHEMA: EDM_AI
DBT_WH: DEV_TRANSFORMER_WH
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains two jobs 1. To clone the prod db and 2. to drop the test db.
run:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Event info
run: |
echo This workflow on ${{ github.repository }} was started by ${{ github.actor }} from the event ${{ github.event_name }} and action ${{github.event.action}}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dbt==1.0.0
run: |
python -m pip install --upgrade pip
pip install dbt-snowflake==1.0.0
- name: Install dbt dependency packages
run: |
dbt deps
- name: Compile dbt models in example folder
run: |
dbt compile --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
- name: Deploy the models for this release
run: |
dbt run --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
- name: Test the models for this release
run: |
dbt test --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
#========================================================================================================================
# -- Create date: 23-Aug-2021
# -- Description: This workflow is used to trigger DBT jobs via a rest API
#=========================================================================================================================
#---------------------------------------------------------------------------------------------------------------------------
#Change Log
#Version No Date Resource_Name Description of Change
#---------------------------------------------------------------------------------------------------------------------------
#0.1 23-Aug-2021 Kelvin Langford Initial code
#---------------------------------------------------------------------------------------------------------------------------
name: rest_workflow
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
workflow_dispatch:
inputs:
tag:
default: "daily"
description: "This is used to trigger a workflow using a tag. default is daily"
# Environment variable values are retrived from Github secrets
env:
DBT_TARGET: PROD
DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }}
DBT_USER: ${{ secrets.DBT_PROD_USER }}
DBT_PASSWORD: ${{ secrets.DBT_PROD_PASSWORD }}
DBT_ROLE: DEV_TRANSFORMER
DBT_DB: ONEDB_DEV
DBT_SCHEMA: EDM_AI
DBT_WH: DEV_TRANSFORMER_WH
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains two jobs 1. To clone the prod db and 2. to drop the test db.
run:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Event info
run: |
echo This workflow on ${{ github.repository }} was started by ${{ github.actor }} from the event ${{ github.event_name }} and action ${{github.event.action}}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dbt==1.0.0
run: |
python -m pip install --upgrade pip
pip install dbt-snowflake==1.0.0
- name: Install dbt dependency packages
run: |
dbt deps
- name: Compile dbt models in example folder
run: |
dbt compile --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
- name: Deploy the models for this release
run: |
dbt run --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
- name: Test the models for this release
run: |
dbt test --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
#========================================================================================================================
# -- Create date: 23-Aug-2021
# -- Description: This workflow is used to trigger DBT jobs via a rest API
#=========================================================================================================================
#---------------------------------------------------------------------------------------------------------------------------
#Change Log
#Version No Date Resource_Name Description of Change
#---------------------------------------------------------------------------------------------------------------------------
#0.1 23-Aug-2021 Kelvin Langford Initial code
#---------------------------------------------------------------------------------------------------------------------------
name: rest_workflow
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
workflow_dispatch:
inputs:
tag:
default: "daily"
description: "This is used to trigger a workflow using a tag. default is daily"
# Environment variable values are retrived from Github secrets
env:
DBT_TARGET: PROD
DBT_SNOWFLAKE_ACCOUNT: ${{ secrets.DBT_SNOWFLAKE_ACCOUNT }}
DBT_USER: ${{ secrets.DBT_PROD_USER }}
DBT_PASSWORD: ${{ secrets.DBT_PROD_PASSWORD }}
DBT_ROLE: DEV_TRANSFORMER
DBT_DB: ONEDB_DEV
DBT_SCHEMA: EDM_AI
DBT_WH: DEV_TRANSFORMER_WH
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains two jobs 1. To clone the prod db and 2. to drop the test db.
run:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Event info
run: |
echo This workflow on ${{ github.repository }} was started by ${{ github.actor }} from the event ${{ github.event_name }} and action ${{github.event.action}}
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout branch
uses: actions/checkout@v3
- name: Install Python 3.8
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Install dbt==1.0.0
run: |
python -m pip install --upgrade pip
pip install dbt-snowflake==1.0.0
- name: Install dbt dependency packages
run: |
dbt deps
- name: Compile dbt models in example folder
run: |
dbt compile --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
- name: Deploy the models for this release
run: |
dbt run --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles
- name: Test the models for this release
run: |
dbt test --model tag:${{ github.event.inputs.tag }} --profiles-dir ./dbt_profiles