Skip to content

Harden CI: Artifactory OIDC, uv, PyPI Trusted Publishing - #535

Merged
MichaelGHSeg merged 14 commits into
masterfrom
ci/harden-build-publish
Aug 11, 2026
Merged

Harden CI: Artifactory OIDC, uv, PyPI Trusted Publishing#535
MichaelGHSeg merged 14 commits into
masterfrom
ci/harden-build-publish

Conversation

@MichaelGHSeg

Copy link
Copy Markdown
Contributor

Summary

  • Add .github/actions/artifactory-oidc/ composite action — exchanges GitHub OIDC token for short-lived Artifactory access token, configures UV_INDEX_URL/PIP_INDEX_URL for virtual-pypi-thirdparty
  • Replace main.yml + tests.yml with ci.yml — fork-aware runner selection, Artifactory resolution on same-repo PRs, SHA-pinned actions, uv-based test matrix (Python 3.9–3.13)
  • Add deploy.yml — PyPI Trusted Publishing (OIDC, no stored token), PEP 740 attestations, gated behind environment: pypi
  • Migrate setup.pypyproject.toml (hatchling) + uv.lock
  • Update devbox.json to use uv
  • Update e2e-tests.yml — remove E2E_TESTS_TOKEN (sdk-e2e-tests going public), SHA-pin actions, fork-aware

Test plan

  • CI workflow runs on this PR (fork path: ubuntu-latest, public PyPI)
  • Artifactory OIDC exchange succeeds on same-repo CI
  • uv sync --frozen passes against committed uv.lock
  • Build job produces installable wheel
  • Before merging: register PyPI Trusted Publisher on pypi.org (repo: segmentio/analytics-python, workflow: deploy.yml, environment: pypi)
  • Before merging: create pypi GitHub environment with protection rules
  • Before merging: set ARTIFACTORY_URL repository variable

- Add Artifactory OIDC composite action for build-time dep resolution
- Replace main.yml + tests.yml with fork-aware ci.yml (uv, SHA-pinned)
- Add deploy.yml: PyPI Trusted Publishing, PEP 740 attestations, no stored tokens
- Migrate setup.py to pyproject.toml (hatchling) + uv.lock
- Update devbox.json to use uv
- Update e2e-tests.yml: remove E2E_TESTS_TOKEN, SHA-pin actions, fork-aware
didiergarcia
didiergarcia previously approved these changes Jul 10, 2026
…usted publishing

- Rename workflow file to publish.yml (matches trusted publisher config)
- Rename workflow to Publish (PyPI matches on workflow filename)
- Switch environment: pypi -> production (matches trusted publisher config)
- Use twine --trusted-publishing=always instead of API token
…backend

uv sync/build --no-build-isolation requires the build backend to
already be importable inside the venv. Since hatchling was only
pip-installed into the system Python (not the venv uv creates), the
editable install failed with ModuleNotFoundError. Letting uv handle
build isolation naturally resolves hatchling from the configured index.

Also unpins uv in publish.yml to match ci.yml (commit 4f058b3).
The OAuth manager uses RS256 (via PyJWT), which requires the
cryptography package. Without the [crypto] extra, PyJWT can't find
the algorithm and all OAuth tests fail.
Set line-length = 140 to match existing code style. Fix F841
(unused variable) in test_oauth.py and suppress F821 (__path__
reference in legacy test discovery). Auto-fix import sorting and
apply ruff format across the codebase.
The all-checks job was stuck waiting for a runner because it used
ubuntu-latest while the org only has ubuntu-x64 runners available.
Apply the same fork-aware runner selection as other jobs.
@didiergarcia
didiergarcia self-requested a review August 11, 2026 17:36
@MichaelGHSeg
MichaelGHSeg merged commit 9955ae7 into master Aug 11, 2026
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants