From 035307c6542640295af82aeb6cab80c5d9e07ee3 Mon Sep 17 00:00:00 2001 From: Martin Bernstorff Date: Wed, 25 Oct 2023 17:40:16 +0200 Subject: [PATCH] feat: add makefile --- .github/workflows/release.yml | 35 ----------------------- makefile | 52 +++++++++++++++++++---------------- 2 files changed, 28 insertions(+), 59 deletions(-) delete mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index 3ec6f0f7..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,35 +0,0 @@ -# This workflow will -# 1) Update the version number in pyproject.toml based on the commit history -# 2) Create a git tag -# 3) Create a release on GitHub -# 4) Upload the package to PyPI - -# name: Release -# on: -# push: -# branches: [main] -# jobs: -# release: -# runs-on: ubuntu-latest -# concurrency: release - -# if: ${{ github.ref == 'refs/heads/main' }} -# steps: -# # Checkout action is required for token to persist -# - uses: actions/checkout@v3 -# with: -# fetch-depth: 0 -# token: ${{ secrets.GITHUB_TOKEN }} - -# - name: Python Semantic Release -# uses: relekang/python-semantic-release@v7.33.1 -# with: -# github_token: ${{ secrets.GITHUB_TOKEN }} -# # Remember to copy the [tool.semantic_release] section from pyproject.toml -# # as well -# # To enable pypi, -# # 1) Set upload_to_pypi to true in pyproject.toml and -# # 2) Set the pypi_token in the repo -# # 3) Uncomment the two lines below -# repository_username: __token__ -# repository_password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/makefile b/makefile index a547efa1..ac154ac9 100644 --- a/makefile +++ b/makefile @@ -1,28 +1,32 @@ -lint: - @echo Running black - black . +install-dev: + pip install -r dev-requirements.txt - @echo Running ruff - ruff check . --fix +install-deps: + pip install -r requirements.txt -test: - @echo ––– Testing ––– - pytest -n auto -rfE --failed-first --disable-warnings -q +install: + make install-deps + pip install -e . -type-check: - @echo ––– Running static type checks ––– - pyright . +test: ## Run tests + pytest {{cookiecutter.package_name}} -install: - pip install --upgrade -e .[dev,tests] - -validate: - @echo ––– Ensuring dependencies are up to date. This will take a few moments --- - @make install > /dev/null - @make lint && make type-check && make test - -pr: - gh pr create -w - make validate - git push - gh pr merge --auto --merge \ No newline at end of file +lint: ## Format code + ruff check {{cookiecutter.package_name}} --fix + ruff format {{cookiecutter.package_name}} + +type-check: ## Type-check code + pyright {{cookiecutter.package_name}} + +validate: ## Run all checks + make lint + make type-check + make test + +create-and-merge-pr: + gh pr create -w || true + gh pr merge --auto --merge --delete-branch + +pr: ## Run relevant tests before PR + make create-and-merge-pr + make validate \ No newline at end of file