Skip to content

Commit ae22546

Browse files
authored
Merge pull request #289 from kalamdb/hotfixes/manifest
Fixes to building packages
2 parents 38de8c1 + 9e79545 commit ae22546

12 files changed

Lines changed: 156 additions & 77 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ env:
1515
RUST_VERSION: "1.92.0"
1616
RUSTC_WRAPPER: ""
1717
CARGO_BUILD_RUSTC_WRAPPER: ""
18+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
1819

1920
jobs:
2021
fmt:

.github/workflows/cli-cluster-e2e.yml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,6 @@ on:
1111
- 'versions.json'
1212
- 'nextest.toml'
1313
- '.github/workflows/cli-cluster-e2e.yml'
14-
pull_request:
15-
paths:
16-
- 'cli/**'
17-
- 'scripts/cluster.sh'
18-
- 'scripts/download-release-server.sh'
19-
- 'scripts/resolve-latest-release-asset.py'
20-
- 'versions.json'
21-
- 'nextest.toml'
22-
- '.github/workflows/cli-cluster-e2e.yml'
2314
workflow_dispatch:
2415

2516
permissions:
@@ -30,6 +21,7 @@ env:
3021
RUST_VERSION: "1.92.0"
3122
RUSTC_WRAPPER: ""
3223
CARGO_BUILD_RUSTC_WRAPPER: ""
24+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
3325

3426
jobs:
3527
resolve_versions:

.github/workflows/codeql.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212
name: "CodeQL Advanced"
1313

1414
on:
15-
schedule:
16-
- cron: '18 9 * * 0'
15+
push:
16+
branches: [main]
17+
workflow_dispatch:
18+
19+
env:
20+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
1721

1822
jobs:
1923
analyze:

.github/workflows/dart-sdk.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ env:
3737
RUST_VERSION: "1.92.0"
3838
RUSTC_WRAPPER: ""
3939
CARGO_BUILD_RUSTC_WRAPPER: ""
40+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
4041

4142
jobs:
4243
resolve_versions:

.github/workflows/python-sdk.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ on:
2525

2626
env:
2727
CARGO_TERM_COLOR: always
28+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
2829

2930
jobs:
3031
test:

.github/workflows/react-e2e.yml

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,6 @@
11
name: React SDK e2e
22

33
on:
4-
push:
5-
branches: [main]
6-
paths:
7-
- 'link/sdks/typescript/react/**'
8-
- 'link/sdks/typescript/client/**'
9-
- 'link/sdks/typescript/orm/**'
10-
- 'link/link-common/**'
11-
- 'link/kalam-client/**'
12-
- 'link/kalam-consumer-wasm/**'
13-
- '.github/workflows/react-e2e.yml'
14-
pull_request:
15-
paths:
16-
- 'link/sdks/typescript/react/**'
17-
- 'link/sdks/typescript/client/**'
18-
- 'link/sdks/typescript/orm/**'
19-
- 'link/link-common/**'
20-
- 'link/kalam-client/**'
21-
- 'link/kalam-consumer-wasm/**'
22-
- '.github/workflows/react-e2e.yml'
234
workflow_dispatch: {}
245

256
permissions:
@@ -30,6 +11,7 @@ env:
3011
RUST_VERSION: "1.92.0"
3112
WASM_PACK_VERSION: "0.15.0"
3213
KALAMDB_URL: "http://127.0.0.1:2900"
14+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
3315

3416
jobs:
3517
e2e:
@@ -55,7 +37,7 @@ jobs:
5537
python-version: '3.11'
5638

5739
- name: Setup Node
58-
uses: actions/setup-node@v5
40+
uses: actions/setup-node@v6
5941
with:
6042
node-version: '24'
6143

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ env:
5050
DEFAULT_PLATFORMS: "linux-x86_64,macos-aarch64,linux-aarch64"
5151
RUSTC_WRAPPER: ""
5252
CARGO_BUILD_RUSTC_WRAPPER: ""
53+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
5354

5455
jobs:
5556
sync_versions_manifest:

.github/workflows/typescript-sdk.yml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ env:
6161
WASM_PACK_VERSION: "0.15.0"
6262
RUSTC_WRAPPER: ""
6363
CARGO_BUILD_RUSTC_WRAPPER: ""
64+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
6465

