-
Notifications
You must be signed in to change notification settings - Fork 23
374 lines (363 loc) · 13.9 KB
/
ci.yml
File metadata and controls
374 lines (363 loc) · 13.9 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
name: Continuous Integration
permissions:
contents: read
actions: write
checks: write
env:
MISE_VERSION: v2025.12.1
MISE_NODE_VERIFY: no
on: # rebuild any PRs and main branch changes
pull_request:
push:
branches:
- main
jobs:
test-omes:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version-file: "go.mod"
- name: Install mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4
with:
version: ${{ env.MISE_VERSION }}
# Scope to just Python for project build tests
- name: Install Tools
run: |
go run ./cmd/dev install python
- name: Run tests
run: |
go test -v -race ./... 2>&1 | \
go run github.com/jstemmer/go-junit-report/v2@latest \
-set-exit-code -iocopy -out junit-omes.xml
- name: Publish Test Results
uses: mikepenz/action-junit-report@bccf2e31636835cf0874589931c4116687171386 # v6
if: failure()
with:
report_paths: "junit-omes.xml"
check_name: "Omes Test Failures"
detailed_summary: true
check_annotations: false
annotate_only: true
skip_annotations: true
check-worker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target: [go, java, python, ruby, typescript, dotnet, kitchensink-gen]
include:
- target: go
tools: go
- target: java
tools: java go
- target: python
tools: python go
- target: ruby
tools: ruby go
- target: typescript
tools: rust go node protoc
- target: dotnet
tools: dotnet go
- target: kitchensink-gen
tools: rust go protoc
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: true
- name: Install mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4
with:
version: ${{ env.MISE_VERSION }}
- name: Install Tools
run: |
go run ./cmd/dev install ${{ matrix.tools }}
- name: Ensure rustfmt
if: matrix.target == 'kitchensink-gen'
run: |
rustup component add rustfmt || echo "rustup not available, skipping rustfmt component add"
- name: Add Go bin to PATH
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Lint and format ${{ matrix.target }} worker
run: |
go run ./cmd/dev lint-and-format ${{ matrix.target }}
- name: Check formatting
run: |
git diff --exit-code || (echo "${{ matrix.target }} worker has uncommitted formatting changes" && exit 1)
- name: Test ${{ matrix.target }} worker
run: |
go run ./cmd/dev test ${{ matrix.target }}
build-worker:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [go, java, python, ruby, typescript, dotnet]
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: true
- name: Build ${{ matrix.sdk }} worker image
run: |
go run ./cmd/dev build-worker-image \
--language ${{ matrix.sdk }} \
--tag-as-latest
- name: Start ${{ matrix.sdk }} worker image
run: |
docker run \
--rm \
-i -p 10233:10233 omes:${{ matrix.sdk }}-latest \
--scenario workflow_with_single_noop_activity \
--log-level debug \
--language ${{ matrix.sdk }} \
--run-id ${{ github.run_id }} \
--embedded-server-address 0.0.0.0:10233 &
- name: Wait for ${{ matrix.sdk }} worker image to start
run: |
timeout 30 bash -c 'until nc -z 127.0.0.1 10233; do sleep 1; done' || (echo "Server failed to start" && exit 1)
- name: Start ${{ matrix.sdk }} worker image
run: |
go run ./cmd run-scenario \
--scenario workflow_with_single_noop_activity \
--log-level debug \
--server-address 127.0.0.1:10233 \
--run-id ${{ github.run_id }} \
--connect-timeout 1m \
--iterations 5
- name: Smoke test throughput_stress to confirm build is usable against ${{ matrix.sdk }} worker
timeout-minutes: 10
run: |
go run ./cmd run-scenario \
--scenario throughput_stress \
--log-level debug \
--server-address 127.0.0.1:10233 \
--run-id ${{ github.run_id }} \
--connect-timeout 1m \
--iterations 2 \
--timeout 5m \
--option internal-iterations=2 \
--option continue-as-new-after-iterations=1 \
--option sleep-time=1ms \
--option visibility-count-timeout=2m
build-project:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [python]
include:
- sdk: python
project: helloworld
dockerfile: dockerfiles/python.Dockerfile
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
submodules: true
- name: Load versions
run: |
set -a && source versions.env && set +a
printenv >> $GITHUB_ENV
- name: Set ${{ matrix.sdk }} project image metadata
run: |
echo "PROJECT_IMAGE_SDK_VERSION=v${PYTHON_SDK_VERSION}" >> "$GITHUB_ENV"
echo "PROJECT_IMAGE_TAG=omes-project-${{ matrix.sdk }}-${{ matrix.project }}" >> "$GITHUB_ENV"
echo "PROJECT_WORKER_CONTAINER=omes-project-${{ matrix.sdk }}-${{ matrix.project }}-worker" >> "$GITHUB_ENV"
echo "PROJECT_RUN_ID=project-${{ github.run_id }}-${{ matrix.sdk }}-${{ matrix.project }}" >> "$GITHUB_ENV"
- name: Build ${{ matrix.sdk }} ${{ matrix.project }} project image
run: |
docker build \
-f ${{ matrix.dockerfile }} \
--build-arg PROJECT_NAME=${{ matrix.project }} \
--build-arg SDK_VERSION=${PROJECT_IMAGE_SDK_VERSION} \
-t ${PROJECT_IMAGE_TAG} .
- name: Create Docker network
run: |
docker network create omes-project-net
- name: Start ${{ matrix.sdk }} ${{ matrix.project }} project worker image
run: |
docker run \
--rm \
--name ${PROJECT_WORKER_CONTAINER} \
--network omes-project-net \
-p 7233:7233 \
${PROJECT_IMAGE_TAG} \
--run-id ${PROJECT_RUN_ID} \
--embedded-server-address 0.0.0.0:7233 &
- name: Wait for embedded server
run: |
timeout 30 bash -c 'until nc -z 127.0.0.1 7233; do sleep 1; done' || (echo "Project worker failed to start" && exit 1)
- name: Run project scenario against ${{ matrix.sdk }} ${{ matrix.project }} worker image
run: |
docker run --rm \
--network omes-project-net \
${PROJECT_IMAGE_TAG} \
run-scenario \
--scenario project \
--run-id ${PROJECT_RUN_ID} \
--server-address ${PROJECT_WORKER_CONTAINER}:7233 \
--iterations 1 \
--connect-timeout 30s
- name: Print project worker logs
if: failure()
run: |
docker logs ${PROJECT_WORKER_CONTAINER} || true
- name: Stop ${{ matrix.sdk }} ${{ matrix.project }} project worker image
if: always()
run: |
docker stop ${PROJECT_WORKER_CONTAINER} || true
- name: Remove Docker network
if: always()
run: |
docker network rm omes-project-net || true
test-kitchensink:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
sdk: [go, java, python, ruby, typescript, dotnet]
include:
- sdk: go
tools: go
- sdk: java
tools: java go
- sdk: python
tools: python go
- sdk: ruby
tools: ruby go
- sdk: typescript
tools: node go
- sdk: dotnet
tools: dotnet go
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: true
- name: Install mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4
with:
version: ${{ env.MISE_VERSION }}
- name: Install Tools
run: |
go run ./cmd/dev install ${{ matrix.tools }}
- name: Ensure rustfmt
if: matrix.target == 'kitchensink-gen'
run: |
rustup component add rustfmt || echo "rustup not available, skipping rustfmt component add"
- name: Test Kitchensink ${{ matrix.sdk }}
run: |
SDK=${{ matrix.sdk }} go test -v -race ./loadgen -run TestKitchenSink 2>&1 | \
go run github.com/jstemmer/go-junit-report/v2@latest \
-set-exit-code -iocopy -out junit-kitchensink-${{ matrix.sdk }}.xml
- name: Publish Kitchensink Test Results
uses: mikepenz/action-junit-report@bccf2e31636835cf0874589931c4116687171386 # v6
if: failure()
with:
report_paths: "junit-kitchensink-${{ matrix.sdk }}.xml"
check_name: "Kitchensink Test Failures (${{ matrix.sdk }})"
detailed_summary: true
check_annotations: false
annotate_only: true
skip_annotations: true
build-ks-gen-and-ensure-protos-up-to-date:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: "true"
- name: Install mise
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4
with:
version: ${{ env.MISE_VERSION }}
- name: Install Tools
run: |
go run ./cmd/dev install rust go protoc node buf
- name: Add Go bin to PATH
run: |
echo "$(go env GOPATH)/bin" >> $GITHUB_PATH
- name: Build proto
run: |
go run ./cmd/dev build-proto
- name: Check diff
run: |
git config --global core.safecrlf false
git diff > generator.diff
git diff --exit-code
- name: Upload generator diff
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7
if: always()
with:
name: generator-diff
path: generator.diff
if-no-files-found: ignore
build-cli:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
submodules: true
- uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6
with:
go-version-file: "go.mod"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4
- name: Build CLI image
run: |
go run ./cmd/dev build-cli-image
- name: Test CLI image
run: |
IMAGE_TAG=$(echo "$BUILT_IMAGE_TAGS" | cut -d';' -f1)
docker run --rm --pull never $IMAGE_TAG --help
docker run --rm --pull never $IMAGE_TAG list-scenarios
docker run --rm --pull never --entrypoint /app/kitchen-sink-gen $IMAGE_TAG --help
# env cannot be referenced in jobs.<job_id>.with.<with_id>, so we need a job to run before
# to append a "v" to the version string
prepare-for-docker-push:
runs-on: ubuntu-latest
outputs:
go-sdk-version: ${{ steps.set-output.outputs.go-sdk-version }}
ts-sdk-version: ${{ steps.set-output.outputs.ts-sdk-version }}
java-sdk-version: ${{ steps.set-output.outputs.java-sdk-version }}
python-sdk-version: ${{ steps.set-output.outputs.python-sdk-version }}
dotnet-sdk-version: ${{ steps.set-output.outputs.dotnet-sdk-version }}
ruby-sdk-version: ${{ steps.set-output.outputs.ruby-sdk-version }}
steps:
- name: Checkout repo
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Load versions
run: |
set -a && source versions.env && set +a
printenv >> $GITHUB_ENV
- name: Set output variables to pass to docker YML
id: set-output
run: |
echo "go-sdk-version=v${{ env.GO_SDK_VERSION }}" >> "$GITHUB_OUTPUT"
echo "ts-sdk-version=v${{ env.TYPESCRIPT_SDK_VERSION }}" >> "$GITHUB_OUTPUT"
echo "java-sdk-version=v${{ env.JAVA_SDK_VERSION }}" >> "$GITHUB_OUTPUT"
echo "python-sdk-version=v${{ env.PYTHON_SDK_VERSION }}" >> "$GITHUB_OUTPUT"
echo "dotnet-sdk-version=v${{ env.DOTNET_SDK_VERSION }}" >> "$GITHUB_OUTPUT"
echo "ruby-sdk-version=v${{ env.RUBY_SDK_VERSION }}" >> "$GITHUB_OUTPUT"
push-docker-images:
needs: prepare-for-docker-push
uses: ./.github/workflows/all-docker-images.yml
secrets: inherit
with:
# Only images that are built from `main` are tagged as `latest`.
# This ensures that internal systems can rely on the latest tag to be stable.
as-latest: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
do-push: true
go-version: ${{ needs.prepare-for-docker-push.outputs.go-sdk-version }}
ts-version: ${{ needs.prepare-for-docker-push.outputs.ts-sdk-version }}
java-version: ${{ needs.prepare-for-docker-push.outputs.java-sdk-version }}
py-version: ${{ needs.prepare-for-docker-push.outputs.python-sdk-version }}
dotnet-version: ${{ needs.prepare-for-docker-push.outputs.dotnet-sdk-version }}
ruby-version: ${{ needs.prepare-for-docker-push.outputs.ruby-sdk-version }}