Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 27 additions & 15 deletions .github/workflows/recce_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,24 @@ on:
jobs:
check-pull-request:
name: Prepare for Recce
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
RECCE_STATE_PASSWORD: ${{ secrets.RECCE_STATE_PASSWORD }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: 1

- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"

- name: Install dependencies
run: pip install -r requirements.txt
run: |
pip install -r requirements.txt
pip install -U recce

- name: Trigger the dbt cloud job and fetch artifacts for Recce
uses: datarecce/dbt-cloud-action@main
Expand All @@ -27,34 +32,37 @@ jobs:
dbt_cloud_token: ${{ secrets.DBT_CLOUD_API_TOKEN }}
dbt_cloud_account_id: 62083
dbt_cloud_base_job_id: 747906
dbt_cloud_current_job_id: 747907
dbt_cloud_current_job_id: 768650
git_sha: ${{ github.event.pull_request.head.sha }}
schema_override: "PR_${{ github.event.pull_request.number }}"
failure_on_error: true

- uses: "google-github-actions/auth@v2"
id: google-auth
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY_JSON }}

- name: Run Recce in cloud mode
- name: Run dbt
run: |
pwd
tree -L 1
dbt deps
dbt docs generate --select state:modified --defer --state target-base
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: recce_ci
BQ_DATASET: "PR_${{ github.event.pull_request.number }}"
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
RECCE_STATE_PASSWORD: ${{ secrets.RECCE_STATE_PASSWORD }}
run: recce run --cloud

- name: Prepare Recce Summary
id: recce-summary
- name: Run Recce in cloud mode
run: recce run --cloud
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: recce_ci
BQ_DATASET: "PR_${{ github.event.pull_request.number }}"
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
RECCE_STATE_PASSWORD: ${{ secrets.RECCE_STATE_PASSWORD }}
run: |
set -eo pipefail

- name: Prepare Recce Summary
id: recce-summary
run: |
recce summary --cloud > recce_summary.md

# Add next steps message
Expand All @@ -76,6 +84,10 @@ jobs:
For the full summary, please check the Job Summary page: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
" >> recce_summary.md
fi
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: "PR_${{ github.event.pull_request.number }}"
BQ_KEYFILE_PATH: ${{ steps.google-auth.outputs.credentials_file_path }}

- name: Comment on pull request
uses: thollander/actions-comment-pull-request@v2
Expand Down
2 changes: 1 addition & 1 deletion models/marts/customers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ customer_orders_summary as (
orders.customer_id,

count(distinct orders.order_id) as count_lifetime_orders,
count(distinct orders.order_id) > 1 as is_repeat_buyer,
count(distinct orders.order_id) > 2 as is_repeat_buyer,
min(orders.ordered_at) as first_ordered_at,
max(orders.ordered_at) as last_ordered_at,
sum(orders.subtotal) as lifetime_spend_pretax,
Expand Down
13 changes: 13 additions & 0 deletions recce.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Preset Checks
# Please see https://datarecce.io/docs/features/preset-checks/
checks:
- name: Row count diff
description: Check the row count diff for all table models.
type: row_count_diff
params:
select: state:modified,config.materialized:table
- name: Schema diff
description: Check the schema diff for all nodes.
type: schema_diff
params:
select: state:modified,config.materialized:table
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ pyyaml==6.0.1
# dbt-core
# dbt-semantic-interfaces
# pre-commit
recce==0.37.0
recce~=0.37.0
# via -r requirements.in
referencing==0.35.1
# via
Expand Down