Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions .github/scripts/cloud_namespace.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
from temporalio.api.cloud.cloudservice.v1 import (
CreateNamespaceRequest,
DeleteNamespaceRequest,
DeleteNexusEndpointRequest,
GetAsyncOperationRequest,
GetNamespaceRequest,
GetNexusEndpointsRequest,
)
from temporalio.api.cloud.namespace.v1 import MtlsAuthSpec, NamespaceSpec
from temporalio.api.cloud.operation.v1 import AsyncOperation
Expand Down Expand Up @@ -51,8 +53,10 @@ async def wait_for_operation(

async def create() -> None:
client = await cloud_client()
namespace_name = "sdk-python-ci-{}-{}".format(
os.environ["GITHUB_RUN_ID"], os.environ["GITHUB_RUN_ATTEMPT"]
namespace_name = "sdk-python-ci-{}-{}{}".format(
os.environ["GITHUB_RUN_ID"],
os.environ["GITHUB_RUN_ATTEMPT"],
os.environ.get("TEMPORAL_CLOUD_NAMESPACE_SUFFIX", ""),
)
result = await client.cloud_service.create_namespace(
CreateNamespaceRequest(
Expand Down Expand Up @@ -80,6 +84,27 @@ async def delete(namespace: str) -> None:
existing = await client.cloud_service.get_namespace(
GetNamespaceRequest(namespace=namespace)
)
endpoints = []
page_token = ""
while True:
response = await client.cloud_service.get_nexus_endpoints(
GetNexusEndpointsRequest(
target_namespace_id=existing.namespace.namespace,
page_token=page_token,
)
)
endpoints.extend(response.endpoints)
if not response.next_page_token:
break
page_token = response.next_page_token
for endpoint in endpoints:
result = await client.cloud_service.delete_nexus_endpoint(
DeleteNexusEndpointRequest(
endpoint_id=endpoint.id,
resource_version=endpoint.resource_version,
)
)
await wait_for_operation(client, result.async_operation)
result = await client.cloud_service.delete_namespace(
DeleteNamespaceRequest(
namespace=namespace,
Expand Down
77 changes: 76 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,9 @@ jobs:
env:
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: v0.19.1
TEMPORAL_CLOUD_NAMESPACE_SUFFIX: -general
- run: mkdir junit-xml
- run: poe test -s --workflow-environment envconfig --junit-xml=junit-xml/cloud.xml
- run: poe test -s --workflow-environment envconfig --ignore=tests/nexus --junit-xml=junit-xml/cloud.xml
timeout-minutes: 15
env:
TEMPORAL_ADDRESS: ${{ steps.create-cloud-namespace.outputs.namespace }}.tmprl.cloud:7233
Expand All @@ -278,6 +279,80 @@ jobs:
path: junit-xml
retention-days: 14

# Nexus endpoint provisioning is slow on Cloud, so run these tests separately.
cloud-nexus-test:
if: ${{ github.event.pull_request.head.repo.full_name == '' || github.event.pull_request.head.repo.full_name == 'temporalio/sdk-python' }}
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
submodules: recursive
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.14"
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
with:
workspaces: temporalio/bridge -> target
key: ${{ env.pythonLocation }}
- uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
version: "23.x"
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
- run: uv tool install poethepoet
- run: uv sync --all-extras
- run: poe build-develop
- name: Generate Cloud test certificates
run: |
cert_dir="$RUNNER_TEMP/cloud-test-certs"
mkdir "$cert_dir"
openssl req -x509 -newkey rsa:2048 -nodes -days 1 \
-keyout "$cert_dir/ca.key" -out "$cert_dir/ca.pem" \
-subj '/CN=Temporal Python SDK Cloud CI CA'
openssl req -newkey rsa:2048 -nodes \
-keyout "$cert_dir/client.key" -out "$cert_dir/client.csr" \
-subj '/CN=Temporal Python SDK Cloud CI'
openssl x509 -req -days 1 -in "$cert_dir/client.csr" \
-CA "$cert_dir/ca.pem" -CAkey "$cert_dir/ca.key" -CAcreateserial \
-out "$cert_dir/client.pem" -extfile <(printf 'extendedKeyUsage=clientAuth')
{
echo "TEMPORAL_CLOUD_CLIENT_CA_PATH=$cert_dir/ca.pem"
echo "TEMPORAL_TLS_CLIENT_CERT_PATH=$cert_dir/client.pem"
echo "TEMPORAL_TLS_CLIENT_KEY_PATH=$cert_dir/client.key"
} >> "$GITHUB_ENV"
- name: Create Cloud namespace
id: create-cloud-namespace
run: uv run python .github/scripts/cloud_namespace.py create
env:
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: v0.19.1
TEMPORAL_CLOUD_NAMESPACE_SUFFIX: -nexus
- run: mkdir junit-xml
- run: poe test -n 16 -s --workflow-environment envconfig tests/nexus --junit-xml=junit-xml/cloud-nexus.xml
timeout-minutes: 45
env:
TEMPORAL_ADDRESS: ${{ steps.create-cloud-namespace.outputs.namespace }}.tmprl.cloud:7233
TEMPORAL_NAMESPACE: ${{ steps.create-cloud-namespace.outputs.namespace }}
TEMPORAL_IS_CLOUD_TESTS: true
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: v0.19.1
TEMPORAL_CLIENT_CLOUD_NAMESPACE: ${{ steps.create-cloud-namespace.outputs.namespace }}
- name: Delete Cloud namespace
if: ${{ always() && steps.create-cloud-namespace.outputs.namespace != '' }}
run: uv run python .github/scripts/cloud_namespace.py delete "${{ steps.create-cloud-namespace.outputs.namespace }}"
env:
TEMPORAL_CLIENT_CLOUD_API_KEY: ${{ secrets.TEMPORAL_CLIENT_CLOUD_API_KEY }}
TEMPORAL_CLIENT_CLOUD_API_VERSION: v0.19.1
- name: Upload junit-xml artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
if: always()
with:
name: junit-xml--${{github.run_id}}--${{github.run_attempt}}--cloud-nexus
path: junit-xml
retention-days: 14

# Runs the sdk features repo tests with this repo's current SDK code
features-tests:
uses: temporalio/features/.github/workflows/python.yaml@main
Expand Down
Loading
Loading