Skip to content

Commit

Permalink
ci/cd: update Makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
oedokumaci committed Jan 5, 2024
1 parent c5082b4 commit 2288207
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: help vscode-settings setup run project-help test pre-commit clean
.PHONY: help vscode-settings setup update-dev update-user run project-help test pre-commit clean

help: ## Show this help message for each Makefile recipe
ifeq ($(OS),Windows_NT)
Expand All @@ -11,24 +11,28 @@ setup: ## Setup project
pdm install
pdm run pre-commit install

update-dev: ## Update project dependencies for development
pdm update
pdm run pre-commit autoupdate
make test

update-user: ## Download latest project version and dependencies for user
git pull
pdm sync
make test

vscode-settings: ## Generate VSCode settings file
@mkdir -p .vscode
ifeq ($(OS),Windows_NT)
@echo { > .vscode/settings.json
@echo " \"python.linting.enabled\": true," >> .vscode/settings.json
@echo " \"python.linting.pylintEnabled\": false," >> .vscode/settings.json
@echo " \"python.linting.flake8Enabled\": true," >> .vscode/settings.json
@echo " \"python.linting.flake8Args\": [\"--max-line-length=88\", \"--select=C,E,F,W,B\", \"--extend-ignore=B009,E203,E501,W503\"]," >> .vscode/settings.json
@echo " \"flake8.args\": [\"--max-line-length=88\", \"--select=C,E,F,W,B\", \"--extend-ignore=B009,E203,E501,W503\"]," >> .vscode/settings.json
@echo " \"python.autoComplete.extraPaths\": [\".venv/Lib/site-packages\"]," >> .vscode/settings.json
@echo " \"python.analysis.extraPaths\": [\".venv/Lib/site-packages\"]," >> .vscode/settings.json
@echo " \"python.testing.pytestPath\": \".venv/Scripts/pytest\"" >> .vscode/settings.json
@echo } >> .vscode/settings.json
else
@echo '{' > .vscode/settings.json
@echo ' "python.linting.enabled": true,' >> .vscode/settings.json
@echo ' "python.linting.pylintEnabled": false,' >> .vscode/settings.json
@echo ' "python.linting.flake8Enabled": true,' >> .vscode/settings.json
@echo ' "python.linting.flake8Args": ["--max-line-length=88", "--select=C,E,F,W,B", "--extend-ignore=B009,E203,E501,W503"],' >> .vscode/settings.json
@echo ' "flake8.args": ["--max-line-length=88", "--select=C,E,F,W,B", "--extend-ignore=B009,E203,E501,W503"],' >> .vscode/settings.json
@echo ' "python.autoComplete.extraPaths": [".venv/lib/python$${env:PYTHON_VER}/site-packages"],' >> .vscode/settings.json
@echo ' "python.analysis.extraPaths": [".venv/lib/python$${env:PYTHON_VER}/site-packages"],' >> .vscode/settings.json
@echo ' "python.testing.pytestPath": ".venv/bin/pytest"' >> .vscode/settings.json
Expand All @@ -41,19 +45,21 @@ run: ## Run project
project-help: ## Show project help
pdm run python -m gale_shapley --help

test: clean ## Run tests
test: ## Run tests
pdm run pytest tests -v

pre-commit: ## Run pre-commit
pre-commit: clean ## Run pre-commit
pdm run pre-commit run --all-files

clean: ## Clean cached files
ifeq ($(OS),Windows_NT)
rmdir /s /q .mypy_cache || true
rmdir /s /q .pytest_cache || true
rmdir /s /q src\gale_shapley\__pycache__ || true
rmdir /s /q tests\__pycache__ || true
del /q logs\pytest_test.log || :
rmdir /s /q .mypy_cache || :
rmdir /s /q .pytest_cache || :
rmdir /s /q src\gale_shapley\__pycache__ || :
rmdir /s /q tests\__pycache__ || :
else
rm -f logs/pytest_test.log
rm -rf .mypy_cache
rm -rf .pytest_cache
rm -rf src/gale_shapley/__pycache__
Expand Down

0 comments on commit 2288207

Please sign in to comment.