diff --git a/.github/workflows/django.yml b/.github/workflows/django.yml new file mode 100644 index 0000000..b9fcb38 --- /dev/null +++ b/.github/workflows/django.yml @@ -0,0 +1,27 @@ +name: Django CI Nau Financial Manager + +on: + push: + branches: [ 85-add-continuous-integration-with-github-actions ] + pull_request: + branches: [ main ] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup Poetry + run: make install-poetry install-packages + + - name: Get all containers up and running + run: cp sample-dev.env .env; make hr-docker + + - name: Run Django tests + run: make test + + - name: Run pre-commit checks + run: make pre-commit diff --git a/Makefile b/Makefile index e73521e..a726bbf 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,6 @@ #Variables PYTHON_PATH_ENV_APP=$(shell which python) +POETRY = poetry SRC_DIR = src TEST_DIR = tests POETRY_RUN = poetry run @@ -95,3 +96,13 @@ hr-docker: ## remake complete docker environment (destroy dockers, prune docker, create-token: ## create token for admin user $(CREATE_TOKEN) .PHONY: create-token + +install-poetry: ## Install Poetry + @echo "Installing Poetry..." + @curl -sSL https://install.python-poetry.org | python - +.PHONY: install-poetry + +install-packages: ## Install project dependencies + @echo "Installing project dependencies..." + @$(POETRY) install +.PHONY: install-packages diff --git a/sample-dev.env b/sample-dev.env index 22351f8..adffae7 100644 --- a/sample-dev.env +++ b/sample-dev.env @@ -8,7 +8,7 @@ MYSQL_USER=nau_user MYSQL_USER_ROOT=root MYSQL_PASSWORD=nau_password MYSQL_ROOT_PASSWORD=nau_password -DB_HOST=database +DB_HOST=127.0.0.1 DB_PORT=3306 SWAGGER_PROJECT_NAME=Nau Financial Manager