6566
jobs:
6667
resolve_versions:
@@ -69,6 +70,7 @@ jobs:
6970
outputs:
7071
root_version: ${{ steps.versions.outputs.root_version }}
7172
typescript_version: ${{ steps.versions.outputs.typescript_version }}
73+
test_matrix: ${{ steps.test_matrix.outputs.test_matrix }}
7274
latest_server_release_tag: ${{ steps.latest_server.outputs.release_tag }}
7375
selected_server_version: ${{ steps.latest_server.outputs.selected_version }}
7476
selected_server_selection_reason: ${{ steps.latest_server.outputs.selection_reason }}
@@ -96,6 +98,17 @@ jobs:
9698
set -euo pipefail
9799
python3 scripts/versions.py github-outputs --github-output "$GITHUB_OUTPUT" --repository "$GITHUB_REPOSITORY"
98100
101+
- name: Select TypeScript SDK test matrix
102+
id: test_matrix
103+
shell: bash
104+
run: |
105+
set -euo pipefail
106+
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
107+
echo 'test_matrix={"package":["client","consumer","orm"]}' >> "$GITHUB_OUTPUT"
108+
else
109+
echo 'test_matrix={"package":["client","consumer","orm","react"]}' >> "$GITHUB_OUTPUT"
110+
fi
111+
99112
- name: Resolve latest released server asset
100113
id: latest_server
101114
shell: bash
@@ -145,8 +158,7 @@ jobs:
145158
- download_release_server_binary
146159
strategy:
147160
fail-fast: false
148-
matrix:
149-
package: [client, consumer, orm, react]
161+
matrix: ${{ fromJSON(needs.resolve_versions.outputs.test_matrix) }}
150162
steps:
151163
- name: Checkout
152164
uses: actions/checkout@v6
@@ -256,7 +268,9 @@ jobs:
256268
summarize_tests:
257269
name: Summarize TypeScript SDK Tests
258270
runs-on: ubuntu-latest
259-
needs: test_packages
271+
needs:
272+
- resolve_versions
273+
- test_packages
260274
if: ${{ always() && needs.test_packages.result != 'cancelled' }}
261275
outputs:
262276
total: ${{ steps.parse_badge.outputs.total }}
@@ -276,16 +290,18 @@ jobs:
276290
id: parse_badge
277291
shell: bash
278292
env:
293+
EXPECTED_PACKAGES_JSON: ${{ needs.resolve_versions.outputs.test_matrix }}
279294
JOB_RESULT: ${{ needs.test_packages.result }}
280295
run: |
281296
set -euo pipefail
282297
python3 <<'PYTHON'
298+
import json
283299
import os
284300
import re
285301
from pathlib import Path
286302
287303
artifacts_dir = Path("ts-sdk-test-artifacts")
288-
expected_packages = {"client", "consumer", "orm", "react"}
304+
expected_packages = set(json.loads(os.environ["EXPECTED_PACKAGES_JSON"]).get("package", []))
289305
found_packages = set()
290306
total = 0
291307
passed = 0

.github/workflows/versions.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ on:
2525
permissions:
2626
contents: read
2727

28+
env:
29+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
30+
2831
jobs:
2932
verify:
3033
name: Verify versions.json

link/sdks/typescript/consumer/publish.sh

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ PUBLISH_REGISTRY_HOST="${PUBLISH_REGISTRY_URL#https://}"
2323
PUBLISH_REGISTRY_HOST="${PUBLISH_REGISTRY_HOST#http://}"
2424
PUBLISH_REGISTRY_HOST="${PUBLISH_REGISTRY_HOST%/}"
2525
BUILD_REGISTRY_URL="${BUILD_REGISTRY_URL:-https://registry.npmjs.org}"
26+
PUBLISH_DEPENDENCY_WAIT_ATTEMPTS="${PUBLISH_DEPENDENCY_WAIT_ATTEMPTS:-15}"
27+
PUBLISH_DEPENDENCY_WAIT_SECONDS="${PUBLISH_DEPENDENCY_WAIT_SECONDS:-4}"
2628
REGISTRY_FLAG="--registry $PUBLISH_REGISTRY_URL"
2729
ACCESS_FLAG=""
2830
if [[ -n "$PUBLISH_ACCESS" ]]; then
@@ -134,12 +136,7 @@ PACKAGE_PAGE_URL=""
134136
if [[ "$PUBLISH_REGISTRY_URL" == "https://registry.npmjs.org" ]]; then
135137
PACKAGE_PAGE_URL="https://www.npmjs.com/package/${PACKAGE_NAME}"
136138
fi
137-
CLIENT_PACKAGE_NAME="$(node -p "Object.keys(JSON.parse(require('fs').readFileSync(process.argv[1], 'utf8')).peerDependencies ?? {}).find((name) => name.endsWith('/client')) || ''" "$PUBLISH_PACKAGE_JSON")"
138-
if [[ -z "$CLIENT_PACKAGE_NAME" ]]; then
139-
echo "❌ Could not determine the required app-facing client package from peerDependencies."
140-
exit 1
141-
fi
142-
CLIENT_REGISTRY_URL="${PUBLISH_REGISTRY_URL}/${CLIENT_PACKAGE_NAME}"
139+
INTERNAL_PEER_DEPENDENCIES="$(node -p "const pkg=JSON.parse(require('fs').readFileSync(process.argv[1], 'utf8')); const packageName=process.argv[2]; const scope = packageName.startsWith('@') ? packageName.split('/')[0] : ''; console.log(Object.keys(pkg.peerDependencies ?? {}).filter((name) => scope && name.startsWith(scope + '/') && name !== packageName).join('\n'))" "$PUBLISH_PACKAGE_JSON" "$PACKAGE_NAME")"
143140

