diff --git a/.github/README.md b/.github/README.md index af944fc..e0c200b 100644 --- a/.github/README.md +++ b/.github/README.md @@ -7,7 +7,7 @@ ![Build Status](https://github.com/christophevg/baseweb/actions/workflows/test.yaml/badge.svg) [![Documentation Status](https://readthedocs.org/projects/baseweb/badge/?version=latest)](https://baseweb.readthedocs.io/en/latest/?badge=latest) [![Coverage Status](https://coveralls.io/repos/github/christophevg/baseweb/badge.svg?branch=master)](https://coveralls.io/github/christophevg/baseweb?branch=master) -[![Built with PyPi Template](https://img.shields.io/badge/PyPi_Template-v0.5.0-blue.svg)](https://github.com/christophevg/pypi-template) +[![Built with PyPi Template](https://img.shields.io/badge/PyPi_Template-v0.6.1-blue.svg)](https://github.com/christophevg/pypi-template) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 5fe3a52..de18da8 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,9 +11,9 @@ jobs: python-version: ["3.8", "3.9", "3.10", "3.11"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - name: Install dependencies @@ -24,12 +24,13 @@ jobs: - name: Lint with ruff run: | # stop the build if there are Python syntax errors or undefined names - ruff --output-format=github --select=E9,F63,F7,F82 --target-version=py38 . + ruff check --output-format=github --select=E9,F63,F7,F82 --target-version=py38 . # default set of ruff rules with GitHub Annotations - ruff --output-format=github --target-version=py38 . + ruff check --output-format=github --target-version=py38 . - name: Test with PyTest and generate coverage report run: | - coverage run -m --omit="*/.tox/*,*/distutils/*,tests/*" pytest + coverage run -m pytest coverage lcov + coverage report - name: Coveralls uses: coverallsapp/github-action@v2 diff --git a/Makefile b/Makefile index 0b0394f..a2ca766 100644 --- a/Makefile +++ b/Makefile @@ -11,9 +11,12 @@ PYTHON_VERSIONS ?= 3.8.12 3.9.18 3.10.13 3.11.5 RUFF_PYTHON_VERSION ?= py38 PROJECT=$(shell basename $(CURDIR)) -PACKAGE_NAME=`cat .pypi-template | grep "^package_module_name" | cut -d":" -f2` +PACKAGE_NAME=`cat .pypi-template | grep "^package_module_name" | cut -d":" -f2 | xargs` -RUN_CMD?=python -m $(PACKAGE_NAME) +LOG_LEVEL?=ERROR +SILENT?=yes + +RUN_CMD?=LOG_LEVEL=$(LOG_LEVEL) python -m $(PACKAGE_NAME) RUN_ARGS?= TEST_ENVS=$(addprefix $(PROJECT)-test-,$(PYTHON_VERSIONS)) @@ -49,7 +52,7 @@ $(PROJECT)-test-%: -pyenv virtualenv $* $@ > /dev/null pyenv local $@ pip install -U pip > /dev/null - pip install -U ruff tox > /dev/null + pip install -U ruff tox coverage > /dev/null uninstall: uninstall-envs @@ -71,28 +74,36 @@ upgrade: # env switching env-%: - pyenv local $(PROJECT)-$* + @echo "👷‍♂️ $(BLUE)activating $* environment$(NC)" + @pyenv local $(PROJECT)-$* env: - pyenv local $(PROJECT) + @echo "👷‍♂️ $(BLUE)activating project environment$(NC)" + @pyenv local $(PROJECT) env-test: - pyenv local $(TEST_ENVS) + @echo "👷‍♂️ $(BLUE)activating test environments$(NC)" + @pyenv local $(TEST_ENVS) # functional targets run: env-run - $(RUN_CMD) $(RUN_ARGS) + @echo "👷‍♂️ $(BLUE)running$(GREEN) $(RUN_CMD) $(RUN_ARGS)$(NC)" + @$(RUN_CMD) $(RUN_ARGS) test: env-test lint +ifeq ($(SILENT),yes) + tox -q +else tox +endif coverage: test coverage report + coverage lcov lint: env-test - ruff --select=E9,F63,F7,F82 --target-version=$(RUFF_PYTHON_VERSION) . - ruff --target-version=$(RUFF_PYTHON_VERSION) . + ruff check --target-version=$(RUFF_PYTHON_VERSION) . docs: env-docs cd docs; make html diff --git a/tox.ini b/tox.ini index 563de0a..3e1cdca 100644 --- a/tox.ini +++ b/tox.ini @@ -14,4 +14,4 @@ deps = pytest coverage commands = - coverage run -m --omit="*/.tox/*,*/distutils/*,tests/*" pytest {posargs} + coverage run -m pytest {posargs}