diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01cbb8f..0f188c6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index e055d2f..d1357ed 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -12,6 +12,10 @@ jobs: steps: - uses: actions/checkout@v3 + with: + ref: ${{ github.head_ref }} + fetch-depth: 1 + fetch-tags: True - name: Set up Python 3.10 uses: actions/setup-python@v4 with: diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b6cfb52..19ba502 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0051c3c..5aadd30 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: platform: [ubuntu-latest, macos-latest, windows-latest] - python-version: ['3.8', '3.9', '3.10', '3.11'] + python-version: ['3.9', '3.10', '3.11', '3.12'] steps: - uses: actions/checkout@v3 @@ -27,9 +27,11 @@ jobs: run: tox -e test - name: Upload coverage to Codecov - uses: codecov/codecov-action@v3 + uses: codecov/codecov-action@v4 with: env_vars: OS,PYTHON files: ./coverage.xml fail_ci_if_error: true verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/devtools/check_changelog.py b/devtools/check_changelog.py index 6cc79d1..d2b3625 100644 --- a/devtools/check_changelog.py +++ b/devtools/check_changelog.py @@ -5,11 +5,10 @@ * additions are reported in CHANGELOG.rst """ +import os from pathlib import Path -folder = Path(__file__).resolve().parents[1] -changelog = Path('docs', 'CHANGELOG.rst') -contributing = Path('docs', 'CONTRIBUTING.rst') +import git class ChangelogError(Exception): @@ -18,13 +17,27 @@ class ChangelogError(Exception): pass -with open(Path(folder, changelog), 'r') as fin: +folder = Path(__file__).resolve().parents[1] +changelog = Path("docs", "CHANGELOG.rst") +contributing = Path("docs", "CONTRIBUTING.rst") + +repo = git.Repo(folder) + +# Check if the developer is on the main branch +# We check if the head commit is the same as the main branch head commit +# as the CI will be in detached head state +if repo.active_branch.name == 'main': + print("You are on the main branch. Nothing to check.") + exit(0) + +with open(Path(folder, changelog), "r") as fin: for line in fin: - if line.startswith('v'): + if line.startswith("v"): raise ChangelogError( - 'You have not updated the CHANGELOG file. ' - f'Please add a summary of your additions to {str(changelog)!r} ' - f'as described in {str(contributing)!r}.' - ) - elif line.startswith('*'): - break + "You have not updated the CHANGELOG file. " + f"Please add a summary of your additions to {str(changelog)!r}" + f" as described in {str(contributing)!r}." + ) + elif line.startswith("*"): + print("Changelog updated.") + exit(0) diff --git a/docs/CHANGELOG.rst b/docs/CHANGELOG.rst index 4a77fdc..9f61bdc 100644 --- a/docs/CHANGELOG.rst +++ b/docs/CHANGELOG.rst @@ -2,6 +2,9 @@ Changelog ========= +* Add Python 3.12 +* Remove Python 3.8 +* Change handling of CHANGELOG checks v0.1.30 (2024-04-03) ------------------------------------------ diff --git a/pyproject.toml b/pyproject.toml index 500a049..52fd9e3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,7 +12,7 @@ authors = [ {name = "MDAnalysis Development Team and contributors", email = "mdanalysis@numfocus.org"}, ] readme = "README.rst" -requires-python = ">=3.8" +requires-python = ">=3.9" keywords = [ "python", "cli", @@ -36,10 +36,10 @@ classifiers = [ "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Topic :: Scientific/Engineering", "Topic :: Scientific/Engineering :: Bio-Informatics", "Topic :: Scientific/Engineering :: Chemistry", diff --git a/tox.ini b/tox.ini index dcc94bc..01e7e52 100644 --- a/tox.ini +++ b/tox.ini @@ -71,7 +71,6 @@ skip_install = true commands_pre = python {toxinidir}/devtools/clean_dist_check.py commands = python --version - python {toxinidir}/devtools/check_changelog.py python -m build twine check dist/*.whl twine check dist/*.tar.gz @@ -95,8 +94,10 @@ commands = usedevelop = true deps = -r{toxinidir}/devtools/docs_requirements.txt + gitpython commands = sphinx-build {posargs:-E} -b html docs/rst dist/docs + python {toxinidir}/devtools/check_changelog.py [testenv:safety] deps = safety