Skip to content

Workflow file for this run

name: DBT ANSI-compliant CI/CD Pipeline
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
lint-sql:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install sqlfluff
run: pip install sqlfluff
- name: Lint SQL files
run: sqlfluff lint models --dialect ansi
dbt-run:
needs: lint-sql
runs-on: ubuntu-latest
services:
postgres:
image: postgres:12
env:
POSTGRES_DB: dbt
POSTGRES_USER: user
POSTGRES_PASSWORD: password
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dbt-postgres
run: pip install dbt-postgres
- name: Set up dbt profile
run: |
mkdir -p ~/.dbt
echo "config_version: 2
profiles.yml:
crispy_dataprep:
target: dev
outputs:
dev:
type: postgres
threads: 1
host: localhost
port: 5432
user: user
pass: password
dbname: dbt
schema: public" > ~/.dbt/profiles.yml
- name: Run dbt
run: dbt run --profiles-dir ~/.dbt