-
Notifications
You must be signed in to change notification settings - Fork 14
294 lines (264 loc) · 12.4 KB
/
Copy pathcross-sdk.yml
File metadata and controls
294 lines (264 loc) · 12.4 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
name: Cross-SDK and load scenarios
# Runs integration-testing/ (interop with the TypeScript, Rust, Python and Kotlin SDKs, plus load
# runs) against this checkout. One job per peer and transport, each installing only its own
# toolchain; a prepare job per peer builds the peer once and caches it under the peer's commit, so
# that peer's transport jobs reuse the build. Deliberately not on push or pull_request (the
# Java <-> Java cells run there, from interop-java.yml): it needs several toolchains, clones the
# peer SDKs and takes minutes. It never gates the release workflow.
on:
workflow_dispatch:
inputs:
peers-ref:
description: 'Branch, tag or SHA to test every peer SDK at (empty: each peer''s ref in peers.json)'
required: false
default: ''
peer-overrides:
description: 'Per-peer refs, space separated, e.g. "typescript-sdk=v0.5.0 rust-sdk=v1.2.0"'
required: false
default: ''
peer:
description: 'Run one peer only (java: the Java <-> Java cells, conformance and load)'
type: choice
required: false
default: 'all'
options: [all, java, typescript, rust, python, kotlin]
schedule:
- cron: '17 4 * * *'
permissions:
contents: read
concurrency:
group: cross-sdk-${{ github.ref }}
cancel-in-progress: false
jobs:
# The job matrices, computed so that a manual run can pick one peer (a static include cannot be
# filtered by an input). One "prepare" leg per peer SDK, one "cells" leg per peer and transport.
plan:
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
prepare: ${{ steps.pick.outputs.prepare }}
cells: ${{ steps.pick.outputs.cells }}
has-prepare: ${{ steps.pick.outputs.has-prepare }}
steps:
- id: pick
env:
PEER: ${{ github.event.inputs.peer || 'all' }}
run: |
# Per peer: its toolchain, its transports (cells x-java-<peer>-<t> and x-<peer>-java-<t>),
# and the cache paths of its build.
# java runs as one leg: the Java <-> Java cells, conformance, load.
# kotlin has no Streamable HTTP; its Gradle toolchain is JDK 21 while the SDK and the
# Java programs stay on 17 (the last version listed is the default).
peers="$(jq -c . <<'JSON'
[
{ "peer": "java", "java": "17", "only": "x-java-java-*,conf-*,load-*" },
{ "peer": "typescript", "sdk": "typescript-sdk", "java": "17", "node": true,
"transports": ["stdio", "http", "ws"],
"cache-paths": "integration-testing/.cache/peers/typescript-sdk@*\n~/.npm" },
{ "peer": "rust", "sdk": "rust-sdk", "java": "17", "rust": true,
"transports": ["stdio", "http", "ws"],
"cache-paths": "integration-testing/.cache/peers/rust-sdk@*\nintegration-testing/.cache/build\n~/.cargo/registry/index\n~/.cargo/registry/cache\n~/.cargo/git/db" },
{ "peer": "python", "sdk": "python-sdk", "java": "17", "python": true,
"transports": ["stdio", "http", "ws"],
"cache-paths": "integration-testing/.cache/peers/python-sdk@*" },
{ "peer": "kotlin", "sdk": "kotlin-sdk", "java": "21\n17", "gradle": true,
"transports": ["stdio", "ws"],
"cache-paths": "integration-testing/.cache/peers/kotlin-sdk@*\n~/.gradle/caches\n~/.gradle/wrapper" }
]
JSON
)"
picked="$(jq -c --arg p "$PEER" '[.[] | select($p == "all" or .peer == $p)]' <<< "$peers")"
prepare="$(jq -c '{include: [.[] | select(.sdk)
| . + {only: (["x-*-\(.peer)-*", "x-\(.peer)-*"] | join(","))}
| del(.transports)]}' <<< "$picked")"
cells="$(jq -c '{include: [.[] as $x | ($x.transports // ["all"])[] as $t
| $x + (if $t == "all" then {leg: $x.peer} else {leg: "\($x.peer)-\($t)", transport: $t,
only: (["x-java-\($x.peer)-\($t)*", "x-\($x.peer)-java-\($t)*"] | join(","))} end)
| del(.transports)]}' <<< "$picked")"
jq . <<< "$cells"
{
echo "prepare=$prepare"
echo "cells=$cells"
echo "has-prepare=$(jq '.include | length > 0' <<< "$prepare")"
} >> "$GITHUB_OUTPUT"
# Clone and build each peer once, and cache it under the peer's resolved commit for its legs.
prepare:
name: prepare ${{ matrix.peer }}
needs: plan
if: needs.plan.outputs.has-prepare == 'true'
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.prepare) }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Set up JDK
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Cache the Maven distribution the wrapper uses
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Set up Node 20
if: matrix.node
id: node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
- name: Set up Rust stable
if: matrix.rust
uses: dtolnay/rust-toolchain@02cb101ec7c40f2c49e1d9714d64511d8e1b74de # v1
with:
toolchain: stable
- name: Set up Python 3.12
if: matrix.python
id: python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Point Gradle toolchains at JDK 21
if: matrix.gradle
run: |
mkdir -p ~/.gradle
echo "org.gradle.java.installations.fromEnv=JAVA_HOME_21_X64" >> ~/.gradle/gradle.properties
# The Kotlin SDK's buildSrc needs Gradle itself to run on JDK 21 (JAVA_HOME is 17 here).
echo "org.gradle.java.home=$JAVA_HOME_21_X64" >> ~/.gradle/gradle.properties
- name: Set up JBang
uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1
with:
version: '0.135.1'
setup-java: 'false'
- name: Resolve the peer SDK commit
id: peer
env:
SDK: ${{ matrix.sdk }}
PEERS_REF: ${{ github.event.inputs.peers-ref || '' }}
PEER_OVERRIDES: ${{ github.event.inputs.peer-overrides || '' }}
run: integration-testing/scripts/peer-sha.sh "$SDK" "$PEERS_REF" "$PEER_OVERRIDES" >> "$GITHUB_OUTPUT"
# The key carries the toolchain version the build depends on (the Python venv, Node's
# node_modules) and the commit; a newer commit restores the last build and updates it.
- name: Cache the peer SDK build
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ matrix.cache-paths }}
key: cross-sdk-${{ matrix.sdk }}-tc${{ steps.python.outputs.python-version }}${{ steps.node.outputs.node-version }}-${{ steps.peer.outputs.sha }}-${{ hashFiles('integration-testing/programs/**/Cargo.toml', 'integration-testing/programs/**/*.gradle.kts') }}
restore-keys: |
cross-sdk-${{ matrix.sdk }}-tc${{ steps.python.outputs.python-version }}${{ steps.node.outputs.node-version }}-
- name: Fetch and build the ${{ matrix.peer }} peer and programs
env:
PEERS_REF: ${{ github.event.inputs.peers-ref || '' }}
PEER_OVERRIDES: ${{ github.event.inputs.peer-overrides || '' }}
ONLY: ${{ matrix.only }}
run: |
args=(--only "$ONLY" --prepare-only)
if [ -n "$PEERS_REF" ]; then args+=(--peers-ref "$PEERS_REF"); fi
for o in $PEER_OVERRIDES; do args+=(--peer "$o"); done
integration-testing/scripts/run-all.sh "${args[@]}"
- name: Upload preparation logs
if: failure()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: cross-sdk-prepare-logs-${{ matrix.peer }}
path: integration-testing/logs/
if-no-files-found: ignore
retention-days: 14
scenarios:
name: ${{ matrix.leg }}
needs: [plan, prepare]
# Also runs when a prepare leg failed (that peer's legs then build for themselves) or was
# skipped (java only).
if: ${{ !cancelled() && needs.plan.result == 'success' }}
runs-on: ubuntu-latest
timeout-minutes: 45
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.plan.outputs.cells) }}
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: Set up JDK
uses: actions/setup-java@cf277c60eb25467037889841efdb72551f06f6c3 # v4
with:
java-version: ${{ matrix.java }}
distribution: 'temurin'
cache: maven
- name: Cache the Maven distribution the wrapper uses
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.m2/wrapper
key: maven-wrapper-${{ hashFiles('.mvn/wrapper/maven-wrapper.properties') }}
- name: Set up Node 20
if: matrix.node
id: node
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: '20'
- name: Set up Rust stable
if: matrix.rust
uses: dtolnay/rust-toolchain@02cb101ec7c40f2c49e1d9714d64511d8e1b74de # v1
with:
toolchain: stable
- name: Set up Python 3.12
if: matrix.python
id: python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: '3.12'
- name: Point Gradle toolchains at JDK 21
if: matrix.gradle
run: |
mkdir -p ~/.gradle
echo "org.gradle.java.installations.fromEnv=JAVA_HOME_21_X64" >> ~/.gradle/gradle.properties
# The Kotlin SDK's buildSrc needs Gradle itself to run on JDK 21 (JAVA_HOME is 17 here).
echo "org.gradle.java.home=$JAVA_HOME_21_X64" >> ~/.gradle/gradle.properties
- name: Set up JBang
uses: jbangdev/setup-jbang@2b1b465a7b75f4222b81426f23a01e013aa7b95c # v0.1.1
with:
version: '0.135.1'
setup-java: 'false'
- name: Check the generated configs are up to date
if: matrix.peer == 'java'
working-directory: integration-testing
run: |
jbang GenConfigs.java --check
python3 programs/raw/gen_conf.py --check
- name: Resolve the peer SDK commit
if: matrix.sdk
id: peer
env:
SDK: ${{ matrix.sdk }}
PEERS_REF: ${{ github.event.inputs.peers-ref || '' }}
PEER_OVERRIDES: ${{ github.event.inputs.peer-overrides || '' }}
run: integration-testing/scripts/peer-sha.sh "$SDK" "$PEERS_REF" "$PEER_OVERRIDES" >> "$GITHUB_OUTPUT"
# Restore only: the prepare job saved this key. On a miss the leg builds for itself.
- name: Restore the peer SDK build
if: matrix.sdk
uses: actions/cache/restore@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ${{ matrix.cache-paths }}
key: cross-sdk-${{ matrix.sdk }}-tc${{ steps.python.outputs.python-version }}${{ steps.node.outputs.node-version }}-${{ steps.peer.outputs.sha }}-${{ hashFiles('integration-testing/programs/**/Cargo.toml', 'integration-testing/programs/**/*.gradle.kts') }}
restore-keys: |
cross-sdk-${{ matrix.sdk }}-tc${{ steps.python.outputs.python-version }}${{ steps.node.outputs.node-version }}-
- name: Run the ${{ matrix.leg }} scenarios
env:
PEERS_REF: ${{ github.event.inputs.peers-ref || '' }}
PEER_OVERRIDES: ${{ github.event.inputs.peer-overrides || '' }}
ONLY: ${{ matrix.only }}
RUN_LABEL: ${{ matrix.leg }}
run: |
args=(--only "$ONLY")
if [ -n "$PEERS_REF" ]; then args+=(--peers-ref "$PEERS_REF"); fi
for o in $PEER_OVERRIDES; do args+=(--peer "$o"); done
integration-testing/scripts/run-all.sh "${args[@]}"
- name: Upload scenario logs
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: cross-sdk-logs-${{ matrix.leg }}
path: integration-testing/logs/
if-no-files-found: ignore
retention-days: 14