From 23a28d8ed7f2330c95b6b0baef6ca116e0eb59a1 Mon Sep 17 00:00:00 2001 From: desmond-hui <97470747+desmond-hui@users.noreply.github.com> Date: Wed, 18 Sep 2024 06:42:28 -0700 Subject: [PATCH] Add test workflow (#23) * modify test * add test daily workflow --------- Co-authored-by: desmond-hui --- .github/workflows/dbt_test_daily.yml | 45 ++++++++++++++++++++++++++++ tests/test_silver__blocks_gaps.sql | 2 ++ 2 files changed, 47 insertions(+) create mode 100644 .github/workflows/dbt_test_daily.yml diff --git a/.github/workflows/dbt_test_daily.yml b/.github/workflows/dbt_test_daily.yml new file mode 100644 index 0000000..a90401c --- /dev/null +++ b/.github/workflows/dbt_test_daily.yml @@ -0,0 +1,45 @@ +name: dbt_test_daily +run-name: dbt_test_daily + +on: + workflow_dispatch: + schedule: + # Run at 8:19am UTC daily (see https://crontab.guru) + - cron: '19 8 * * *' + +env: + DBT_PROFILES_DIR: "${{ vars.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: "${{ vars.PYTHON_VERSION }}" + cache: "pip" + + - name: install dependencies + run: | + pip install -r requirements.txt + dbt deps + - name: Run DBT Jobs + run: | + dbt test -s "eclipse_models,tag:scheduled_core" "eclipse_models,tag:scheduled_non_core" diff --git a/tests/test_silver__blocks_gaps.sql b/tests/test_silver__blocks_gaps.sql index 1db0514..d5aa58b 100644 --- a/tests/test_silver__blocks_gaps.sql +++ b/tests/test_silver__blocks_gaps.sql @@ -42,3 +42,5 @@ SELECT gap_end_block_id - gap_start_block_id AS diff FROM gaps +WHERE + gap_end_block_id <> 6572202 /* we know that blocks 0 to 6572202 is currently unavailable */ \ No newline at end of file