Repository navigation
174 lines (159 loc) · 6.33 KB
/
Copy pathpython.yaml
File metadata and controls
174 lines (159 loc) · 6.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
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
# Additional dynamic config values to append to docker.yaml (YAML format)
dynamic-config-values:
type: string
required: false
permissions:
contents: read
actions: read
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: "$INPUT_VERSION"'
working-directory: '.'
env:
INPUT_VERSION: ${{ inputs.version }}
- name: Download docker artifacts
if: ${{ inputs.docker-image-artifact-name }}
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
with:
name: ${{ inputs.docker-image-artifact-name }}
path: /tmp/server-docker
- name: Load server Docker Images
if: ${{ inputs.docker-image-artifact-name }}
run: |
docker load --input /tmp/server-docker/temporal-server.tar
docker load --input /tmp/server-docker/temporal-admin-tools.tar
working-directory: '.'
- name: Override IMAGE_TAG environment variable
if: ${{ inputs.docker-image-artifact-name }}
run: |
image_tag=latest
# image_tag won't exist on older builds (like 1.22.0), so default to latest
if [ -f /tmp/server-docker/image_tag ]; then
image_tag=$(cat /tmp/server-docker/image_tag)
fi
echo "IMAGE_TAG=${image_tag}" >> $GITHUB_ENV
working-directory: '.'
- name: Checkout SDK features repo
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
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@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
repository: ${{ inputs.python-repo-path }}
submodules: recursive
path: sdk-python
ref: ${{ inputs.version }}
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version: '^1.21'
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
with:
python-version: '3.10'
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
# Build SDK ==================================================
- name: Install Protoc
if: ${{ inputs.version-is-repo-ref }}
uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3
with:
# TODO: Upgrade proto once https://github.com/arduino/setup-protoc/issues/99 is fixed
version: '23.x'
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
if: ${{ inputs.version-is-repo-ref }}
with:
cache-bin: false
workspaces: sdk-python/temporalio/bridge
- uses: astral-sh/setup-uv@cec208311dfd045dd5311c1add060b2062131d57 # v8
- run: uv sync
if: ${{ inputs.version-is-repo-ref }}
working-directory: sdk-python
- run: uv build
if: ${{ inputs.version-is-repo-ref }}
working-directory: sdk-python
# ============================================================
- name: Append custom dynamic config
if: ${{ inputs.dynamic-config-values }}
env:
DYNAMIC_CONFIG_VALUES: ${{ inputs.dynamic-config-values }}
run: |
echo "" >> ./dockerfiles/dynamicconfig/docker.yaml
echo "$DYNAMIC_CONFIG_VALUES" >> ./dockerfiles/dynamicconfig/docker.yaml
- name: Start containerized server and dependencies
id: start-server
if: inputs.docker-image-artifact-name
run: |
docker compose \
-f ./dockerfiles/docker-compose.yml \
up -d cassandra elasticsearch temporal-admin-tools temporal-server temporal-create-namespace
- name: Show all container logs
if: always()
run: |
echo "=== All container logs ==="
docker compose \
-f ./dockerfiles/docker-compose.yml \
logs
working-directory: ./features
- name: Run SDK-features tests directly
if: inputs.docker-image-artifact-name == ''
env:
INPUT_VERSION: ${{ inputs.version }}
INPUT_VERSION_IS_REPO_REF: ${{ inputs.version-is-repo-ref }}
run: |
if [ "$INPUT_VERSION_IS_REPO_REF" = "true" ]; then
go run . run --lang python --version "$(realpath ../sdk-python)"
else
go run . run --lang python --version "$INPUT_VERSION"
fi
# 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.yml \
up --no-log-prefix --exit-code-from features-tests-py features-tests-py
- name: Show all container logs before teardown
if: always() && inputs.docker-image-artifact-name
run: |
echo "=== All container logs before teardown ==="
docker compose \
-f ./dockerfiles/docker-compose.yml \
logs
working-directory: ./features
- name: Tear down docker compose
if: inputs.docker-image-artifact-name && (success() || failure())
run: docker compose -f ./dockerfiles/docker-compose.yml down -v