diff --git a/.github/workflows/dbt_run_dummy_workflow.yml b/.github/workflows/dbt_run_dummy_workflow.yml new file mode 100644 index 0000000..38a62eb --- /dev/null +++ b/.github/workflows/dbt_run_dummy_workflow.yml @@ -0,0 +1,53 @@ +name: dbt_run_dummy_workflow +run-name: dbt_run_dummy_workflow + +on: + workflow_dispatch: + branches: + - "main" + +env: + DBT_PROFILES_DIR: ./ + + ACCOUNT: "${{ vars.ACCOUNT }}" + ROLE: "${{ vars.ROLE }}" + USER: "${{ vars.USER }}" + PASSWORD: "${{ secrets.PASSWORD }}" + REGION: "${{ vars.REGION }}" + DATABASE: "${{ vars.DATABASE }}" + WAREHOUSE: "${{ vars.WAREHOUSE }}" + SCHEMA: "${{ vars.SCHEMA }}" + +concurrency: + group: ${{ github.workflow }} + + + +jobs: + run_dbt_jobs: + runs-on: ubuntu-latest + environment: + name: workflow_prod + + steps: + - uses: actions/checkout@v3 + + - uses: actions/setup-python@v4 + with: + python-version: "3.10" + cache: "pip" + + - name: install dependencies + run: | + pip install -r requirements.txt + dbt deps + - name: Run DBT Jobs + run: | + dbt run -m models/silver/utilities/silver__dummy_test.sql + + notify-failure: + needs: [run_dbt_jobs] + if: failure() + uses: ./.github/workflows/slack-notify.yml + secrets: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/.github/workflows/slack-notify.yml b/.github/workflows/slack-notify.yml new file mode 100644 index 0000000..4777b38 --- /dev/null +++ b/.github/workflows/slack-notify.yml @@ -0,0 +1,48 @@ +name: Slack Notification +on: + workflow_call: + inputs: + workflow_name: + description: 'Name of the workflow' + required: false + type: string + default: '' + secrets: + SLACK_WEBHOOK_URL: + required: true + +jobs: + notify: + runs-on: ubuntu-latest + steps: + - name: Send notification to Slack + uses: slackapi/slack-github-action@v1.23.0 + with: + payload: | + { + "text": "⚠️ Workflow Failed: ${{ inputs.workflow_name || github.workflow }}", + "blocks": [ + { + "type": "section", + "text": { + "type": "mrkdwn", + "text": "*Workflow:* ${{ inputs.workflow_name || github.workflow }}\n*Repository:* ${{ github.repository }}\n*Branch:* ${{ github.ref_name }}\n*Status:* ❌ Failed" + } + }, + { + "type": "actions", + "elements": [ + { + "type": "button", + "text": { + "type": "plain_text", + "text": "View Workflow Run" + }, + "url": "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" + } + ] + } + ] + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} \ No newline at end of file diff --git a/models/silver/utilities/silver__dummy_test.sql b/models/silver/utilities/silver__dummy_test.sql new file mode 100644 index 0000000..b0e34c7 --- /dev/null +++ b/models/silver/utilities/silver__dummy_test.sql @@ -0,0 +1,7 @@ +{{ config( + materialized = 'table' +) }} + +SELECT + 1 as id, + 1/0 as will_fail \ No newline at end of file