Skip to content

Commit

Permalink
Update CI files
Browse files Browse the repository at this point in the history
[noissue]
  • Loading branch information
pulpbot committed Apr 21, 2024
1 parent b7071c8 commit b4fc08a
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 19 deletions.
28 changes: 17 additions & 11 deletions .ci/scripts/check_release.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def main():
if branch != DEFAULT_BRANCH:
# Check if a Z release is needed
changes = repo.git.ls_tree("-r", "--name-only", f"origin/{branch}", "CHANGES/")
z_release = False
z_changelog = False
for change in changes.split("\n"):
# Check each changelog file to make sure everything checks out
_, ext = os.path.splitext(change)
Expand All @@ -75,18 +75,24 @@ def main():
f"{branch} release branch!"
)
elif ext in Z_CHANGELOG_EXTS:
z_release = True
if z_release:
# Blobless clone does not have file contents for Z branches,
# check commit message for last Z bump
git_branch = f"origin/{branch}"
next_version = repo.git.log(
"--oneline", "--grep=Bump to", "-n 1", git_branch, "--", ".bumpversion.cfg"
).split("to")[-1]
next_version = Version(next_version)
z_changelog = True

last_tag = repo.git.describe("--tags", "--abbrev=0", f"origin/{branch}")
req_txt_diff = repo.git.diff(
f"{last_tag}", f"origin/{branch}", "--name-only", "--", "requirements.txt"
)
if z_changelog or req_txt_diff:
curr_version = Version(last_tag)
assert curr_version.base_version.startswith(
branch
), "Current-version has to belong to the current branch!"
next_version = Version(f"{branch}.{curr_version.micro + 1}")
reason = "CHANGES" if z_changelog else "requirements.txt"
print(
f"A Z-release is needed for {branch}, "
f"New Version: {next_version.base_version}"
f"Prev: {last_tag}, "
f"Next: {next_version.base_version}, "
f"Reason: {reason}"
)
releases.append(next_version)
else:
Expand Down
9 changes: 7 additions & 2 deletions .ci/scripts/collect_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

import toml
from git import GitCommandError, Repo
from pkg_resources import parse_version
from packaging.version import parse as parse_version

# Read Towncrier settings
tc_settings = toml.load("pyproject.toml")["tool"]["towncrier"]
Expand All @@ -28,15 +28,20 @@
TITLE_FORMAT = tc_settings.get("title_format", "{name} {version} ({project_date})")


# Build a regex to find the header of a changelog section.
# It must have a single capture group to single out the version.
# see help(re.split) for more info.
NAME_REGEX = r".*"
VERSION_REGEX = r"([0-9]+\.[0-9]+\.[0-9][0-9ab]*)"
VERSION_REGEX = r"[0-9]+\.[0-9]+\.[0-9][0-9ab]*"
VERSION_CAPTURE_REGEX = rf"({VERSION_REGEX})"
DATE_REGEX = r"[0-9]{4}-[0-9]{2}-[0-9]{2}"
TITLE_REGEX = (
"("
+ re.escape(
TITLE_FORMAT.format(name="NAME_REGEX", version="VERSION_REGEX", project_date="DATE_REGEX")
)
.replace("NAME_REGEX", NAME_REGEX)
.replace("VERSION_REGEX", VERSION_CAPTURE_REGEX, 1)
.replace("VERSION_REGEX", VERSION_REGEX)
.replace("DATE_REGEX", DATE_REGEX)
+ ")"
Expand Down
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-320-g4fd782b
2021.08.26-327-g6a0d984
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
- name: "Install python dependencies"
run: |
echo ::group::PYDEPS
pip install gitpython toml
pip install gitpython packaging toml
echo ::endgroup::
- name: "Configure Git with pulpbot name and email"
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/scripts/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ if [[ "$TEST" = "docs" ]]; then
if [[ "$GITHUB_WORKFLOW" == "Gem CI" ]]; then
towncrier build --yes --version 4.0.0.ci
fi
# Legacy Docs Build
cd docs
make PULP_URL="$PULP_URL" diagrams html
tar -cvf docs.tar ./_build
Expand Down
5 changes: 4 additions & 1 deletion doc_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
#
# For more info visit https://github.com/pulp/plugin_template
-r requirements.txt
towncrier

# Legacy docs
plantuml
sphinx~=7.1.2
sphinx-rtd-theme==1.3.0
sphinxcontrib-jquery
sphinxcontrib-openapi
towncrier
mistune<4.0.0
Jinja2<3.2
# Extra requirements
2 changes: 1 addition & 1 deletion docs/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-320-g4fd782b
2021.08.26-327-g6a0d984
2 changes: 1 addition & 1 deletion lint_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# For more info visit https://github.com/pulp/plugin_template

# python packages handy for developers, but not required by pulp
black==23.12.1
black==24.3.0
check-manifest
flake8
flake8-black
Expand Down
4 changes: 3 additions & 1 deletion template_config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This config represents the latest values used when running the plugin-template. Any settings that
# were not present before running plugin-template have been added with their default values.

# generated with [email protected]319-ga283c28
# generated with [email protected]327-g6a0d984

api_root: /pulp/
black: true
Expand Down Expand Up @@ -76,4 +76,6 @@ test_performance: false
test_reroute: true
test_s3: true
use_issue_template: true
use_legacy_docs: true
use_unified_docs: false

0 comments on commit b4fc08a

Please sign in to comment.