feat: add R package-aware release handling to draft-release and post-release actions#170
feat: add R package-aware release handling to draft-release and post-release actions#170Copilot wants to merge 14 commits into
Conversation
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/1731df8e-d0c5-4e0f-8be6-727b21812646 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/1731df8e-d0c5-4e0f-8be6-727b21812646 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
kelly-sovacool
left a comment
There was a problem hiding this comment.
R package versions use semantic versioning for releases, but for development versions instead of using tags like v1.2.3-dev, they use a third period followed by a 4-digit number, e.g. v1.2.3.9000. Usually after v1.2.3 is released, the next development version is v1.2.3.9000.
Add support to allow this slight tweak to the versioning system for R packages. But only allow R packages to use this system: all other projects must adhere to semantic versioning.
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/d13a8218-f3e5-4d8f-9749-2d510e1ce115 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/d13a8218-f3e5-4d8f-9749-2d510e1ce115 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Implemented in 721a1af (with core logic in 02b86dd). R packages now bump to |
kelly-sovacool
left a comment
There was a problem hiding this comment.
This package imports version-related functions from CCBR/Tools: https://github.com/CCBR/Tools/blob/main/src/ccbr_tools/versions.py
Many of those functions expect strict semantic versions.
Determine what modifications will need to be made, whether in this package or in CCBR/Tools, to accommodate R's special version format.
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/9b00b850-fcff-4b5f-ac0b-8facbc245bd1 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/9b00b850-fcff-4b5f-ac0b-8facbc245bd1 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
I audited this and added a safeguard in this repo in a0752a1 (plus tests in 0082271): What this implies: no immediate CCBR/Tools change is required for this PR, but an upstream improvement in CCBR/Tools would be to add an optional full-match mode (or switch |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #170 +/- ##
==========================================
+ Coverage 89.34% 93.56% +4.21%
==========================================
Files 11 11
Lines 460 544 +84
==========================================
+ Hits 411 509 +98
+ Misses 49 35 -14 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
kelly-sovacool
left a comment
There was a problem hiding this comment.
Add unit tests to cover the missed lines: https://app.codecov.io/gh/CCBR/actions/pull/170?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CCBR
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/f39f3c97-4536-4c84-b91f-7b705d9c5cbe Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/f39f3c97-4536-4c84-b91f-7b705d9c5cbe Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Added in 8a0ae43: I expanded |
There was a problem hiding this comment.
Pull request overview
Adds first-class R package support to the repository’s release automation so draft-release and post-release can operate on R package conventions (NEWS*, DESCRIPTION, and CITATION.cff) while also tightening release-tag semver validation.
Changes:
- Introduces R package detection and switches default release file targets from
CHANGELOG.md/VERSIONtoNEWS*/DESCRIPTION(including R-style.9000dev version bump post-release). - Regenerates
CITATION.cfffromDESCRIPTIONviacffrfor R package repos and wires conditional R setup into the composite actions. - Hardens release tag parsing by enforcing full-string semver validation and adds focused tests for the new behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/ccbr_actions/release.py |
Adds R package detection, DESCRIPTION version writing, citation regeneration via R/cffr, and strict semver validation. |
tests/test_release.py |
Expands unit coverage for R package flows, .9000 versioning, NEWS selection, and strict semver rejection cases. |
draft-release/action.yml |
Adds description-filepath input, conditionally sets up R/cffr, and passes DESCRIPTION path into the Python release helper. |
draft-release/README.md |
Documents the new description-filepath input for R package detection/behavior. |
post-release/action.yml |
Adds description-filepath input, conditionally sets up R/cffr, and passes DESCRIPTION path into post-release cleanup. |
post-release/README.md |
Documents the new description-filepath input for R package detection/behavior. |
| def regenerate_citation_from_description(citation_filepath="CITATION.cff", debug=False): | ||
| """ | ||
| Regenerate CITATION.cff from DESCRIPTION using cffr. | ||
|
|
||
| Args: | ||
| citation_filepath (str): Path to output CITATION.cff. | ||
| debug (bool): If True, print command instead of running it. | ||
| """ | ||
| r_expression = ( | ||
| 'if (!requireNamespace("cffr", quietly = TRUE)) ' | ||
| 'stop("Missing required R package: cffr. Install it in workflow setup (e.g. setup-r-dependencies)."); ' | ||
| 'cffr::cff_write(cff_file = Sys.getenv("CITATION_FILE"))' | ||
| ) | ||
| citation_filepath_quoted = shlex.quote(str(citation_filepath)) | ||
| cmd = ( | ||
| f"CITATION_FILE={citation_filepath_quoted} " | ||
| f"Rscript -e {shlex.quote(r_expression)}" | ||
| ) | ||
| if debug: | ||
| print(cmd) | ||
| else: | ||
| shell_run(cmd) | ||
|
|
|
To-Do @kelly-sovacool: test this by running these workflows from a sandbox repo |
|
@copilot edit the changelog with a one-line description of this PR. Link the PR number and tag both of us as authors. |
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/bb8d7c15-72c4-4f93-923a-d39661457387 Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
Agent-Logs-Url: https://github.com/CCBR/actions/sessions/ecbbdbf4-a2fe-4aa1-a55f-287f3681d59f Co-authored-by: kelly-sovacool <17768269+kelly-sovacool@users.noreply.github.com>
This change adds first-class R package support to release automation. When a repository uses R package structure, release actions now operate on
NEWS/NEWS.mdandDESCRIPTION(instead ofCHANGELOG.mdandVERSION), and regenerateCITATION.cfffromDESCRIPTION.R package detection + path switching
DESCRIPTION-based repo detection in release helpers.CHANGELOG.md→NEWS.md(orNEWSif present)VERSION→DESCRIPTION(Version:field)Version update semantics for R repos
Version:inDESCRIPTIONto the next release version.Version:inDESCRIPTIONto${released}.9000(R-style development versioning, e.g.1.2.3→1.2.3.9000).Version:is missing.Semantic-version compatibility hardening
get_release_version) before increment checks.v1.2.3.9000from being accepted as release versions..9000format limited to R post-release development version bumps inDESCRIPTION.CITATION regeneration from DESCRIPTION
CITATION.cffviacffr::cff_write(...)after version updates.Composite action wiring updates
draft-release/action.ymlandpost-release/action.ymlnow acceptdescription-filepath(default:DESCRIPTION).cffrdependency install when DESCRIPTION exists.description_filepaththrough to Python release helpers.Focused release behavior coverage
DESCRIPTION+ citation regeneration.9000development-version conversion and invalid-version edge casesv1.2.3.9000)Issues
resolves #98