144141
echo ""
145142
echo "══════════════════════════════════════════════════════"
@@ -153,6 +150,37 @@ echo ""
153150

154151
cd "$PUBLISH_DIR"
155152

153+
ensure_registry_auth_configured() {
154+
if [[ -n "${NODE_AUTH_TOKEN:-}" ]]; then
155+
LOCAL_NPMRC="$PUBLISH_DIR/.npmrc"
156+
npm config set "//${PUBLISH_REGISTRY_HOST}/:_authToken" "${NODE_AUTH_TOKEN}" --location=project
157+
fi
158+
}
159+
160+
wait_for_dependency_version() {
161+
local dependency_name="$1"
162+
local dependency_registry_url="${PUBLISH_REGISTRY_URL}/${dependency_name}"
163+
local attempt
164+
165+
for ((attempt=1; attempt<=PUBLISH_DEPENDENCY_WAIT_ATTEMPTS; attempt++)); do
166+
if npm view "$dependency_name@$VERSION" version --silent $REGISTRY_FLAG >/dev/null 2>&1; then
167+
echo "✅ Internal dependency ${dependency_name}@$VERSION is available on $PUBLISH_REGISTRY_NAME."
168+
return 0
169+
fi
170+
171+
if [[ "$attempt" -lt "$PUBLISH_DEPENDENCY_WAIT_ATTEMPTS" ]]; then
172+
echo "⏳ Waiting for ${dependency_name}@$VERSION to appear on $PUBLISH_REGISTRY_NAME (${attempt}/${PUBLISH_DEPENDENCY_WAIT_ATTEMPTS})..."
173+
sleep "$PUBLISH_DEPENDENCY_WAIT_SECONDS"
174+
fi
175+
done
176+
177+
echo "${dependency_name}@$VERSION is not published yet on $PUBLISH_REGISTRY_NAME. Publish it first."
178+
echo " registry API: $dependency_registry_url"
179+
exit 1
180+
}
181+
182+
ensure_registry_auth_configured
183+
156184
NPM_TAG_FLAG="--tag latest"
157185
PRERELEASE_TAG=""
158186
if [[ "$VERSION" == *"-"* ]]; then
@@ -162,10 +190,11 @@ if [[ "$VERSION" == *"-"* ]]; then
162190
echo "🏷️ Pre-release version detected — publishing to latest and adding dist-tag: $PRERELEASE_TAG"
163191
fi
164192

165-
if ! npm view "$CLIENT_PACKAGE_NAME@$VERSION" version --silent $REGISTRY_FLAG >/dev/null 2>&1; then
166-
echo "${CLIENT_PACKAGE_NAME}@$VERSION is not published yet on $PUBLISH_REGISTRY_NAME. Publish the main package first."
167-
echo " registry API: $CLIENT_REGISTRY_URL"
168-
exit 1
193+
if [[ -n "$INTERNAL_PEER_DEPENDENCIES" ]]; then
194+
while IFS= read -r dependency_name; do
195+
[[ -z "$dependency_name" ]] && continue
196+
wait_for_dependency_version "$dependency_name"
197+
done <<< "$INTERNAL_PEER_DEPENDENCIES"
169198
fi
170199

171200
if [[ "$DRY_RUN" == "true" ]]; then
@@ -188,8 +217,7 @@ if [[ -z "${NODE_AUTH_TOKEN:-}" ]]; then
188217
exit 1
189218
fi
190219

191-
LOCAL_NPMRC="$PUBLISH_DIR/.npmrc"
192-
npm config set "//${PUBLISH_REGISTRY_HOST}/:_authToken" "${NODE_AUTH_TOKEN}" --location=project
220+
ensure_registry_auth_configured
193221

194222
echo ""
195223
echo "🚀 Publishing $PACKAGE_NAME@$VERSION to $PUBLISH_REGISTRY_NAME..."

0 commit comments

Comments
 (0)