Skip to content

Commit 30aff95

Browse files
authored
Build JS-SDK before trying to use it in CI (#196)
Followup to #194: now that we use the built JS rather than the TS source, we need to actually build the js-sdk.
1 parent 3906cd2 commit 30aff95

2 files changed

Lines changed: 37 additions & 8 deletions

File tree

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/bin/sh
2+
#
3+
# Helper for the single_sdk_tests workflow: builds and installs the js-sdk from a given source.
4+
# The aim is to provide the right location of the JS SDK to rebuild_js_sdk.sh.
5+
#
6+
# Usage: `install-js-sdk.sh <source>` where `<source>` is one of:
7+
#
8+
# * `.` to use the current directory, or
9+
# * The name of a branch within ``matrix-js-sdk@https://github.com/matrix-org/matrix-js-sdk`
10+
11+
set -ex
12+
13+
js_sdk_src="$1"
14+
15+
if [ -z "$js_sdk_src" ]; then
16+
echo "Usage: $0 <jssdk source>" >&2
17+
exit 1
18+
fi
19+
20+
complement_crypto_dir="$(dirname $0)/../../"
21+
22+
echo "Installing matrix-js-sdk @ $js_sdk_src"
23+
24+
if [ "$js_sdk_src" = "." ]; then
25+
# If we install from a local directory, we have to build the js-sdk ourselves.
26+
echo "Building js-sdk @ $(pwd)"
27+
yarn install
28+
29+
yarn_path="file:$(pwd)"
30+
else
31+
# No need to build the js-sdk when installing from git: yarn will do it for us.
32+
yarn_path="https://github.com/matrix-org/matrix-js-sdk#$js_sdk_src"
33+
fi
34+
35+
cd "$complement_crypto_dir"
36+
./rebuild_js_sdk.sh "matrix-js-sdk@$yarn_path"

.github/workflows/single_sdk_tests.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ jobs:
113113
go install -v github.com/gotesttools/gotestfmt/v2/cmd/gotestfmt@latest
114114
115115
# JS SDK only steps
116-
# The aim is to provide the right location of the JS SDK to rebuild_js_sdk.sh
117116
- name: Setup | Node.js LTS
118117
if: ${{ inputs.use_js_sdk != '' }}
119118
uses: actions/setup-node@v3
@@ -122,13 +121,7 @@ jobs:
122121
- name: "Install JS SDK"
123122
if: ${{ inputs.use_js_sdk != '' }}
124123
shell: bash
125-
run: |
126-
echo "Installing matrix-js-sdk @ $JS_SDK"
127-
YARN_PATH="https://github.com/matrix-org/matrix-js-sdk#$JS_SDK"
128-
if [ "$JS_SDK" = "." ]; then
129-
YARN_PATH="file:${{ github.workspace }}"
130-
fi
131-
(cd complement-crypto && ./rebuild_js_sdk.sh "matrix-js-sdk@$YARN_PATH")
124+
run: ./complement-crypto/.github/workflows/install-js-sdk.sh "$JS_SDK"
132125

133126
# Rust SDK only steps.
134127
# The aim is to guarantee that rust-sdk is either at '.' or './complement-crypto/rust-sdk'

0 commit comments

Comments
 (0)