[Feature] Adiciona checagens para o dbt #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/[email protected] | |
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 }} |