mirror of
https://github.com/hanzoai/datastore.git
synced 2026-09-26 13:55:07 +00:00
Convert the hand-written .github/workflows/create_release.yml into a Praktika-generated workflow and move the release tooling under ci/: - ci/workflows/create_release.py + ci/jobs/release_job.py: the Praktika CreateRelease workflow (workflow_dispatch + workflow_call, a concurrency group, the amd-release-maker runner, robot-PAT pushes) and its orchestrator. - ci/jobs/scripts/create_release.py, ci/jobs/scripts/artifactory.py: moved out of tests/ci/ (they are release scripts, not jobs); the s3_helper/ssh sys.path is adjusted for the new location. - ci/jobs/scripts/clickhouse_version.py: tag-free CHVersion — the tweak is the commit count since the version-file githash (git rev-list --count), never git describe / release tags. - ci/tests/test_create_release.py: regression and end-to-end guards for the workflow contract and the version arithmetic. Hardening found via real release + dry-run testing (26.3 / 26.6): - create the release tag locally even on a dry run so later steps resolve it; - retry the changelog-PR branch push past GitHub's transient push-time workflow-file check (which the robot PAT already has scope for); - fail loud (get_output_or_raise) instead of stamping VERSION_GITHASH 000...0 on a git failure; - remove the write-scoped release PAT from ci/tmp in the credential cleanup so it does not persist on a reused runner. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
41 lines
1.7 KiB
Python
41 lines
1.7 KiB
Python
#!/usr/bin/env python3
|
|
"""
|
|
Unit tests for the pure release-decision helpers in
|
|
`ci/jobs/scripts/release_checks.py`. Run as part of the `ci/tests/` suite with
|
|
`pytest ci/tests/test_create_release.py` from the repo root.
|
|
|
|
`release_checks` is the dependency-light home of `is_empty_patch_release` (used
|
|
by `tests/ci/create_release.py`'s `ReleaseInfo.prepare`). It is kept free of the
|
|
release toolchain's heavy imports (`github`, `boto3`, `unidiff`, ...) and of the
|
|
`ci.praktika` stack, so this test imports it as a plain `ci.jobs.scripts` module
|
|
without the packages that the `CI Tests` docker image does not ship.
|
|
"""
|
|
|
|
import unittest
|
|
|
|
from ci.jobs.scripts.release_checks import is_empty_patch_release
|
|
|
|
|
|
class TestIsEmptyPatchRelease(unittest.TestCase):
|
|
def test_rejects_empty_rerun(self):
|
|
# Already-published branch: the only commit since the previous
|
|
# stable/lts tag is the automated version bump (e.g. v25.8.28.1-lts).
|
|
self.assertTrue(is_empty_patch_release(patch=28, tweak=1))
|
|
|
|
def test_allows_first_release_of_new_branch(self):
|
|
# First user-facing stable/lts release on a freshly cut branch. Its
|
|
# previous tag is vX.Y.1.1-new and the single testing -> stable commit
|
|
# also yields tweak == 1, but the release is legitimate.
|
|
self.assertFalse(is_empty_patch_release(patch=1, tweak=1))
|
|
|
|
def test_allows_non_empty_patch_release(self):
|
|
# Real commits on top of the previous release -> tweak > 1.
|
|
self.assertFalse(is_empty_patch_release(patch=28, tweak=42))
|
|
|
|
def test_allows_non_empty_first_release(self):
|
|
self.assertFalse(is_empty_patch_release(patch=1, tweak=2222))
|
|
|
|
|
|
if __name__ == "__main__":
|
|
unittest.main()
|