fix gha workflow env (#350)

* fix gha workflow env

* add dbt_profiles_dir

* bump fsc-utils to 1.30.0 & add tag_integration_test

* add resource path selector to gha dbt command

* revert to fsc-utils package 1.17.2

* add selectors.yml

* add reusable dbt run workflow

* test python 3.8

* pass in python version

* add reusable workflow template and uses python_version

* remove inline dbt.yml in favor of reusable template

* change to dbt.yml reusable workflow

* fix input command and remove python version

* remove external browser authenticator

* fix profiles in ./

* add password envar

* clean up dbt_run_integration_test gha
This commit is contained in:
Shah Newaz Khan 2024-08-27 18:55:29 -07:00 committed by GitHub
parent 02a587c10d
commit 1a3ea2c2fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 19 additions and 71 deletions

View File

@ -1,59 +0,0 @@
name: dbt
on:
workflow_call:
inputs:
warehouse:
required: false
type: string
environment:
required: true
type: string
command:
required: true
type: string
python_version:
required: false
type: string
default: "3.10"
env:
DBT_PROFILES_DIR: ./
ACCOUNT: ${{ vars.ACCOUNT }}
ROLE: ${{ vars.ROLE }}
USER: ${{ vars.USER }}
PASSWORD: ${{ secrets.PASSWORD }}
REGION: ${{ vars.REGION }}
DATABASE: ${{ vars.DATABASE }}
WAREHOUSE: ${{ inputs.warehouse }}
SCHEMA: ${{ vars.SCHEMA }}
TARGET: ${{ vars.TARGET }}
jobs:
dbt:
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }}
env:
WAREHOUSE: ${{ inputs.warehouse || vars.WAREHOUSE }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python_version }}
cache: "pip"
- name: install dependencies
run: |
pip install -r requirements.txt
dbt deps
- name: Run DBT Jobs
run: |
${{ inputs.command }}
- name: Store logs
if: always()
uses: actions/upload-artifact@v3
with:
name: logs-${{ inputs.environment }}-${{ github.run_number }}-${{ github.run_attempt }}
path: |
logs
target

View File

@ -1,19 +1,18 @@
name: integration test
name: dbt_run_integration_test
run-name: ${{ github.event.inputs.branch }}
on:
workflow_dispatch:
concurrency: ${{ github.workflow }}
jobs:
test:
name: livequery_integration_test
uses: ./.github/workflows/dbt.yml
secrets: inherit
called_workflow_template:
uses: FlipsideCrypto/analytics-workflow-templates/.github/workflows/dbt.yml@main
with:
warehouse: DBT_CLOUD
environment: ${{ github.ref == 'refs/heads/main' && 'prod' || 'stg' }}
command: dbt test -s 'livequery_models.deploy.core.*'
command: >
dbt test --selector 'integration_tests'
environment: ${{ github.ref == 'refs/heads/main' && 'workflow_prod' || 'workflow_dev' }}
warehouse: ${{ vars.WAREHOUSE }}
secrets: inherit

View File

@ -5,7 +5,7 @@ flow:
type: snowflake
account: "{{ env_var('ACCOUNT') }}"
user: "{{ env_var('USER') }}"
authenticator: externalbrowser
password: "{{ env_var('PASSWORD') }}"
role: "{{ env_var('ROLE') }}"
schema: "{{ env_var('SCHEMA') }}"
region: "{{ env_var('REGION') }}"
@ -17,7 +17,7 @@ flow:
type: snowflake
account: "{{ env_var('ACCOUNT') }}"
user: "{{ env_var('USER') }}"
authenticator: externalbrowser
password: "{{ env_var('PASSWORD') }}"
role: "{{ env_var('ROLE') }}"
schema: "{{ env_var('SCHEMA') }}"
region: "{{ env_var('REGION') }}"

8
selectors.yml Normal file
View File

@ -0,0 +1,8 @@
selectors:
- name: integration_tests
description: "Selector for integration tests"
definition:
union:
- method: fqn
value: "livequery_models.deploy.core.*"