Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update refs to soroban-cli to stellar-cli #106

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/Dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:
CORE_GIT_REF: https://github.com/stellar/stellar-core.git#master
SOROBAN_RPC_GIT_REF: https://github.com/stellar/soroban-rpc.git#main
RUST_TOOLCHAIN_VERSION: stable
SOROBAN_CLI_GIT_REF: https://github.com/stellar/soroban-tools.git#main
STELLAR_CLI_GIT_REF: https://github.com/stellar/stellar-cli.git#main
QUICKSTART_GIT_REF: https://github.com/stellar/quickstart.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
Expand Down Expand Up @@ -52,7 +52,7 @@ jobs:
CORE_COMPILE_CONFIGURE_FLAGS="${{ env.CORE_COMPILE_CONFIGURE_FLAGS }}" \
SOROBAN_RPC_GIT_REF=${{ env.SOROBAN_RPC_GIT_REF }} \
RUST_TOOLCHAIN_VERSION=${{ env.RUST_TOOLCHAIN_VERSION }} \
SOROBAN_CLI_GIT_REF=${{ env.SOROBAN_CLI_GIT_REF }} \
STELLAR_CLI_GIT_REF=${{ env.STELLAR_CLI_GIT_REF }} \
SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \
JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \
RS_XDR_GIT_REPO=${{ env.RS_XDR_GIT_REPO }} \
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ This version of tests is based on [Soroban Preview 7](https://soroban.stellar.or

#### 1.0.4

* Fixed git ref resolution to detached head state when compiling soroban cli during image build [system-test, #23](https://github.com/stellar/system-test/pull/23), to build [Stellar Quickstart](https://github.com/stellar/quickstart).
* Fixed git ref resolution to detached head state when compiling stellar cli during image build [system-test, #23](https://github.com/stellar/system-test/pull/23), to build [Stellar Quickstart](https://github.com/stellar/quickstart).

This version of tests is based on [Soroban Preview 7](https://soroban.stellar.org/docs/releases) system interfaces.

Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG QUICKSTART_IMAGE_REF=stellar/quickstart:soroban-dev
ARG SOROBAN_CLI_IMAGE_REF=stellar/system-test-soroban-cli:dev
ARG STELLAR_CLI_IMAGE_REF=stellar/system-test-stellar-cli:dev

FROM golang:1.21 as go

Expand All @@ -20,7 +20,7 @@ ADD features/dapp_develop/dapp_develop.feature ./bin
# copy over a dapp develop test specific file, used for expect/tty usage
ADD features/dapp_develop/soroban_config.exp ./bin

FROM $SOROBAN_CLI_IMAGE_REF as soroban-cli
FROM $STELLAR_CLI_IMAGE_REF as stellar-cli

FROM $QUICKSTART_IMAGE_REF as base
ARG RUST_TOOLCHAIN_VERSION
Expand Down Expand Up @@ -89,7 +89,7 @@ FROM base as build
USER root

ADD start /home/tester
COPY --from=soroban-cli /usr/local/cargo/bin/soroban $CARGO_HOME/bin/
COPY --from=stellar-cli /usr/local/cargo/bin/stellar $CARGO_HOME/bin/
COPY --from=go /test/bin/ /home/tester/bin

ENTRYPOINT ["/home/tester/start"]
16 changes: 0 additions & 16 deletions Dockerfile.soroban-cli

This file was deleted.

16 changes: 16 additions & 0 deletions Dockerfile.stellar-cli
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
ARG DOCKERHUB_RUST_VERSION
ARG STELLAR_CLI_CRATE_VERSION

FROM $DOCKERHUB_RUST_VERSION AS builder

WORKDIR /stellar-cli
COPY . .

run if [ ! -z "$STELLAR_CLI_CRATE_VERSION" ]; then \
cargo install \
--config net.git-fetch-with-cli=true \
--config build.jobs=6 -f --locked stellar-cli \
--version "$STELLAR_CLI_CRATE_VERSION"; \
else \
make install_rust; \
fi
30 changes: 15 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ 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
STELLAR_CLI_STAGE_IMAGE=stellar/system-test-stellar-cli:dev

# The rest of these variables can be set as environment variables to the makefile
# to modify how system test is built.
Expand All @@ -24,7 +24,7 @@ PROTOCOL_VERSION_DEFAULT=
# variables to set for source code, can be any valid docker context url local path github remote repo `https://github.com/repo#<ref>`
CORE_GIT_REF=https://github.com/stellar/stellar-core.git\#master
SOROBAN_RPC_GIT_REF=https://github.com/stellar/soroban-rpc.git\#main
SOROBAN_CLI_GIT_REF=https://github.com/stellar/soroban-tools.git\#main
STELLAR_CLI_GIT_REF=https://github.com/stellar/stellar-cli.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
Expand All @@ -37,8 +37,8 @@ JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git\#master
# image during build. if using this option, the image ref should provide a version for same
# platform arch as the build host is on, i.e. linux/amd64 or linux/arm64.
#
# image must have soroban cli bin at /usr/local/cargo/bin/soroban
SOROBAN_CLI_IMAGE=
# image must have stellar cli bin at /usr/local/cargo/bin/soroban
STELLAR_CLI_IMAGE=
#
# image must have soroban rpc bin at /bin/soroban-rpc
SOROBAN_RPC_IMAGE=
Expand All @@ -65,8 +65,8 @@ QUICKSTART_IMAGE=

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=
# if crate version is set, then it overrides STELLAR_CLI_GIT_REF, cli will be installed from this create instead
STELLAR_CLI_CRATE_VERSION=

# sets the rustc version in the system test image
RUST_TOOLCHAIN_VERSION=stable
Expand Down Expand Up @@ -115,14 +115,14 @@ build-soroban-rpc:
-f cmd/soroban-rpc/docker/Dockerfile "$$SOURCE_URL"; \
fi

build-soroban-cli:
if [ -z "$(SOROBAN_CLI_IMAGE)" ]; then \
build-stellar-cli:
if [ -z "$(STELLAR_CLI_IMAGE)" ]; then \
DOCKERHUB_RUST_VERSION=rust:$$( [ "$(RUST_TOOLCHAIN_VERSION)" = "stable" ] && echo "latest" || echo "$(RUST_TOOLCHAIN_VERSION)"); \
docker buildx build -t "$(SOROBAN_CLI_STAGE_IMAGE)" --target builder \
docker buildx build -t "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \
--build-arg DOCKERHUB_RUST_VERSION="$$DOCKERHUB_RUST_VERSION" \
--build-arg SOROBAN_CLI_CRATE_VERSION="$(SOROBAN_CLI_CRATE_VERSION)" \
-f- $(SOROBAN_CLI_GIT_REF) < $(MAKEFILE_DIR)Dockerfile.soroban-cli; \
--build-arg STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \
-f- $(STELLAR_CLI_GIT_REF) < $(MAKEFILE_DIR)Dockerfile.stellar-cli; \
fi

build-horizon:
Expand Down Expand Up @@ -181,14 +181,14 @@ build-quickstart: build-core build-friendbot build-horizon build-rs-xdr build-so
-f Dockerfile "$$SOURCE_URL"; \
fi

build: build-quickstart build-soroban-cli
build: build-quickstart build-stellar-cli
QUICKSTART_IMAGE_REF=$$( [ -z "$(QUICKSTART_IMAGE)" ] && echo "$(QUICKSTART_STAGE_IMAGE)" || echo "$(QUICKSTART_IMAGE)"); \
SOROBAN_CLI_IMAGE_REF=$$( [ -z "$(SOROBAN_CLI_IMAGE)" ] && echo "$(SOROBAN_CLI_STAGE_IMAGE)" || echo "$(SOROBAN_CLI_IMAGE)"); \
STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \
docker build -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \
--build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \
--build-arg QUICKSTART_IMAGE_REF=$$QUICKSTART_IMAGE_REF \
--build-arg SOROBAN_CLI_CRATE_VERSION=$(SOROBAN_CLI_CRATE_VERSION) \
--build-arg SOROBAN_CLI_IMAGE_REF=$$SOROBAN_CLI_IMAGE_REF \
--build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \
--build-arg STELLAR_CLI_IMAGE_REF=$$STELLAR_CLI_IMAGE_REF \
--build-arg RUST_TOOLCHAIN_VERSION=$(RUST_TOOLCHAIN_VERSION) \
--build-arg NODE_VERSION=$(NODE_VERSION) \
--build-arg JS_STELLAR_SDK_NPM_VERSION=$(JS_STELLAR_SDK_NPM_VERSION) \
Expand Down
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### Running system tests:
Identify the system-test image you want to use for running tests:
- Use a prebuilt system test image published as tags under `dockerhub.io/stellar/system-test`
- Build the system test docker image locally with specific versions of core, horizon, soroban rpc, rust toolchain, soroban cli, this will create a docker image named
- Build the system test docker image locally with specific versions of core, horizon, soroban rpc, rust toolchain, stellar cli, this will create a docker image named
`stellar/system-test:dev`.
All `GIT_REF` variables can refer to either a fully qualified local path to checked out git repo, or a fully qualified github remote repo url `https://github.com/repo#<ref>`
```
Expand All @@ -12,10 +12,10 @@
CORE_GIT_REF=? \
CORE_COMPILE_CONFIGURE_FLAGS=? \
SOROBAN_RPC_GIT_REF=? \
SOROBAN_CLI_GIT_REF=? \
STELLAR_CLI_GIT_REF=? \
GO_GIT_REF=? \
RUST_TOOLCHAIN_VERSION=? \
SOROBAN_CLI_CRATE_VERSION=? \
STELLAR_CLI_CRATE_VERSION=? \
JS_STELLAR_SDK_NPM_VERSION=? \
NODE_VERSION=? \
PROTOCOL_VERSION_DEFAULT=? \
Expand All @@ -26,9 +26,9 @@
```
make CORE_GIT_REF=https://github.com/stellar/stellar-core.git#f1dc39f0f146815e5e3a94ed162e2f0639cb433f \
CORE_COMPILE_CONFIGURE_FLAGS="--disable-tests --enable-next-protocol-version-unsafe-for-production" \
SOROBAN_RPC_GIT_REF=https://github.com/stellar/soroban-tools.git#main \
SOROBAN_RPC_GIT_REF=https://github.com/stellar/stellar-cli.git#main \
RUST_TOOLCHAIN_VERSION=stable \
SOROBAN_CLI_GIT_REF=https://github.com/stellar/soroban-tools.git#main \
STELLAR_CLI_GIT_REF=https://github.com/stellar/stellar-cli.git#main \
QUICKSTART_GIT_REF=https://github.com/stellar/quickstart.git#master \
JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git#master \
build
Expand All @@ -38,13 +38,13 @@
```
make QUICKSTART_IMAGE=stellar/quickstart:soroban-dev \
RUST_TOOLCHAIN_VERSION=1.66.0 \
SOROBAN_CLI_GIT_REF=/Users/user/soroban-tools build
STELLAR_CLI_GIT_REF=/Users/user/stellar-cli build
```

some settings have defaults pre-set, and optionally be overriden:
```
SOROBAN_CLI_GIT_REF=https://github.com/stellar/soroban-tools.git#main
SOROBAN_RPC_GIT_REF=https://github.com/stellar/soroban-tools.git#main
STELLAR_CLI_GIT_REF=https://github.com/stellar/stellar-cli.git#main
SOROBAN_RPC_GIT_REF=https://github.com/stellar/soroban-rpc.git#main
RUST_TOOLCHAIN_VERSION=stable
QUICKSTART_GIT_REF=https://github.com/stellar/quickstart.git#master
# the GO_GIT_REF provides the reference on the stellar/go repo from which
Expand All @@ -57,8 +57,8 @@

optional params to set:
```
# this will override SOROBAN_CLI_GIT_REF, and install soroban cli from crates repo instead
SOROBAN_CLI_CRATE_VERSION=0.4.0
# this will override STELLAR_CLI_GIT_REF, and install stellar cli from crates repo instead
STELLAR_CLI_CRATE_VERSION=0.4.0

# this will override the default Node JS vm version used for running the JS code:
NODE_VERSION=16.20.2
Expand Down Expand Up @@ -89,9 +89,9 @@
# will use the bin already compiled at /bin/soroban-rpc in the existing docker image provided:
SOROBAN_RPC_IMAGE=<docker registry>/<docker image name>:<docker tag>

# this will skip building soroban-cli from SOROBAN_CLI_GIT_REF and instead
# this will skip building stellar-cli from STELLAR_CLI_GIT_REF and instead
# will use the bin already compiled at /usr/local/cargo/bin/soroban in the existing docker image provided:
SOROBAN_CLI_IMAGE=<docker registry>/<docker image name>:<docker tag>
STELLAR_CLI_IMAGE=<docker registry>/<docker image name>:<docker tag>

# this will skip building horizon from GO_GIT_REF and instead
# will use the bin already compiled at /go/bin/horizon in the existing docker image provided:
Expand Down Expand Up @@ -164,7 +164,7 @@ This approach allows to run the tests from source code directly on host as go te

1. go 1.18 or above - https://go.dev/doc/install
2. rust toolchain(cargo and rustc), install the version per testing requirements or stable, - use rustup - https://www.rust-lang.org/tools/install
3. `soroban` cli, compile or install via cargo crate a version of soroban cli onto your machine and accessible from PATH.
3. `soroban` cli, compile or install via cargo crate a version of stellar cli onto your machine and accessible from PATH.
4. target network stack for the tests to access soroban-rpc instance. You can use an existing/running instance if reachable or can use the quickstart image `stellar/quickstart:soroban-dev` from dockerhub to run the latest stable target network stack locally, or build quickstart with specific versions of core, horizon and soroban rpc first [following these instructions](https://github.com/stellar/quickstart#building-custom-images) and run `stellar/quickstart:dev` locally.
```
docker run --rm -it -p 8000:8000 --name stellar stellar/quickstart:dev --standalone --enable-soroban-rpc
Expand Down
12 changes: 6 additions & 6 deletions features/dapp_develop/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ func invokeContractFromCliTool(deployedContractId, contractName, functionName, f
stdOut := strings.TrimSpace(strings.Join(stdOutLines, "\n"))

if status != 0 || err != nil {
return "", fmt.Errorf("soroban cli invoke of example contract %s had error %v, %v, stdout: %v", contractName, status, err, stdOut)
return "", fmt.Errorf("stellar cli invoke of example contract %s had error %v, %v, stdout: %v", contractName, status, err, stdOut)
}

if stdOut == "" {
return "", fmt.Errorf("soroban cli invoke of example contract %s did not emit successful response", contractName)
return "", fmt.Errorf("stellar cli invoke of example contract %s did not emit successful response", contractName)
}

return stdOut, nil
Expand Down Expand Up @@ -67,11 +67,11 @@ func invokeContractFromCliToolWithConfig(deployedContractId, contractName, funct
stdOut := strings.TrimSpace(strings.Join(stdOutLines, "\n"))

if status != 0 || err != nil {
return "", fmt.Errorf("soroban cli invoke of example contract with config states, %s had error %v, %v, stdout: %v", contractName, status, err, stdOut)
return "", fmt.Errorf("stellar cli invoke of example contract with config states, %s had error %v, %v, stdout: %v", contractName, status, err, stdOut)
}

if stdOut == "" {
return "", fmt.Errorf("soroban cli invoke of example contract with config states, %s did not emit successful response", contractName)
return "", fmt.Errorf("stellar cli invoke of example contract with config states, %s did not emit successful response", contractName)
}

return stdOut, nil
Expand All @@ -95,7 +95,7 @@ func getEventsFromCliTool(ledgerFrom uint32, deployedContractId string, size uin
var jsonEvents []map[string]interface{}

if status != 0 || err != nil {
return jsonEvents, fmt.Errorf("soroban cli get events had error %v, %v", status, err)
return jsonEvents, fmt.Errorf("stellar cli get events had error %v, %v", status, err)
}

// put commas between any json event objects if more than one found
Expand All @@ -105,7 +105,7 @@ func getEventsFromCliTool(ledgerFrom uint32, deployedContractId string, size uin

err = json.Unmarshal([]byte(stdOutEventsValidJson), &jsonEvents)
if err != nil {
return jsonEvents, fmt.Errorf("soroban cli get events console output %v was not parseable as event json, %e", strings.Join(stdOutLines, "\n"), err)
return jsonEvents, fmt.Errorf("stellar cli get events console output %v was not parseable as event json, %e", strings.Join(stdOutLines, "\n"), err)
}

return jsonEvents, nil
Expand Down
16 changes: 8 additions & 8 deletions features/dapp_develop/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ func deployContract(compiledContractFileName string, contractWorkingDirectory st
status, stdOut, err := e2e.RunCommand(envCmd, e2eConfig)

if status != 0 || err != nil {
return "", fmt.Errorf("soroban cli deployment of example contract %s had error %v, %v", compiledContractFileName, status, err)
return "", fmt.Errorf("stellar cli deployment of example contract %s had error %v, %v", compiledContractFileName, status, err)
}

if len(stdOut) < 1 {
return "", fmt.Errorf("soroban cli deployment of example contract %s returned no contract id", compiledContractFileName)
return "", fmt.Errorf("stellar cli deployment of example contract %s returned no contract id", compiledContractFileName)
}

return stdOut[0], nil
Expand All @@ -87,11 +87,11 @@ func deployContractUsingConfigParams(compiledContractFileName string, contractWo
status, stdOut, err := e2e.RunCommand(envCmd, e2eConfig)

if status != 0 || err != nil {
return "", fmt.Errorf("soroban cli deployment of example contract %s had error %v, %v", compiledContractFileName, status, err)
return "", fmt.Errorf("stellar cli deployment of example contract %s had error %v, %v", compiledContractFileName, status, err)
}

if len(stdOut) < 1 {
return "", fmt.Errorf("soroban cli deployment of example contract %s returned no contract id", compiledContractFileName)
return "", fmt.Errorf("stellar cli deployment of example contract %s returned no contract id", compiledContractFileName)
}

return stdOut[0], nil
Expand All @@ -111,11 +111,11 @@ func installContract(compiledContractFileName string, contractWorkingDirectory s
status, stdOut, err := e2e.RunCommand(envCmd, e2eConfig)

if status != 0 || err != nil {
return "", fmt.Errorf("soroban cli install of example contract %s had error %v, %v", compiledContractFileName, status, err)
return "", fmt.Errorf("stellar cli install of example contract %s had error %v, %v", compiledContractFileName, status, err)
}

if len(stdOut) < 1 {
return "", fmt.Errorf("soroban cli install of example contract %s returned no contract id", compiledContractFileName)
return "", fmt.Errorf("stellar cli install of example contract %s returned no contract id", compiledContractFileName)
}

return stdOut[0], nil
Expand All @@ -132,7 +132,7 @@ func createNetworkConfig(configName string, rpcUrl string, networkPassphrase str
status, _, err := e2e.RunCommand(envCmd, e2eConfig)

if status != 0 || err != nil {
return fmt.Errorf("soroban cli create network config %s had error %v, %v", configName, status, err)
return fmt.Errorf("stellar cli create network config %s had error %v, %v", configName, status, err)
}

return nil
Expand All @@ -148,7 +148,7 @@ func createIdentityConfig(identityName string, secretKey string, e2eConfig *e2e.
status, _, err := e2e.RunCommand(envCmd, e2eConfig)

if status != 0 || err != nil {
return fmt.Errorf("soroban cli create identity config %s had error %v, %v", identityName, status, err)
return fmt.Errorf("stellar cli create identity config %s had error %v, %v", identityName, status, err)
}

return nil
Expand Down
2 changes: 1 addition & 1 deletion start
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function main() {
fi

print_screen_output " RUST_TOOLCHAIN_VERSION=$(rustc --version 2>/dev/null || echo"n/a" )"
print_screen_output " SOROBAN_CLI_CRATE_VERSION=$(soroban version 2>/dev/null || echo "n/a" )"
print_screen_output " STELLAR_CLI_CRATE_VERSION=$(soroban version 2>/dev/null || echo "n/a" )"
print_screen_output " SOROBAN_EXAMPLES_GIT_HASH=$SOROBAN_EXAMPLES_GIT_HASH"
print_screen_output " SOROBAN_EXAMPLES_REPO_URL=$SOROBAN_EXAMPLES_REPO_URL"
print_screen_output " TARGET_NETWORK=$TARGET_NETWORK"
Expand Down
Loading