ci: add and harden SDK release workflows - #8
Merged
Conversation
Mirrors the three CI/CD workflows the archastro-js repo uses, adapted for the single-package Python SDK and PyPI Trusted Publishing. publish.yml — fires on `v*` tag pushes (and is reachable via workflow_dispatch so release.yml can re-trigger after pushing the tag, since GITHUB_TOKEN-pushed tags don't fire workflow runs themselves). Authenticates to PyPI via OIDC — no API token required after the first manual publish + Trusted Publisher configured at pypi.org/manage/project/archastro-sdk/. Uses pypa/gh-action-pypi-publish (commit-pinned), validates that the tag matches `pyproject.toml`'s `[project].version`, creates a matching GitHub Release. release.yml — manual workflow_dispatch with a bump knob (patch/minor/major). Runs the same lint + unit + harness + contract suites as ci.yml on Python 3.12 (single matrix entry to keep the release gate fast), bumps the version with `uv version --bump`, pushes the bump on a `release/v$VERSION` branch, tags `v$VERSION`, dispatches publish.yml against the tag, then opens + squash-merges a PR back into main so the bump lands. regenerate-sdk.yml — manual workflow_dispatch with two knobs (openapi_ref, generator_spec). Runs `./scripts/regenerate_sdk.sh` with `uv` installed up-front because the script invokes `uv run ruff ...` to normalize generated output. Detects diffs in src/, tests/, and specs/. Force-pushes to the stable `auto/regenerate-sdk` branch and either opens or updates a PR — the PR's own CI is what runs build + tests, so this workflow stays narrowly scoped to "produce the diff". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Reviewed Reply |
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.
What changed
This updates the Python SDK CI, release, publish, and regeneration workflows so they use locked dependency inputs instead of floating installs:
npm ci --ignore-scriptsplusnpm audit --audit-level=moderatefor Node tooling.@archastro/sdk-generatorinpackage-lock.jsonand removes the manual@latestgenerator input.npx.npx.uvto0.11.3with the release checksum in every workflow.uv sync --locked --all-extrasand builds withuv build --no-build-isolation.uv.lockand smoke-tests the built wheel with hash-enforced runtime requirements.Diagrams
sequenceDiagram participant Dev as Developer participant GH as GitHub Actions participant NPM as npm registry participant UV as uv resolver participant Tests as SDK tests participant PyPI as PyPI Dev->>GH: push PR branch GH->>NPM: npm ci with scripts disabled GH->>NPM: npm audit moderate gate GH->>UV: install pinned uv with checksum GH->>UV: uv sync locked GH->>Tests: run lint unit harness contract GH->>UV: build with no isolation GH->>UV: export locked runtime requirements GH->>Tests: install hashes then local wheel no deps alt release tag GH->>PyPI: publish prebuilt dist by trusted publisher else regenerate SDK GH->>Tests: run locked local sdk generator endclassDiagram class CIWorkflow { String python_matrix_3_11_3_12_3_13 String permissions_contents_read String npm_ci_ignore_scripts String npm_audit_moderate String uv_sync_locked String wheel_smoke_hashes } class ReleaseWorkflow { String npm_ci_ignore_scripts String npm_audit_moderate String uv_sync_locked String wheel_smoke_hashes } class RegenerateWorkflow { String npm_ci_ignore_scripts String local_sdk_generator String package_lock_version } class PublishWorkflow { String uv_sync_locked String build_no_isolation String trusted_publisher } class PackageLocks { String package_lock_json String uv_lock String hatchling_locked String sdk_generator_locked } CIWorkflow --> PackageLocks : uses ReleaseWorkflow --> PackageLocks : uses RegenerateWorkflow --> PackageLocks : uses PublishWorkflow --> PackageLocks : usesScope indicator
CI/tooling-only for the Python SDK repository. There are no intended runtime SDK API changes; the only test-code change is how the contract harness locates its locked local Prism binary.
Risk assessment
Low to medium. The production SDK runtime is not intentionally changed, but release, publish, and regeneration paths are stricter now. The main risk is a workflow environment mismatch or a future generated overwrite of the local Prism launcher change. Local verification covered the workflow commands, lockfile behavior, contract tests, and wheel install path.
User impact
SDK users should see no API or behavior change. Maintainers get reproducible CI, safer release and regeneration jobs, and less exposure to supply-chain drift from floating Node or Python build inputs.
Testing
npm ci --ignore-scriptsnpm audit --audit-level=moderateuv sync --locked --all-extrasuv run ruff checkuv run ruff format --checkuv run pytest tests/test_http_client.py src/archastro/phx_channel/tests/test_unit.pyuv run pytest tests/harnessARCHASTRO_RUN_CHANNEL_CONTRACT_TESTS=1 uv run pytest tests/contractUV_PROJECT_ENVIRONMENT=/tmp/archastro-python-venv-311-supplychainUV_PROJECT_ENVIRONMENT=/tmp/archastro-python-venv-312-supplychainuv build --no-build-isolationuv export --locked --no-dev --no-emit-project --format requirements.txt --output-file dist/runtime-requirements.txtuv pip install --python .wheel-smoke --require-hashes -r dist/runtime-requirements.txtuv pip install --python .wheel-smoke --no-deps dist/*.whl.wheel-smoke/bin/python -c "import archastro.platform; import archastro.phx_channel"uv pip install --require-hashesrejects a tampered requirement hash.git diff --check --cachedFollow-ups and known issues
tests/contract/conftest.pyis generated. The local Prism binary behavior should be upstreamed into@archastro/sdk-generatorso future SDK regeneration preserves it.