feat: migrate milestone mover + tagger to unit-tested PHP#91
Merged
Conversation
First step of migrating the logic-heavy release scripts from bash to a unit-tested PHP package. This lands the scaffold and the pure milestone domain only - no I/O, no workflow changes, nothing cut over yet. It sits beside the bash and is consumed in a later step. - tools/release: composer package (Symfony-Console-ready), PHPUnit 12, CI. - Domain (pure, zero mocks): - Version - parse a tag into major/minor/patch + prerelease/first-beta - MilestonePlan - current/next/upcoming names; first beta -> next major (N+1) - DueDate - validate YYYY-MM-DD, convert to ISO - RepoList - merge config + tag-only lists (sorted, unique) - AuditExpectation - expected milestone state + orphan rule - 22 tests / 69 assertions. These encode the exact rules that caused bugs in the bash version (first-beta off-by-one, the two-open-patch invariant) and catch them with plain assertions - no fixtures or fake-gh needed. Next: wire these behind a mockable GitHub client + Console commands (milestones:update / milestones:audit), then retire update-milestones.sh. Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
…rkflows Step 2 of the bash->PHP migration. The milestone mover (update-milestones.sh + audit-milestones.sh) and the tagger (tag-repo.sh) are reimplemented as unit-tested PHP commands and the live workflows now call them. The bash scripts and their fake-gh harness are removed. tools/release additions: - GitHub\GitHubApi interface with a knplabs-backed adapter (KnpGitHubApi) and an in-memory FakeGitHubApi (journal of mutations) for tests. Tags are created as lightweight refs via the git-refs API (no clone/push). Issue moves skip pull requests. - Services: MilestoneUpdater, MilestoneAuditor, RepoTagger. - Domain: TagPolicy (server-repo immutability), ReleaseConfig (config->major, latest-stable, repo list). - Commands milestones:update, milestones:audit, repo:tag (bin/console). - 55 PHPUnit tests covering every release shape + tagger combination via the fake (each test file documents what/why in its docblock). Workflows: - release-milestones.yml and release-tag.yml set up PHP, composer install, and call the console commands (same inputs, same RELEASE_TOKEN). - test-release-tools.yml runs on all pushes/PRs (no path filter). Removed: update-milestones.sh, audit-milestones.sh, tag-repo.sh, tests/milestone-scripts/**, test-milestone-scripts.yml. Release auto-logic is documented in tools/release/README.md. Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
…with CI Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
…verage Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Migrates the logic-heavy, API-driven release scripts from bash to a unit-tested PHP package (
tools/release/), and switches the live workflows to it.What moved to PHP
update-milestones.shmilestones:updateaudit-milestones.shmilestones:audittag-repo.shrepo:tagknplabs/github-apibehind our ownGitHub\GitHubApiinterface. Tags are created as lightweight refs via the git-refs API (no clone/push). Issue moves now skip pull requests.Version,MilestonePlan,DueDate,RepoList,AuditExpectation,TagPolicy,ReleaseConfig) -> services (MilestoneUpdater,MilestoneAuditor,RepoTagger) -> thin Symfony Console commands.release-milestones.ymlandrelease-tag.ymlset up PHP + composer and call the commands (same inputs, sameRELEASE_TOKEN). Added adry_runinput to the tagger.tests/milestone-scripts/**,test-milestone-scripts.yml.Testing
FakeGitHubApi(records a journal of mutations) covering every release shape and tagger combination; each test file documents what/why in its docblock.FakeGitHubApilives intests/(not shipped insrc/).domain,milestones-update,milestones-audit,tagger) on every push/PR, with pcov coverage uploaded to Codecov per area.milestones:update v34.0.0-> would closeNextcloud 34across 29 reposrepo:tag v34.0.1-> would tag 30 repos at resolved branch SHAs, 0 failedmilestones:update v34.0.0beta1-> first-beta path createsNextcloud 35(N+1), idempotent where it already existsDocs
Root
README.mdexplains the release process and branch/milestone rules;tools/release/README.mddocuments the full auto-logic in human-friendly form.Notes
composer.lockpinsplatform.phpto 8.3 so CI and local resolve identically.codecov/codecov-action@v5uses a version tag; pin to a SHA if the repo requires it.