Skip to content

Refer to this repo explicitly #1

Refer to this repo explicitly

Refer to this repo explicitly #1

Workflow file for this run

name: Python Features Testing
on:
workflow_call:
inputs:
python-repo-path:
type: string
default: 'temporalio/sdk-python'
version:
required: true
type: string
# When true, the version refers to a repo tag/ref. When false, PyPi package version.
version-is-repo-ref:
required: true
type: boolean
features-repo-path:
type: string
default: 'temporalio/features'
features-repo-ref:
type: string
default: 'main'
# If set, download the docker image for server from the provided artifact name
docker-image-artifact-name:
type: string
required: false
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./features
steps:
- name: Print git info
run: 'echo head_ref: "$GITHUB_HEAD_REF", ref: "$GITHUB_REF", python sdk version: ${{ inputs.version }}'
working-directory: '.'
- name: Download docker artifacts
if: ${{ inputs.docker-image-artifact-name }}
uses: temporalio/features/.github/actions/download-artifact
with:
artifact-name: ${{ inputs.docker-image-artifact-name }}
- name: Checkout SDK features repo
uses: actions/checkout@v3
with:
path: features
repository: ${{ inputs.features-repo-path }}
ref: ${{ inputs.features-repo-ref }}
- name: Checkout Python SDK repo
if: ${{ inputs.version-is-repo-ref }}
uses: actions/checkout@v2
with:
repository: ${{ inputs.python-repo-path }}
submodules: recursive
path: sdk-python
ref: ${{ inputs.version }}
- uses: actions/setup-go@v2
with:
go-version: '^1.20'
- uses: actions/setup-python@v1
with:
python-version: '3.10'
- run: python -m pip install --upgrade wheel poetry poethepoet
# Build SDK ==================================================
- name: Install Protoc
if: ${{ inputs.version-is-repo-ref }}
uses: arduino/setup-protoc@v1
with:
version: '3.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: Swatinem/rust-cache@v1
if: ${{ inputs.version-is-repo-ref }}
with:
working-directory: sdk-python/temporalio/bridge
- run: poetry install --no-root
if: ${{ inputs.version-is-repo-ref }}
working-directory: sdk-python
- run: poetry build
if: ${{ inputs.version-is-repo-ref }}
working-directory: sdk-python
- run: poe fix-wheel
if: ${{ inputs.version-is-repo-ref }}
working-directory: sdk-python
# ============================================================
- name: Start containerized server and dependencies
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.for-server-image.yaml \
-f /tmp/server-docker/docker-compose.yml \
up -d temporal-server cassandra elasticsearch
- name: Run SDK-features tests directly
if: inputs.docker-image-artifact-name == ''
run: go run . run --lang python ${{ inputs.docker-image-artifact-name && '--server localhost:7233 --namespace default' || ''}} --version "${{ inputs.version-is-repo-ref && '$(realpath ../sdk-python)' || inputs.version }}"
# Running the tests in their own step keeps the logs readable
- name: Run containerized SDK-features tests
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.for-server-image.yaml \
-f /tmp/server-docker/docker-compose.yml \
up --no-log-prefix --exit-code-from features-tests-py features-tests-py
- name: Tear down docker compose
if: inputs.docker-image-artifact-name && (success() || failure())
run: docker compose -f ./dockerfiles/docker-compose.for-server-image.yaml -f /tmp/server-docker/docker-compose.yml down -v