-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
1,502 additions
and
1,268 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains 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,17 @@ | ||
[tool.bumpversion] | ||
current_version = "3.0.5" | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "pyproject.toml" | ||
search = 'version = "{current_version}"' | ||
replace = 'version = "{new_version}"' | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "CITATION.cff" | ||
search = 'version: "{current_version}"' | ||
replace = 'version: "{new_version}"' | ||
|
||
[[tool.bumpversion.files]] | ||
filename = "deeprank2/__init__.py" | ||
search = '__version__ = "{current_version}"' | ||
replace = '__version__ = "{new_version}"' |
This file contains 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 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 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,139 @@ | ||
name: Draft GitHub Release | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version_level: | ||
description: "Semantic version level increase." | ||
required: true | ||
type: choice | ||
options: | ||
- patch | ||
- minor | ||
- major | ||
|
||
permissions: | ||
contents: write | ||
pull-requests: write | ||
|
||
jobs: | ||
draft_release: | ||
runs-on: "ubuntu-latest" | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
strategy: | ||
fail-fast: true | ||
|
||
steps: | ||
- name: Display selection | ||
run: | | ||
echo "Branch selected: '${{ github.ref_name }}'" | ||
echo "Release level selected: '${{ github.event.inputs.version_level }}'" | ||
- name: Ensure that permitted release branch was selected | ||
if: ${{ github.ref_name == 'main' || github.ref_name == 'dev' }} | ||
run: | | ||
echo "Branch selected: '${{ github.ref_name }}'" | ||
echo "Releasing from main or dev branch is not permitted, please select a different release branch." | ||
exit 1 | ||
- name: Check GitHub Token Validity | ||
run: | | ||
echo "-- Validating GitHub Token" | ||
status_code=$(curl -o /dev/null -s -w "%{http_code}" -H "Authorization: token ${{ secrets.GH_RELEASE }}" https://api.github.com/user) | ||
if [ "$status_code" -ne 200 ]; then | ||
echo "Error: GitHub token is invalid or expired. Please update your token in secrets." | ||
echo "Instructions can be found at: https://github.com/DeepRank/deeprank2/blob/main/README.dev.md#updating-the-token" | ||
exit 1 | ||
else | ||
echo "GitHub token is valid." | ||
fi | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# token with admin priviliges to override brach protection on main and dev | ||
token: ${{ secrets.GH_RELEASE }} | ||
ref: main | ||
fetch-depth: 0 | ||
|
||
- name: Configure git | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "GitHub Actions" | ||
git pull | ||
- name: Merge changes into main | ||
run: | | ||
git switch main | ||
git merge origin/${{ github.ref_name }} --no-ff --no-commit | ||
git commit --no-edit | ||
- name: Bump version | ||
id: bump | ||
run: | | ||
echo "-- install bump-my-version" | ||
python3 -m pip install bump-my-version | ||
echo "-- bump the version" | ||
bump-my-version bump ${{ github.event.inputs.version_level }} --commit --tag | ||
echo "-- push bumped version" | ||
echo "RELEASE_TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | ||
git push --tags -f | ||
git push | ||
- name: Create GitHub Release | ||
id: create_release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
gh release create ${{ steps.bump.outputs.RELEASE_TAG }} \ | ||
--title="Release ${{ steps.bump.outputs.RELEASE_TAG }}" \ | ||
--generate-notes \ | ||
--draft | ||
tidy_workspace: | ||
# only run if action above succeeds | ||
needs: draft_release | ||
runs-on: "ubuntu-latest" | ||
defaults: | ||
run: | ||
shell: bash -l {0} | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
# token with admin priviliges to override brach protection on main and dev | ||
token: ${{ secrets.GH_RELEASE }} | ||
fetch-depth: 0 | ||
|
||
- name: Configure git | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "GitHub Actions" | ||
git pull | ||
- name: Close PR | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
echo "-- searching for associated PR" | ||
pr_number=$(gh pr list --head ${{ github.ref_name }} --json number --jq '.[0].number') | ||
if [ -n "$pr_number" ]; then | ||
echo "-- closing PR #$pr_number" | ||
gh pr close $pr_number | ||
else | ||
echo "-- no open pull request found for branch $branch_name" | ||
fi | ||
- name: Merge updates into dev | ||
run: | | ||
git switch dev | ||
git merge origin/main | ||
git push | ||
- name: Delete release branch other than main or dev | ||
run: | | ||
echo "-- deleting branch '${{ github.ref_name }}'" | ||
git push origin -d ${{ github.ref_name }} |
File renamed without changes.
This file contains 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,59 @@ | ||
target-version = "py310" | ||
output-format = "concise" | ||
line-length = 159 | ||
|
||
[lint] | ||
select = ["ALL"] | ||
pydocstyle.convention = "google" # docstring settings | ||
ignore = [ | ||
# Unrealistic for this code base | ||
"PTH", # flake8-use-pathlib | ||
"N", # naming conventions | ||
"PLR0912", # Too many branches, | ||
"PLR0913", # Too many arguments in function definition | ||
"D102", # Missing docstring in public method | ||
# Unwanted | ||
"FBT", # Using boolean arguments | ||
"ANN101", # Missing type annotation for `self` in method | ||
"ANN102", # Missing type annotation for `cls` in classmethod | ||
"ANN204", # Missing return type annotation for special (dunder) method | ||
"B028", # No explicit `stacklevel` keyword argument found in warning | ||
"S105", # Possible hardcoded password | ||
"S311", # insecure random generators | ||
"PT011", # pytest-raises-too-broad | ||
"SIM108", # Use ternary operator | ||
# Unwanted docstrings | ||
"D100", # Missing module docstring | ||
"D104", # Missing public package docstring | ||
"D105", # Missing docstring in magic method | ||
"D107", # Missing docstring in `__init__` | ||
] | ||
|
||
# Autofix settings | ||
fixable = ["ALL"] | ||
unfixable = ["F401"] # unused imports (should not disappear while editing) | ||
extend-safe-fixes = [ | ||
"D415", # First line should end with a period, question mark, or exclamation point | ||
"D300", # Use triple double quotes `"""` | ||
"D200", # One-line docstring should fit on one line | ||
"TCH", # Format type checking only imports | ||
"ISC001", # Implicitly concatenated strings on a single line | ||
"EM", # Exception message variables | ||
"RUF013", # Implicit Optional | ||
"B006", # Mutable default argument | ||
] | ||
|
||
isort.known-first-party = ["deeprank2"] | ||
|
||
[lint.per-file-ignores] | ||
"tests/*" = [ | ||
"S101", # Use of `assert` detected | ||
"PLR2004", # Magic value used in comparison | ||
"D101", # Missing class docstring | ||
"D102", # Missing docstring in public method | ||
"D103", # Missing docstring in public function | ||
"SLF001", # private member access | ||
] | ||
"docs/*" = ["ALL"] | ||
"tests/perf/*" = ["T201"] # Use of print statements | ||
"*.ipynb" = ["T201", "E402", "D103"] |
This file contains 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 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.