Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavcs committed Nov 30, 2024
1 parent f1ec350 commit cadd3d8
Show file tree
Hide file tree
Showing 8 changed files with 542 additions and 257 deletions.
509 changes: 276 additions & 233 deletions galaxy_release_util/bootstrap_history.py

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ include_package_data = True
install_requires =
build
click
python-dateutil
docutils
packaging
PyGithub
Expand Down
99 changes: 75 additions & 24 deletions tests/test_bootstrap_history.py
Original file line number Diff line number Diff line change
@@ -1,39 +1,59 @@
import datetime
from packaging.version import Version
from pathlib import Path
import os
import click
from click.testing import CliRunner

import pytest
from packaging.version import Version

from galaxy_release_util import bootstrap_history
from galaxy_release_util.bootstrap_history import (
#_get_release_date,
from galaxy_release_util.bootstrap_history import ( # _get_release_date,
_get_next_release_version,
_get_previous_release_version,
_get_next_release_version,
_get_release_version_strings,
create_changelog,
)

# TODO do we need this???
## test data tuples: freeze date, expected release date
## (assumption: FREEZE_TO_RELEASE_DELTA_DAYS = 21)
#release_date_test_data = [
# (datetime.datetime(2024, 11, 1), datetime.datetime(2024, 11, 22)), # expect Friday
# (datetime.datetime(2024, 11, 2), datetime.datetime(2024, 11, 25)), # expect Monday (not Saturday)
# (datetime.datetime(2024, 11, 3), datetime.datetime(2024, 11, 25)), # expect Monday (not Sunday)
# (datetime.datetime(2024, 11, 4), datetime.datetime(2024, 11, 25)), # expect Monday
# (datetime.datetime(2024, 11, 5), datetime.datetime(2024, 11, 26)), # expect Tuesday
# (datetime.datetime(2024, 11, 6), datetime.datetime(2024, 11, 27)), # expect Wednesday
# (datetime.datetime(2024, 11, 7), datetime.datetime(2024, 11, 28)), # expect Thursday
#]
#
#
#@pytest.mark.parametrize("freeze_date, expected_release_date", release_date_test_data)
#def test_get_release_date(freeze_date, expected_release_date):
# assert _get_release_date(freeze_date) == expected_release_date
#
@pytest.fixture
def release_files_dir():
return Path(".") / "tests" / "test_data"


@pytest.fixture
def release_file(release_files_dir):
with open(release_files_dir / "98.2.rst") as f:
return f.read()


@pytest.fixture
def announcement_file(release_files_dir):
with open(release_files_dir / "98.2_announce.rst") as f:
return f.read()


@pytest.fixture
def user_announcement_file(release_files_dir):
with open(release_files_dir / "98.2_announce_user.rst") as f:
return f.read()


@pytest.fixture
def next_release_announcement_file(release_files_dir):
with open(release_files_dir / "99.0_announce.rst") as f:
return f.read()


@pytest.fixture
def prs_file(release_files_dir):
with open(release_files_dir / "98.2_prs.rst") as f:
return f.read()


def test_get_previous_release_version(monkeypatch):
monkeypatch.setattr(bootstrap_history, "_get_release_version_strings", lambda x: sorted(["22.01", "22.05", "23.0", "23.1"]))
monkeypatch.setattr(
bootstrap_history, "_get_release_version_strings", lambda x: sorted(["22.01", "22.05", "23.0", "23.1"])
)

assert _get_previous_release_version(None, Version("15.1")) == None
assert _get_previous_release_version(None, Version("22.01")) == None
Expand All @@ -59,7 +79,38 @@ def test_get_release_version_strings(monkeypatch):
"23.not_a_release.rst",
"not_a_release.23.rst",
]
monkeypatch.setattr(bootstrap_history, "_get_release_notes_filenames", lambda x: sorted(filenames))
monkeypatch.setattr(bootstrap_history, "_get_release_documentation_filenames", lambda x: sorted(filenames))
assert _get_release_version_strings(None) == ["22.01", "22.05", "23.0", "23.1"]


def test_create_release_issue():
pass # TODO


def test_create_changelog(
monkeypatch,
release_file,
announcement_file,
user_announcement_file,
prs_file,
next_release_announcement_file,
):
monkeypatch.setattr(bootstrap_history, "load_prs", lambda x, y, z: None) # We don't want to call github's API on test data.
runner = CliRunner()
with runner.isolated_filesystem():
os.makedirs("doc/source/releases")
result = runner.invoke(create_changelog, ["98.2", "--galaxy-root", ".", "--release-date", "2099-1-15", "--next-version", "99.0"]) # version 98.2 to be released on January 15, 2099
assert result.exit_code == 0

releases_path = Path("doc") / "source" / "releases"

with open(releases_path / "98.2.rst") as f:
assert f.read() == release_file
with open(releases_path / "98.2_announce.rst") as f:
assert f.read() == announcement_file
with open(releases_path / "98.2_announce_user.rst") as f:
assert f.read() == user_announcement_file
with open(releases_path / "98.2_prs.rst") as f:
assert f.read() == prs_file
with open(releases_path / "99.0_announce.rst") as f:
assert f.read() == next_release_announcement_file
61 changes: 61 additions & 0 deletions tests/test_data/98.2.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@

.. to_doc
98.2
===============================

.. announce_start
Enhancements
-------------------------------

.. major_feature
.. feature
.. enhancement_tag_viz
.. enhancement_tag_datatypes
.. enhancement_tag_tools
.. enhancement_tag_workflows
.. enhancement_tag_ui
.. enhancement_tag_jobs
.. enhancement_tag_admin
.. enhancement
.. small_enhancement
Fixes
-------------------------------

.. major_bug
.. bug_tag_viz
.. bug_tag_datatypes
.. bug_tag_tools
.. bug_tag_workflows
.. bug_tag_ui
.. bug_tag_jobs
.. bug_tag_admin
.. bug
.. include:: 98.2_prs.rst

65 changes: 65 additions & 0 deletions tests/test_data/98.2_announce.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

===========================================================
98.2 Galaxy Release (January 2099)
===========================================================

.. include:: _header.rst

Highlights
===========================================================

Feature1
--------

Feature description.

Feature2
--------

Feature description.

Feature3
--------

Feature description.

Also check out the `98.2 user release notes <98.2_announce_user.html>`__.
Are you an admin? Check out `some admin relevant PRs <https://github.com/galaxyproject/galaxy/pulls?q=label%3Ahighlight%2Fadmin+milestone%3A98.2+is%3Aclosed+is%3Apr>`__.

Get Galaxy
===========================================================

The code lives at `GitHub <https://github.com/galaxyproject/galaxy>`__ and you should have `Git <https://git-scm.com/>`__ to obtain it.

To get a new Galaxy repository run:
.. code-block:: shell
$ git clone -b release_98.2 https://github.com/galaxyproject/galaxy.git
To update an existing Galaxy repository run:
.. code-block:: shell
$ git fetch origin && git checkout release_98.2 && git pull --ff-only origin release_98.2
See the `community hub <https://galaxyproject.org/develop/source-code/>`__ for additional details on source code locations.


Administration Notes
===========================================================
Add content or drop section.

Configuration Changes
===========================================================
Add content or drop section.

Deprecation Notices
===========================================================
Add content or drop section.

Release Notes
===========================================================

.. include:: 98.2.rst
:start-after: announce_start

.. include:: _thanks.rst
56 changes: 56 additions & 0 deletions tests/test_data/98.2_announce_user.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@

===========================================================
98.2 Galaxy Release (January 2099)
===========================================================

.. include:: _header.rst

Highlights
===========================================================

Feature1
--------

Feature description.

Feature2
--------

Feature description.

Feature3
--------

Feature description.


Visualizations
===========================================================

.. visualizations
Datatypes
===========================================================

.. datatypes
Builtin Tool Updates
===========================================================

.. tools
Release Testing Team
===========================================================

A special thanks to the release testing team for testing many of the new features and reporting many bugs:

<team members go here>

Release Notes
===========================================================

Please see the :doc:`full release notes <98.2_announce>` for more details.

.. include:: 98.2_prs.rst

.. include:: _thanks.rst
2 changes: 2 additions & 0 deletions tests/test_data/98.2_prs.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@

.. github_links
6 changes: 6 additions & 0 deletions tests/test_data/99.0_announce.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

:orphan:

===========================================================
99.0 Galaxy Release
===========================================================

0 comments on commit cadd3d8

Please sign in to comment.