Repository navigation
Workflow improvements #116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
78ee7f9
ci: bump all non-ISARIC actions to latest release commit SHAs
sr-murthy 735d93e
add Makefile and use Makefile targets to tidy up workflows
sr-murthy 59736d3
Add UV tool section in project TOML
sr-murthy f7f758d
Fixes and improvements in the Makefile, test workflow and project TOML
sr-murthy 2c1d40f
Further fixes in the Makefile and project TOML
sr-murthy 0879f1a
Pytest options fixes and additions in the Makefile and project TOML
sr-murthy 168d8eb
Tweak Makefile UV sync deps targets
sr-murthy 8ebadea
Makefile tweaks
sr-murthy f868a32
RTD YML fix for installing deps via UV
sr-murthy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: pre-commit | ||
|
|
||
| on: | ||
| push: | ||
| branches: [main] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| pre-commit: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Run pre-commit hooks | ||
| run: | | ||
| python3 -m pip install pre-commit | ||
| make pre-commit | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ sphinx: | |
|
|
||
| python: | ||
| install: | ||
| - method: pip | ||
| path: . | ||
| extra_requirements: | ||
| - method: uv | ||
| command: sync | ||
| groups: | ||
| - docs | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| FROM python:3.11-slim | ||
| FROM python:3.12-slim | ||
|
|
||
| # Set the working directory | ||
| WORKDIR /app | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| SHELL := /bin/bash | ||
|
|
||
| REPO := https://github.com/ISARICResearch/VERTEX | ||
|
|
||
| PACKAGE_NAME := vertex | ||
| BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
| HEAD := $(shell git rev-parse --short=8 HEAD) | ||
| PACKAGE_VERSION := $(shell grep __version__ vertex/__init__.py | cut -d '=' -f 2 | xargs) | ||
|
|
||
| PROJECT_ROOT := $(PWD) | ||
|
|
||
| TESTS_ROOT := $(PROJECT_ROOT)/tests | ||
|
|
||
| DOCS_ROOT := $(PROJECT_ROOT)/docs | ||
| DOCS_BUILD := $(DOCS_ROOT)/_build | ||
| DOCS_BUILD_HTML := $(DOCS_ROOT)/_build/html | ||
|
|
||
|
|
||
| # --- Git --- | ||
| # | ||
| # Git staging | ||
| git-stage: | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Staging new, modified, deleted and/or renamed files in Git" | ||
| git status -uno | grep modified | tr -s ' ' | cut -d ' ' -f 2 | xargs git add && \ | ||
| git status -uno | grep deleted | tr -s ' ' | cut -d ' ' -f 2 | xargs git add -A && \ | ||
| git status -uno | ||
|
|
||
| # --- Housekeeping --- | ||
| .PHONY: clean | ||
| clean: | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Deleting all temporary files" | ||
| rm -fr dist/* docs/_build/* .pytest_cache *.pyc *__pycache__* ./dist/* ./build/* *.egg-info* | ||
| python3 -m pip uninstall -y isaric-vertex | ||
|
|
||
| # --- Version commands --- | ||
| # | ||
| # Just display the version | ||
| version-extract: | ||
| @echo "$(PACKAGE_VERSION)" | ||
|
|
||
| # --- Member inspection of Python files --- | ||
| # | ||
| # Parameterised command to lexicographically list all callables (functions, | ||
| # classes) in path-specified Python modules including: | ||
| # | ||
| # functions: | ||
| # | ||
| # list-members MEMBER_REGEX="def" FILE_PATH="/path/to/py/file" | ||
| # | ||
| # classes: | ||
| # | ||
| # list-members MEMBER_REGEX="class" FILE_PATH="/path/to/py/file" | ||
| # | ||
| # functions or classes (inclusive): | ||
| # | ||
| # list-members MEMBER_REGEX="def\|class" FILE_PATH="/path/to/py/file" | ||
| # | ||
| # where the '|' represents an OR operator for grep that needs to be escaped with the backslash '\'. | ||
| list-callables: | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Lexicographical listing of all callable members ($(MEMBER_REGEX)) of a Python file" | ||
| grep "$(MEMBER_REGEX)" $(FILE_PATH) | sort | cut -d ' ' -f 2 | cut -d '(' -f 1 | ||
|
|
||
| # --- Dependency management --- | ||
| sync-deps-exact: | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Syncing all package + development dependencies with lockfile, removing unrelated dependencies" | ||
| rm -f uv.lock && \ | ||
| uv sync --verbose --all-groups --no-editable --no-install-project --no-cache --refresh --no-managed-python | ||
|
|
||
| sync-deps-inexact: | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Syncing all package + development dependencies with lockfile, preserving unrelated dependencies" | ||
| rm -f uv.lock && \ | ||
| uv sync --verbose --all-groups --no-editable --no-install-project --no-cache --refresh --inexact --no-managed-python | ||
|
|
||
| # --- Package artifacts --- | ||
| # | ||
| # Only source distributions are required, no wheel. | ||
| .PHONY: sdist | ||
| sdist: clean | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Building a source distribution of VERTEX" | ||
| uv build --verbose --sdist && ls -al dist/*.tar.gz | ||
|
|
||
| .PHONE: uninstall | ||
| uninstall: clean | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Uninstalling any existing installed VERTEX distribution" | ||
|
|
||
| # --- Documentation --- | ||
| .PHONY: clean | ||
| docs: clean | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Building Sphinx docs (using the Sphinx Makefile in ./docs/)" | ||
| make -C docs html | ||
|
|
||
| # --- Pre-commit --- | ||
| .PHONY: clean | ||
| pre-commit: clean | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Running pre-commit hooks" | ||
| pre-commit run --all-files | ||
|
|
||
| # --- Tests --- | ||
| # | ||
| # Unit tests - use the `MARKER` variable to indicate markers, e.g. | ||
| # "critical or high", or "medium or low". Note that in the `test` target | ||
| # command below, the `MARKER` variable must be quoted to prevent expansion | ||
| # in case of spaces in the marker. | ||
| .PHONY: test | ||
| test: clean | ||
| @echo "$(PACKAGE_NAME)[$(BRANCH)@$(HEAD)]: Running unit tests + measuring coverage" | ||
| PYTHONPATH=src uv run --verbose --active -m pytest \ | ||
| -p pytest_cov \ | ||
| -q -m "$(MARKER)" \ | ||
| --cache-clear \ | ||
| --capture=no \ | ||
| --code-highlight=yes \ | ||
| --color=yes \ | ||
| --cov=vertex \ | ||
| --cov-report=term-missing:skip-covered \ | ||
| --cov-report=xml \ | ||
| --cov-report=html \ | ||
| -ra \ | ||
| --tb=native \ | ||
| --verbosity=3 \ | ||
| $(TESTS_PATH) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.