Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBT-751: Added Makefile and fix the version in Readme #185

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 62 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
.DEFAULT_GOAL:=help

# define the name of the virtual environment directory
VENV := .venv3.8.16

# define the profile used by the dbt
PROFILE := dwx_endpoint

CHANGED_FILES := $(shell git ls-files --modified --other --exclude-standard)
CHANGED_FILES_IN_BRANCH := $(shell git diff --name-only $(shell git merge-base origin/master HEAD))

.PHONY: all install prepare-env functional_test test clean help
.PHONY: pre-commit pre-commit-in-branch pre-commit-all

all: prepare-env test ## Default target for dev setup and run tests.

# Required python3 already installed in the system
$(VENV)/bin/activate:
@\
python3 -m venv $(VENV)

install: $(VENV)/bin/activate dev-requirements.txt ## Install all dependencies.
@\
$(VENV)/bin/python3 -m pip install --upgrade pip
$(VENV)/bin/pip install -e . -r dev-requirements.txt

prepare-env: $(VENV)/bin/activate ## Install all dependencies and setup pre-commit.
@\
make install
$(VENV)/bin/pre-commit install

functional_test: ## Run functional tests.
$(VENV)/bin/python3 -m pytest --profile $(PROFILE) $(TESTS) $(FLAGS)

test: ## Run all tests.
@make functional_test

clean: ## Cleanup and reset development environment.
@echo 'cleaning virtual environment...'
rm -rf $(VENV)
@find . -type f -name '*.pyc' -delete
@find . -type d -name '__pycache__' -depth -delete
@echo 'done.'

pre-commit: ## check modified and added files (compared to last commit!) with pre-commit.
$(VENV)/bin/pre-commit run --files $(CHANGED_FILES)

pre-commit-in-branch: ## check changed since origin/master files with pre-commit.
$(VENV)/bin/pre-commit run --files $(CHANGED_FILES_IN_BRANCH)

pre-commit-all: ## Check all files in working directory with pre-commit.
$(VENV)/bin/pre-commit run --all-files

help: ## Show this help message.
@echo 'usage: make [target] [VENV=.venv] [PROFILE=dwx_endpoint]'
@echo
@echo 'targets:'
@grep -E '^[8+a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@echo
@echo 'options:'
@echo 'use VENV=<dir> to specify virtual enviroment directory'
@echo 'use PROFILE=<profile> to use specific endpoint/warehouse'
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ The `dbt-impala` adapter allows you to use [dbt](https://www.getdbt.com/) along

### Requirements

Current version of dbt-impala work only with dbt-core 1.3 but not with dbt-core >= 1.4.
We are actively working on next release 1.4 which will work with dbt-core 1.4
Current version of dbt-impala work only with dbt-core 1.4 but not with dbt-core >= 1.5.
We are actively working on next release 1.5 which will work with dbt-core 1.5

Python >= 3.7
dbt-core == 1.3.*
Expand Down