Skip to content

Commit

Permalink
ci: test upload artifacts to test.pypi.org (#10271)
Browse files Browse the repository at this point in the history
In order to have 1:1 with what we upload to pypi.org we need #10305. It
is ok to merge this PR with that one, we will just be missing the sdist.

When building tags test uploading built files to https://test.pypi.org/

## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))

## Reviewer Checklist
- [ ] Reviewer has checked that all the criteria below are met 
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)
  • Loading branch information
brettlangdon authored Aug 22, 2024
1 parent e94ed60 commit dcd83f0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ stages:
- benchmarks
- macrobenchmarks
- dogfood
- release

variables:
REPO_LANG: python # "python" is used everywhere rather than "py"
Expand Down
42 changes: 42 additions & 0 deletions .gitlab/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
variables:
PYPI_PUBLISH_IMAGE: registry.ddbuild.io/images/mirror/python:3.12.0

.release_base:
stage: release
only:
# v2.10.0
# v2.10.1
# v2.10.0rc0
# v2.10.0rc5
- /^v[0-9]+\.[0-9]+\.[0-9]+(rc[0-9]+)?$/

.release_pypi:
extends: .release_base
image: ${PYPI_PUBLISH_IMAGE}
tags: [ "arch:amd64" ]
variables:
TWINE_USERNAME: "__token__"
TWINE_NON_INTERACTIVE: "1"
before_script:
- export TWINE_PASSWORD=$(aws ssm get-parameter --region us-east-1 --name "ci.${CI_PROJECT_NAME}.${PYPI_REPOSITORY}_token" --with-decryption --query "Parameter.Value" --out text)
- python -m pip install twine
- python -m twine check --strict pywheels/*
script:
- echo "python -m twine upload --repository ${PYPI_REPOSITORY} pywheels/*"
artifacts:
paths:
- pywheels/*.whl
- pywheels/*.tar.gz

release_pypi_test:
extends: .release_pypi
dependencies: [ "download_ddtrace_wheels" ]
variables:
PYPI_REPOSITORY: testpypi

# TODO: Replace GitHub Action PyPI upload with this job
# release_pypi_prod:
# extends: .release_pypi
# needs: [ "release_pypi_test" ]
# variables:
# PYPI_REPOSITORY: pypi

0 comments on commit dcd83f0

Please sign in to comment.