Skip to content

Commit

Permalink
Update pipeline (#119)
Browse files Browse the repository at this point in the history
  • Loading branch information
hejamu authored Jul 8, 2024
1 parent 561b998 commit c2d7543
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 18 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }}
35 changes: 24 additions & 11 deletions devtools/check_changelog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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)
3 changes: 3 additions & 0 deletions docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
Changelog
=========

* Add Python 3.12
* Remove Python 3.8
* Change handling of CHANGELOG checks

v0.1.30 (2024-04-03)
------------------------------------------
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit c2d7543

Please sign in to comment.