From bb864a8e877e1f3c000ed5021018febb89a52b51 Mon Sep 17 00:00:00 2001 From: Shah Newaz Khan Date: Wed, 14 Aug 2024 09:35:41 -0700 Subject: [PATCH] Livequery integration test gha (#349) * add dbt.yml and integration test gha's * update dbt selector to run all integration tests in lq package * remove fail fast strategy --- .github/workflows/dbt.yml | 59 ++++++++++++++++++++++ .github/workflows/dbt_integration_test.yml | 19 +++++++ 2 files changed, 78 insertions(+) create mode 100644 .github/workflows/dbt.yml create mode 100644 .github/workflows/dbt_integration_test.yml diff --git a/.github/workflows/dbt.yml b/.github/workflows/dbt.yml new file mode 100644 index 0000000..418c1ff --- /dev/null +++ b/.github/workflows/dbt.yml @@ -0,0 +1,59 @@ +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 diff --git a/.github/workflows/dbt_integration_test.yml b/.github/workflows/dbt_integration_test.yml new file mode 100644 index 0000000..ec1f55f --- /dev/null +++ b/.github/workflows/dbt_integration_test.yml @@ -0,0 +1,19 @@ +name: 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 + + with: + warehouse: DBT_CLOUD + environment: ${{ github.ref == 'refs/heads/main' && 'prod' || 'stg' }} + command: dbt test -s 'livequery_models.deploy.core.*'