|
| 1 | +name: Release package smoke test |
| 2 | +description: Install a published temporalio package and run a minimal SDK workflow. |
| 3 | +inputs: |
| 4 | + version: |
| 5 | + description: "Package version to install and verify" |
| 6 | + required: true |
| 7 | + index-url: |
| 8 | + description: "Primary package index URL" |
| 9 | + required: true |
| 10 | + extra-index-url: |
| 11 | + description: "Optional fallback package index URL" |
| 12 | + required: false |
| 13 | + default: "" |
| 14 | +runs: |
| 15 | + using: composite |
| 16 | + steps: |
| 17 | + - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5 |
| 18 | + with: |
| 19 | + python-version: "3.10" |
| 20 | + - name: Install package |
| 21 | + shell: bash |
| 22 | + env: |
| 23 | + VERSION: ${{ inputs.version }} |
| 24 | + INDEX_URL: ${{ inputs.index-url }} |
| 25 | + EXTRA_INDEX_URL: ${{ inputs.extra-index-url }} |
| 26 | + run: | |
| 27 | + set -euo pipefail |
| 28 | + python -m venv .venv |
| 29 | + .venv/bin/python -m pip install --upgrade pip |
| 30 | +
|
| 31 | + install_args=(--prefer-binary --index-url "$INDEX_URL") |
| 32 | + if [[ -n "$EXTRA_INDEX_URL" ]]; then |
| 33 | + install_args+=(--extra-index-url "$EXTRA_INDEX_URL") |
| 34 | + fi |
| 35 | +
|
| 36 | + .venv/bin/python -m pip install "${install_args[@]}" "temporalio==$VERSION" |
| 37 | + - name: Run SDK smoke test |
| 38 | + shell: bash |
| 39 | + env: |
| 40 | + VERSION: ${{ inputs.version }} |
| 41 | + run: | |
| 42 | + set -euo pipefail |
| 43 | + .venv/bin/python - <<'PY' |
| 44 | + import asyncio |
| 45 | + import os |
| 46 | + import uuid |
| 47 | + from datetime import timedelta |
| 48 | +
|
| 49 | + import temporalio |
| 50 | + from temporalio import activity, workflow |
| 51 | + from temporalio.testing import WorkflowEnvironment |
| 52 | + from temporalio.worker import UnsandboxedWorkflowRunner, Worker |
| 53 | +
|
| 54 | + expected_version = os.environ["VERSION"] |
| 55 | + if temporalio.__version__ != expected_version: |
| 56 | + raise RuntimeError( |
| 57 | + f"Expected temporalio {expected_version}, got {temporalio.__version__}" |
| 58 | + ) |
| 59 | +
|
| 60 | + @activity.defn |
| 61 | + async def say_hello(name: str) -> str: |
| 62 | + return f"Hello, {name}!" |
| 63 | +
|
| 64 | + @workflow.defn |
| 65 | + class SmokeWorkflow: |
| 66 | + @workflow.run |
| 67 | + async def run(self, name: str) -> str: |
| 68 | + return await workflow.execute_activity( |
| 69 | + say_hello, |
| 70 | + name, |
| 71 | + start_to_close_timeout=timedelta(seconds=10), |
| 72 | + ) |
| 73 | +
|
| 74 | + async def main() -> None: |
| 75 | + task_queue = f"release-smoke-{uuid.uuid4()}" |
| 76 | + async with await WorkflowEnvironment.start_local() as env: |
| 77 | + async with Worker( |
| 78 | + env.client, |
| 79 | + task_queue=task_queue, |
| 80 | + workflows=[SmokeWorkflow], |
| 81 | + activities=[say_hello], |
| 82 | + workflow_runner=UnsandboxedWorkflowRunner(), |
| 83 | + ): |
| 84 | + result = await env.client.execute_workflow( |
| 85 | + SmokeWorkflow.run, |
| 86 | + "trusted publishing", |
| 87 | + id=task_queue, |
| 88 | + task_queue=task_queue, |
| 89 | + ) |
| 90 | + if result != "Hello, trusted publishing!": |
| 91 | + raise RuntimeError(f"Unexpected workflow result: {result!r}") |
| 92 | +
|
| 93 | + asyncio.run(main()) |
| 94 | + PY |
0 commit comments