From 012a6dfb165696416350c19c8bb151e02643a4b1 Mon Sep 17 00:00:00 2001 From: Harrison Chase Date: Mon, 13 Feb 2023 21:08:47 -0800 Subject: [PATCH] Harrison/makefile (#1033) Co-authored-by: blob42 Co-authored-by: blob42 --- .github/workflows/test.yml | 2 +- CONTRIBUTING.md | 4 +++- Makefile | 23 +++++++++++++++++++++-- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f33e67ec..0a9469d8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,4 +31,4 @@ jobs: run: poetry install - name: Run unit tests run: | - make tests + make test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 46892139..ab47c01b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -77,6 +77,8 @@ Now, you should be able to run the common tasks in the following section. ## âś…Common Tasks +Type `make` for a list of common tasks. + ### Code Formatting Formatting for this project is done via a combination of [Black](https://black.readthedocs.io/en/stable/) and [isort](https://pycqa.github.io/isort/). @@ -116,7 +118,7 @@ Unit tests cover modular logic that does not require calls to outside APIs. To run unit tests: ```bash -make tests +make test ``` If you add new logic, please add a unit test. diff --git a/Makefile b/Makefile index 04f252f4..39956eb3 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,15 @@ -.PHONY: format lint tests tests_watch integration_tests +.PHONY: all clean format lint test test_watch integration_tests help +all: help + coverage: poetry run pytest --cov \ --cov-config=.coveragerc \ --cov-report xml \ --cov-report term-missing:skip-covered +clean: docs_clean + docs_build: cd docs && poetry run make html @@ -25,11 +29,26 @@ lint: poetry run isort . --check poetry run flake8 . +test: + poetry run pytest tests/unit_tests + tests: poetry run pytest tests/unit_tests -tests_watch: +test_watch: poetry run ptw --now . -- tests/unit_tests integration_tests: poetry run pytest tests/integration_tests + +help: + @echo '----' + @echo 'coverage - run unit tests and generate coverage report' + @echo 'docs_build - build the documentation' + @echo 'docs_clean - clean the documentation build artifacts' + @echo 'docs_linkcheck - run linkchecker on the documentation' + @echo 'format - run code formatters' + @echo 'lint - run linters' + @echo 'test - run unit tests' + @echo 'test_watch - run unit tests in watch mode' + @echo 'integration_tests - run integration tests'