generated from dbt-labs/jaffle-shop
-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (89 loc) · 3.26 KB
/
recce_ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: Recce with dbt cloud
on:
pull_request:
branches: [main]
jobs:
prepare-artifacts:
name: Prepare for Recce
runs-on: ubuntu-latest
steps:
- name: Trigger the dbt cloud job and fetch artifacts for Recce
uses: datarecce/dbt-cloud-action@main
id: recce_dbt_cloud_run
with:
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
failure_on_error: true
- name: Upload DBT Artifacts for CICD job
uses: actions/upload-artifact@v4
with:
name: target
path: target/
- name: Upload DBT Artifacts for Prod job
uses: actions/upload-artifact@v4
with:
name: target-base
path: target-base/
recce-run:
needs: prepare-artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: "pip"
- name: Install dependencies
run: pip install -r requirements.txt
- uses: "google-github-actions/auth@v2"
id: google-auth
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY_JSON }}
- name: Download artifactss
uses: actions/download-artifact@v4
- name: Update dbt dependencies
run: dbt deps
- name: Run Recce in cloud mode
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: recce_ci
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
env:
BQ_PROJECT: ${{ steps.google-auth.outputs.project_id }}
BQ_DATASET: recce_ci
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
recce summary --cloud > recce_summary.md
# Add next steps message
cat << EOF >> recce_summary.md
## Next Steps
To view detailed Recce results:
1. Checkout the PR branch: \`git checkout ${{ github.event.pull_request.head.ref }}\`
2. Launch the Recce server: \`recce server --review --cloud\`
3. Open http://localhost:8000 in your browser
EOF
# Truncate summary if it exceeds GitHub's comment size limit
if [[ $(wc -c < recce_summary.md) -ge 65535 ]]; then
truncate -s 65000 recce_summary.md
echo "
... (Summary truncated due to size limit)
For the full summary, please check the Job Summary page: ${{github.server_url}}/${{github.repository}}/actions/runs/${{github.run_id}}
" >> recce_summary.md
fi
- name: Comment on pull request
uses: thollander/actions-comment-pull-request@v2
with:
filePath: recce_summary.md
comment_tag: recce