Repository navigation
[FEATURE] Branching strategy Phase 3 - PyPI and CodeArtifact publish workflows #638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
John McCall (lowlydba)
merged 25 commits into
main
from
509-devops-branching-strategy---phase-3
Aug 24, 2026
Merged
Changes from all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
b5d9eb5
[FEATURE](ci) Branching strategy Phase 3 - PyPI and CodeArtifact publ…
lowlydba 84574c8
[REFACTOR](ci) Use tj-actions/changed-files in detect-affected-packages
lowlydba d5c9f27
[REFACTOR](ci) Reorder detect-affected-packages steps so both Python …
lowlydba e975d12
[REFACTOR](ci) Extract diff-package-versions composite action
lowlydba 99b1fd1
[REFACTOR](ci) Move package_versions.py into diff-package-versions
lowlydba 357b1ca
[REFACTOR](docs) Polish CONTRIBUTING.md for the finished branching/re…
lowlydba 47c7912
[FIX](ci) Add pull_request trigger to test-schema
lowlydba 46b7e99
[FEATURE](ci) Read overture-releaser PEM from Secrets Manager
lowlydba 8475a1b
fix(actions): treat a package's first version as a releasable bump
lowlydba 1d2c94c
Merge branch 'main' into 509-devops-branching-strategy---phase-3
lowlydba fff7195
[REFACTOR](ci) Un-hoist pyspark expression generation into the packag…
lowlydba a2350e6
[FEATURE](ci) Add a workflow_dispatch dry-run to Test PyPI on release…
lowlydba 6cd7c16
[REFACTOR](ci) Drop the per-environment reviewer gate on PyPI publish
lowlydba ee9e0f2
[FIX](ci) Correct release-publisher app name and pin publish checkout…
lowlydba f8e3b0e
Add changelog fragment for pyspark prebuild un-hoisting
lowlydba 2f8a302
Expand changelog fragment with CI-only scope note
lowlydba e7fede1
Rename check-python-code's default resolution matrix cell to locked
lowlydba 0c52008
[FIX](ci) Address review feedback on publish workflows
lowlydba 3dd502d
Merge branch 'main' into 509-devops-branching-strategy---phase-3
lowlydba 65bb3bb
Merge origin/main into 509-devops-branching-strategy---phase-3
Copilot c83e62c
Fix optional pyspark import guard behavior
Copilot 184cf69
[FEATURE](ci) Add a gated real-PyPI priming path to release-publish's…
lowlydba e548436
Merge remote-tracking branch 'origin/509-devops-branching-strategy---…
lowlydba 2e7332d
[REFACTOR](ci) Simplify the priming dispatch to reuse pypi-release-<p…
lowlydba 5022321
Merge branch 'main' into 509-devops-branching-strategy---phase-3
lowlydba File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| name: Detect affected packages | ||
| description: > | ||
| Detects packages affected by a no-bump push to main, i.e. any file changed | ||
| under packages/<pkg>/ between two commits, excluding packages whose | ||
| pyproject.toml version was also bumped in the same range (those release via | ||
| release-trigger instead; see docs/versioning.md) and packages removed in the | ||
| range (nothing left to build). | ||
|
|
||
| Prerequisites: repo must be checked out with `fetch-depth: 0` so `before` is | ||
| reachable. | ||
|
|
||
| inputs: | ||
| before: | ||
| description: The base commit SHA to compare against (e.g. github.event.before). | ||
| required: true | ||
| after: | ||
| description: The head commit SHA to compare to. Defaults to the checked-out HEAD. | ||
| required: false | ||
| default: HEAD | ||
|
|
||
| outputs: | ||
| count: | ||
| description: Number of affected packages. | ||
| value: ${{ steps.filter.outputs.count }} | ||
| packages: | ||
| description: > | ||
| JSON array of affected package directory names, e.g. | ||
| ["overture-schema-common"]. Suitable as a matrix input. | ||
| value: ${{ steps.filter.outputs.packages }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: List changed package directories | ||
| id: changed-dirs | ||
| uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6 | ||
| with: | ||
| base_sha: ${{ inputs.before }} | ||
| sha: ${{ inputs.after }} | ||
| files: packages/** | ||
| dir_names: true | ||
| dir_names_max_depth: 2 | ||
| matrix: true | ||
|
|
||
| # Independent of the step above (neither reads the other's output); runs | ||
| # after it only so both feed the final filter step back to back. | ||
| - name: Diff package versions | ||
| id: diff | ||
| uses: ./.github/actions/diff-package-versions | ||
| with: | ||
| before: ${{ inputs.before }} | ||
| after: ${{ inputs.after }} | ||
|
|
||
| - name: Detect affected packages | ||
| id: filter | ||
| shell: bash | ||
| env: | ||
| # all_modified_files (not all_changed_files) so deletions count too: a | ||
| # file removed from a package without a version bump still changes | ||
| # the built wheel. | ||
| CHANGED_DIRS: ${{ steps.changed-dirs.outputs.all_modified_files }} | ||
| DIFF: ${{ steps.diff.outputs.diff }} | ||
| run: | | ||
| set -euo pipefail | ||
| jq -n --argjson version_diff "$DIFF" --argjson changed_dirs "$CHANGED_DIRS" \ | ||
| '{version_diff: $version_diff, changed_dirs: $changed_dirs}' \ | ||
| | python3 "${GITHUB_ACTION_PATH}/detect_affected_packages.py" >> "$GITHUB_OUTPUT" | ||
80 changes: 80 additions & 0 deletions
80
.github/actions/detect-affected-packages/detect_affected_packages.py
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| #!/usr/bin/env python3 | ||
|
|
||
| """ | ||
| Detect packages affected by a no-bump push to main. | ||
|
|
||
| Composes `package_versions.py diff`'s version-diff JSON with a JSON array of | ||
| changed package directories (tj-actions/changed-files' `dir_names` output) to | ||
| find packages whose directory changed without also changing their | ||
| pyproject.toml version. Those need an internal `.postN` build (see | ||
| docs/versioning.md). Packages with a version bump in the same range are | ||
| excluded because they release via `release-trigger` instead, and removed | ||
| packages are excluded because there is nothing left to build. | ||
|
|
||
| Reads a single JSON object from stdin: {"version_diff": [...], "changed_dirs": | ||
| [...]}. Run from the repository root: | ||
|
|
||
| jq -n \\ | ||
| --argjson version_diff "$(python3 package_versions.py diff BEFORE AFTER)" \\ | ||
| --argjson changed_dirs '["packages/overture-schema-common"]' \\ | ||
| '{version_diff: $version_diff, changed_dirs: $changed_dirs}' \\ | ||
| | python3 detect_affected_packages.py | ||
|
|
||
| Prints `$GITHUB_OUTPUT` lines on stdout (progress goes to stderr): | ||
|
|
||
| count=<n> Number of affected packages. | ||
| packages=<json> JSON array of affected package directory names, e.g. | ||
| ["overture-schema-common"]. Suitable as a matrix input. | ||
|
|
||
| Exit status: | ||
| 0 Success (including the no-affected case). | ||
| 1 Malformed input: a changed_dirs entry isn't packages/<pkg>. | ||
| """ | ||
|
|
||
| import json | ||
| import sys | ||
|
|
||
|
|
||
| def _package_name(path: str) -> str: | ||
| """Extract <pkg> from a packages/<pkg> changed-directory entry.""" | ||
| parts = path.split("/", 1) | ||
| if len(parts) < 2: | ||
| raise ValueError( | ||
| f"Expected a 'packages/<pkg>' changed-directory entry, got {path!r}. " | ||
| "Check dir_names_max_depth on the changed-files step." | ||
| ) | ||
| return parts[1] | ||
|
|
||
|
|
||
| def main() -> None: | ||
| payload = json.load(sys.stdin) | ||
| version_diff = payload["version_diff"] | ||
| changed_paths = payload["changed_dirs"] | ||
|
|
||
| bumped = {change["package"] for change in version_diff if change["after"] is not None} | ||
| removed = {change["package"] for change in version_diff if change["after"] is None} | ||
|
|
||
| changed = {_package_name(path) for path in changed_paths} | ||
| affected = sorted(changed - bumped - removed) | ||
|
|
||
| for package in sorted(changed): | ||
| if package in removed: | ||
| print(f"{package}: removed. Skipping.", file=sys.stderr) | ||
| elif package in bumped: | ||
| print( | ||
| f"{package}: version bumped, handled by release-trigger. " | ||
| "Skipping internal build.", | ||
| file=sys.stderr, | ||
| ) | ||
| else: | ||
| print(f"{package}: changed, no bump -> internal build.", file=sys.stderr) | ||
|
|
||
| if not affected: | ||
| print("No affected packages (no unreleased changes to publish).", file=sys.stderr) | ||
|
|
||
| print(f"count={len(affected)}") | ||
| print(f"packages={json.dumps(affected)}") | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| main() |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| name: Diff package versions | ||
| description: > | ||
| Diffs packages/*/pyproject.toml versions between two commits (see | ||
| package_versions.py), reading blobs directly from git. Enforces the | ||
| major-bump cascade: a package whose direct workspace dependency takes a | ||
| major bump must take one itself; the action fails otherwise. | ||
|
|
||
| Prerequisites: repo must be checked out with `fetch-depth: 0` so `before` | ||
| is reachable. | ||
|
|
||
| inputs: | ||
| before: | ||
| description: The base commit SHA to compare against (e.g. github.event.before). | ||
| required: true | ||
| after: | ||
| description: The head commit SHA to compare to. Defaults to the checked-out HEAD. | ||
| required: false | ||
| default: HEAD | ||
|
|
||
| outputs: | ||
| count: | ||
| description: Number of packages with a version change (added, removed, or bumped). | ||
| value: ${{ steps.diff.outputs.count }} | ||
| diff: | ||
| description: > | ||
| JSON array of {"package", "before", "after"} objects, topologically | ||
| sorted (dependencies before dependents). `before`/`after` are null when | ||
| the package didn't exist at that commit. | ||
| value: ${{ steps.diff.outputs.diff }} | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: Diff package versions | ||
| id: diff | ||
| shell: bash | ||
| env: | ||
| BEFORE: ${{ inputs.before }} | ||
| AFTER: ${{ inputs.after }} | ||
| run: | | ||
| python3 "${GITHUB_ACTION_PATH}/package_versions.py" diff "$BEFORE" "$AFTER" \ | ||
| > "${RUNNER_TEMP}/package-version-diff.json" | ||
| { | ||
| echo "count=$(jq 'length' "${RUNNER_TEMP}/package-version-diff.json")" | ||
| echo "diff=$(jq -c . "${RUNNER_TEMP}/package-version-diff.json")" | ||
| } >> "$GITHUB_OUTPUT" |
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.