diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 24cb276..4bf74ad 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -20,12 +20,15 @@ env: PUSH_ENABLED: ${{ secrets.DOCKERHUB_TOKEN && github.ref_type == 'tag' && startsWith(github.ref_name, 'v') != true && 'true' || 'false' }} IMAGE: ${{ format('{0}/{1}:{2}', secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io', github.repository, github.ref_type == 'tag' && github.ref_name || github.event.ref || 'latest') }} CORE_GIT_REF: https://github.com/stellar/stellar-core.git#master - CORE_COMPILE_CONFIGURE_FLAGS: "--disable-tests" SOROBAN_RPC_GIT_REF: https://github.com/stellar/soroban-tools.git#main RUST_TOOLCHAIN_VERSION: stable SOROBAN_CLI_GIT_REF: https://github.com/stellar/soroban-tools.git#main QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.git#master - JS_SOROBAN_CLIENT_NPM_VERSION: https://github.com/stellar/js-stellar-sdk.git#master + # leaving sdk npm version blank defaults to whatever npm has for latest version + # rather than build from git source, which is fine for ci test build + JS_STELLAR_SDK_NPM_VERSION: + RS_XDR_GIT_REPO: https://github.com/stellar/rs-stellar-xdr + RS_XDR_GIT_REF: main jobs: complete: if: always() @@ -51,7 +54,9 @@ jobs: RUST_TOOLCHAIN_VERSION=${{ env.RUST_TOOLCHAIN_VERSION }} \ SOROBAN_CLI_GIT_REF=${{ env.SOROBAN_CLI_GIT_REF }} \ SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ - JS_SOROBAN_CLIENT_NPM_VERSION=${{ env.JS_SOROBAN_CLIENT_NPM_VERSION }} \ + JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ + RS_XDR_GIT_REPO=${{ env.RS_XDR_GIT_REPO }} \ + RS_XDR_GIT_REF=${{ env.RS_XDR_GIT_REF }} \ QUICKSTART_GIT_REF=${{ env.QUICKSTART_GIT_REF }} build; - if: ${{ env.PUSH_ENABLED == 'true' }} name: Save Docker Image to file diff --git a/Dockerfile b/Dockerfile index a455ee2..1d6ec4d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -69,7 +69,7 @@ ARG JS_STELLAR_SDK_NPM_VERSION ADD package.json /home/tester/ ADD js-stellar-sdk /home/tester/js-stellar-sdk RUN sudo chown -R tester:tester /home/tester -RUN yarn install --network-concurrency 1 +RUN yarn cache clean && yarn install --network-concurrency 1 RUN if echo "$JS_STELLAR_SDK_NPM_VERSION" | grep -q '.*file:.*'; then \ cd /home/tester/js-stellar-sdk; \ yarn cache clean; \ diff --git a/Makefile b/Makefile index 5ecd53a..659b189 100644 --- a/Makefile +++ b/Makefile @@ -8,6 +8,7 @@ SYSTEM_TEST_SHA=$(shell git rev-parse HEAD) QUICKSTART_STAGE_IMAGE=stellar/system-test-base:dev CORE_STAGE_IMAGE=stellar/system-test-core:dev HORIZON_STAGE_IMAGE=stellar/system-test-horizon:dev +RS_XDR_STAGE_IMAGE=stellar/system-test-rs-xdr:dev FRIENDBOT_STAGE_IMAGE=stellar/system-test-friendbot:dev SOROBAN_RPC_STAGE_IMAGE=stellar/system-test-soroban-rpc:dev SOROBAN_CLI_STAGE_IMAGE=stellar/system-test-soroban-cli:dev @@ -20,8 +21,11 @@ CORE_GIT_REF=https://github.com/stellar/stellar-core.git\#master SOROBAN_RPC_GIT_REF=https://github.com/stellar/soroban-tools.git\#main SOROBAN_CLI_GIT_REF=https://github.com/stellar/soroban-tools.git\#main GO_GIT_REF=https://github.com/stellar/go.git\#master +RS_XDR_GIT_REPO=https://github.com/stellar/rs-stellar-xdr +RS_XDR_GIT_REF=main QUICKSTART_GIT_REF=https://github.com/stellar/quickstart.git\#master -# specify the published npm repo version of soroban-client js library, or you can specify gh git ref url as the version also +# specify the published npm repo version of soroban-client js library, +# or you can specify gh git ref url as the version JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git\#master # variables to set if wanting to use existing dockerhub images instead of compiling @@ -40,6 +44,9 @@ HORIZON_IMAGE= # image must have friendbot bin at /app/friendbot FRIENDBOT_IMAGE= # +# image must have the bin at /usr/local/cargo/bin/stellar-xdr +RS_XDR_IMAGE= +# # image must have core bin at /usr/local/bin/stellar-core CORE_IMAGE= # @@ -49,7 +56,7 @@ CORE_IMAGE= # work those images whether the build host is arm64 or amd64. QUICKSTART_IMAGE= -NODE_VERSION?=16.20.2 +NODE_VERSION?=18.19.0 # if crate version is set, then it overrides SOROBAN_CLI_GIT_REF, cli will be installed from this create instead SOROBAN_CLI_CRATE_VERSION= @@ -75,6 +82,20 @@ build-friendbot: -f services/friendbot/docker/Dockerfile "$$SOURCE_URL"; \ fi +build-rs-xdr: + if [ -z "$(QUICKSTART_IMAGE)" ] && [ -z "$(RS_XDR_IMAGE)" ]; then \ + SOURCE_URL="$(QUICKSTART_GIT_REF)"; \ + if [[ ! "$(QUICKSTART_GIT_REF)" =~ \.git ]]; then \ + pushd "$(QUICKSTART_GIT_REF)"; \ + SOURCE_URL=.; \ + fi; \ + docker build -t "$(RS_XDR_STAGE_IMAGE)" --target builder \ + --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ + --build-arg REPO=$$RS_XDR_GIT_REPO \ + --build-arg REF=$$RS_XDR_GIT_REF \ + -f Dockerfile.xdr "$$SOURCE_URL"; \ + fi + build-soroban-rpc: if [ -z "$(QUICKSTART_IMAGE)" ] && [ -z "$(SOROBAN_RPC_IMAGE)" ]; then \ SOURCE_URL="$(SOROBAN_RPC_GIT_REF)"; \ @@ -122,12 +143,13 @@ build-core: -f docker/Dockerfile.testing "$$SOURCE_URL"; \ fi -build-quickstart: build-core build-friendbot build-horizon build-soroban-rpc +build-quickstart: build-core build-friendbot build-horizon build-rs-xdr build-soroban-rpc if [ -z "$(QUICKSTART_IMAGE)" ]; then \ CORE_IMAGE_REF=$$( [ -z "$(CORE_IMAGE)" ] && echo "$(CORE_STAGE_IMAGE)" || echo "$(CORE_IMAGE)"); \ HORIZON_IMAGE_REF=$$( [ -z "$(HORIZON_IMAGE)" ] && echo "$(HORIZON_STAGE_IMAGE)" || echo "$(HORIZON_IMAGE)"); \ FRIENDBOT_IMAGE_REF=$$( [ -z "$(FRIENDBOT_IMAGE)" ] && echo "$(FRIENDBOT_STAGE_IMAGE)" || echo "$(FRIENDBOT_IMAGE)"); \ SOROBAN_RPC_IMAGE_REF=$$( [ -z "$(SOROBAN_RPC_IMAGE)" ] && echo "$(SOROBAN_RPC_STAGE_IMAGE)" || echo "$(SOROBAN_RPC_IMAGE)"); \ + RS_XDR_IMAGE_REF=$$( [ -z "$(RS_XDR_IMAGE)" ] && echo "$(RS_XDR_STAGE_IMAGE)" || echo "$(RS_XDR_IMAGE)"); \ SOURCE_URL="$(QUICKSTART_GIT_REF)"; \ if [[ ! "$(QUICKSTART_GIT_REF)" =~ \.git ]]; then \ pushd "$(QUICKSTART_GIT_REF)"; \ @@ -136,6 +158,7 @@ build-quickstart: build-core build-friendbot build-horizon build-soroban-rpc docker build -t "$(QUICKSTART_STAGE_IMAGE)" \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CORE_IMAGE_REF=$$CORE_IMAGE_REF \ + --build-arg STELLAR_XDR_IMAGE_REF=$$RS_XDR_IMAGE_REF \ --build-arg CORE_SUPPORTS_ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=true \ --build-arg CORE_SUPPORTS_TESTING_SOROBAN_HIGH_LIMIT_OVERRIDE=true \ --build-arg HORIZON_IMAGE_REF=$$HORIZON_IMAGE_REF \ diff --git a/js-stellar-sdk/README.md b/js-stellar-sdk/README.md index de2fdc2..5d2ae57 100644 --- a/js-stellar-sdk/README.md +++ b/js-stellar-sdk/README.md @@ -1,18 +1,20 @@ **This is a placeholder file only.** The `system-test/js-stellar-sdk` directory can be used if you want to build `system-test` with a local file path for the [stellar/js-stellar-sdk](https://github.com/stellar/js-stellar-sdk) project rather than pulling it from remote -npm or GitHub ref. Run, +npm or GitHub ref. + +This can also be used as alternative when trying to use a GitHub ref url but getting the dreaded `file appears to be corrupt: ENOENT: no such file or directory` during build. -```bash -js-stellar-sdk$ yarn build -``` -Then, copy the entire directory over the top of `system-test/js-stellar-sdk` (or soft link the directories, but be careful in the soft link case as you don't want to accidentally delete, etc.) +First, clone/check-out a version of js-stellar-sdk from GH locally, it should be clean, remove any node-modules/yarn.lock. -Once you have the `system-test/js-stellar-sdk` ready, then build `system-test` and trigger it to use with: + +Then, copy the entire `js-stellar-sdk` directory over the top of `system-test/js-stellar-sdk`, this directory will be copied to the `/home/tester/js-stellar-sdk` path in the docker image. + +Then build `system-test` and trigger it to compile js sdk using the local files with: ```bash make .... JS_STELLAR_SDK_NPM_VERSION=file:/home/tester/js-stellar-sdk build ``` -Then, `system-test/js-stellar-sdk` is copied to the `/home/tester/js-stellar-sdk` path in the docker image. +