Skip to content

Commit ca98747

Browse files
PYTHON-5047 Improve testing of publish workflows and fix integration tests (#943)
* PYTHON-5047 Improve testing of publish workflows * fix handling of testpypi * fix dry run logic * fix dry run logic * fix integ test * debug * fix integ test * update crypt_shared_dir * test * update path * update test * use upstream * use upstream * use fork * Get drivers-evergreen-tools from master again --------- Co-authored-by: Casey Clements <[email protected]>
1 parent 34a9572 commit ca98747

File tree

3 files changed

+32
-12
lines changed

3 files changed

+32
-12
lines changed

.github/workflows/release-python.yml

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,25 @@ on:
88
required: true
99
following_version:
1010
description: "The post (dev) version to set"
11-
required: true
1211
dry_run:
1312
description: "Dry Run?"
1413
default: false
1514
type: boolean
15+
schedule:
16+
- cron: '30 5 * * *'
1617

1718
env:
1819
# Changes per repo
1920
PRODUCT_NAME: PyMongoCrypt
2021
# Changes per branch
2122
SILK_ASSET_GROUP: pymongocrypt
2223
EVERGREEN_PROJECT: libmongocrypt
24+
# Constant
25+
# inputs will be empty on a scheduled run. so, we only set dry_run
26+
# to 'false' when the input is set to 'false'.
27+
DRY_RUN: ${{ ! contains(inputs.dry_run, 'false') }}
28+
FOLLOWING_VERSION: ${{ inputs.following_version || '' }}
29+
VERSION: ${{ inputs.version || '10.10.10.10' }}
2330

2431
defaults:
2532
run:
@@ -48,9 +55,9 @@ jobs:
4855
- uses: mongodb-labs/drivers-github-tools/python/pre-publish@v2
4956
id: pre-publish
5057
with:
51-
version: ${{ inputs.version }}
58+
version: ${{ env.VERSION }}
5259
working_directory: ./bindings/python
53-
dry_run: ${{ inputs.dry_run }}
60+
dry_run: ${{ env.DRY_RUN }}
5461
tag_template: "pymongocrypt-${VERSION}"
5562
tag_message_template: "Release PyMongoCrypt ${VERSION}"
5663

@@ -80,8 +87,14 @@ jobs:
8087
with:
8188
name: all-dist-${{ github.run_id }}
8289
path: dist/
90+
- name: Publish package distributions to TestPyPI
91+
uses: pypa/gh-action-pypi-publish@release/v1
92+
with:
93+
repository-url: https://test.pypi.org/legacy/
94+
skip-existing: true
95+
attestations: ${{ env.DRY_RUN }}
8396
- name: Publish package distributions to PyPI
84-
if: startsWith(inputs.dry_run, 'false')
97+
if: startsWith(env.DRY_RUN, 'false')
8598
uses: pypa/gh-action-pypi-publish@release/v1
8699

87100
post-publish:
@@ -106,12 +119,12 @@ jobs:
106119
artifactory_username: ${{ vars.ARTIFACTORY_USERNAME }}
107120
- uses: mongodb-labs/drivers-github-tools/python/post-publish@v2
108121
with:
109-
version: ${{ inputs.version }}
110-
following_version: ${{ inputs.following_version }}
122+
version: ${{ env.VERSION }}
123+
following_version: ${{ env.FOLLOWING_VERSION }}
111124
working_directory: ./bindings/python
112125
product_name: ${{ env.PRODUCT_NAME }}
113126
silk_asset_group: ${{ env.SILK_ASSET_GROUP }}
114127
evergreen_project: ${{ env.EVERGREEN_PROJECT }}
115128
tag_template: "pymongocrypt-${VERSION}"
116129
token: ${{ github.token }}
117-
dry_run: ${{ inputs.dry_run }}
130+
dry_run: ${{ env.DRY_RUN }}

bindings/python/.evergreen/integ-setup.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ EOT
3838

3939
# Get the secrets
4040
bash $DRIVERS_TOOLS/.evergreen/csfle/setup-secrets.sh
41+
# Start the csfle servers
42+
bash $DRIVERS_TOOLS/.evergreen/csfle/start-servers.sh
4143

4244
# Clone mongo-python-driver
4345
git clone https://github.com/mongodb/mongo-python-driver.git ${PYMONGO_DIR}

bindings/python/.evergreen/integ-test.sh

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ BASE_PYTHON=$(find_python3)
1111
# MONGOCRYPT_DIR is set by libmongocrypt/.evergreen/config.yml
1212
MONGOCRYPT_DIR="$MONGOCRYPT_DIR"
1313
CRYPT_SHARED_DIR="$DRIVERS_TOOLS"
14+
MONGODB_BINARIES="$DRIVERS_TOOLS/mongodb/bin"
1415

1516
MACHINE=$(uname -m)
1617
if [ $MACHINE == "aarch64" ]; then
@@ -33,11 +34,15 @@ pushd $PYMONGO_DIR
3334
pip install -e ".[test,encryption]"
3435
source ${DRIVERS_TOOLS}/.evergreen/csfle/secrets-export.sh
3536
set -x
36-
TEST_CRYPT_SHARED=1 DYLD_FALLBACK_LIBRARY_PATH=$CRYPT_SHARED_DIR:${DYLD_FALLBACK_LIBRARY_PATH:-} \
37-
LD_LIBRARY_PATH=$CRYPT_SHARED_DIR:${LD_LIBRARY_PATH-} \
38-
PATH=$CRYPT_SHARED_DIR:$PATH \
39-
AUTH=auth SSL=ssl \
40-
.evergreen/run-tests.sh -m encryption
37+
export DB_USER="bob"
38+
export DB_PASSWORD="pwd123"
39+
export CLIENT_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/client.pem"
40+
export CA_PEM="$DRIVERS_TOOLS/.evergreen/x509gen/ca.pem"
41+
export DYLD_FALLBACK_LIBRARY_PATH=$CRYPT_SHARED_DIR:${DYLD_FALLBACK_LIBRARY_PATH:-}
42+
export LD_LIBRARY_PATH=$CRYPT_SHARED_DIR:${LD_LIBRARY_PATH-}
43+
export PATH=$CRYPT_SHARED_DIR:$MONGODB_BINARIES:$PATH
44+
export TEST_CRYPT_SHARED="1"
45+
pytest --maxfail=10 -v -m encryption
4146

4247
popd
4348
deactivate

0 commit comments

Comments
 (0)