forked from dbt-labs/jaffle-sl-template
-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (46 loc) · 1.78 KB
/
pull_request_lint_models.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
name: Lint Models
on:
pull_request:
push:
branches:
- '!main'
jobs:
lint-models:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install -r requirements.txt
- name: Set up Snowflake profile
env:
SNOWFLAKE_USER: ${{ secrets.SNOWFLAKE_USER }}
SNOWFLAKE_PASSWORD: ${{ secrets.SNOWFLAKE_PASSWORD }}
SNOWFLAKE_ACCOUNT: ${{ secrets.SNOWFLAKE_ACCOUNT }}
SNOWFLAKE_DATABASE: ${{ secrets.SNOWFLAKE_DATABASE }}
SNOWFLAKE_WAREHOUSE: ${{ secrets.SNOWFLAKE_WAREHOUSE }}
SNOWFLAKE_ROLE: ${{ secrets.SNOWFLAKE_ROLE }}
run: |
mkdir -p ~/.dbt/
echo "snowflake:" >> ~/.dbt/profiles.yml
echo " target: prod" >> ~/.dbt/profiles.yml
echo " outputs:" >> ~/.dbt/profiles.yml
echo " prod:" >> ~/.dbt/profiles.yml
echo " type: snowflake" >> ~/.dbt/profiles.yml
echo " account: $SNOWFLAKE_ACCOUNT" >> ~/.dbt/profiles.yml
echo " user: $SNOWFLAKE_USER" >> ~/.dbt/profiles.yml
echo " password: $SNOWFLAKE_PASSWORD" >> ~/.dbt/profiles.yml
echo " role: $SNOWFLAKE_ROLE" >> ~/.dbt/profiles.yml
echo " database: $SNOWFLAKE_DATABASE" >> ~/.dbt/profiles.yml
echo " warehouse: $SNOWFLAKE_WAREHOUSE" >> ~/.dbt/profiles.yml
echo " schema: pr_$(date +%s)" >> ~/.dbt/profiles.yml
- name: Install dbt Dependencies
run: dbt deps
- name: Generate dbt manifest.json
run: dbt ls # or dbt compile
- name: Lint models
run: "sqlfluff lint models"