-
Notifications
You must be signed in to change notification settings - Fork 0
53 lines (43 loc) · 1.26 KB
/
dbt-checks.yaml
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
name: DBT Checks
on:
pull_request:
branches:
- main
- staging/*
paths:
- "queries/**/*.sql"
env:
DBT_USER: ${{ github.actor }}
jobs:
check-files:
name: Compile DBT models and format SQL
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python version
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install requirements
run: |-
pip install --no-cache-dir -r requirements.txt
- name: Install sqlfmt
run: pip install shandy-sqlfmt[jinjafmt]
# Setup gcloud CLI
- name: Setup Google Cloud CLI
uses: google-github-actions/setup-gcloud@v0.2.1
with:
service_account_key: ${{ secrets.GKE_SA_KEY }}
project_id: ${{ secrets.GKE_PROJECT_ID}}
export_default_credentials: true
- name: Setup DBT profile
working-directory: queries
run: sh setup_dbt_profiles.sh
- name: Run DBT compile
working-directory: queries
run: |-
dbt compile --profiles-dir profiles
- name: Run sqlfmt
working-directory: queries
run: sqlfmt --diff ${{ steps.changed-files.outputs.all_changed_files }}