From 3c14b11097c999106427f48090bd4f734f5554e4 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Sun, 12 Oct 2025 21:11:16 -0700 Subject: [PATCH 01/60] #92: removed quickstart as base image and TARGET_NETWORK, as now only uses an external rpc server url via TARGET_NETWORK_RPC_URL --- .github/workflows/Dockerfile.yml | 16 +-- Dockerfile | 10 +- Dockerfile.core | 8 -- Makefile | 170 ++----------------------------- README.md | 165 ++++++++---------------------- start | 70 +------------ 6 files changed, 60 insertions(+), 379 deletions(-) delete mode 100644 Dockerfile.core diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 62022d8..0b0b573 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -19,16 +19,10 @@ env: # the only time system test image needs to be defined for a push is when it's a non 'v' tag creation 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 - STELLAR_RPC_GIT_REF: https://github.com/stellar/stellar-rpc.git#protocol-23 - 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#main # 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() @@ -48,16 +42,10 @@ jobs: ref: ${{ env.HEAD_SHA }} - name: Build System Test Image run: | - make CORE_GIT_REF=${{ env.CORE_GIT_REF }} \ - CORE_COMPILE_CONFIGURE_FLAGS="${{ env.CORE_COMPILE_CONFIGURE_FLAGS }}" \ - STELLAR_RPC_GIT_REF=${{ env.STELLAR_RPC_GIT_REF }} \ - RUST_TOOLCHAIN_VERSION=${{ env.RUST_TOOLCHAIN_VERSION }} \ - SOROBAN_CLI_GIT_REF=${{ env.SOROBAN_CLI_GIT_REF }} \ + make SOROBAN_CLI_GIT_REF=${{ env.SOROBAN_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 }} \ - RS_XDR_GIT_REF=${{ env.RS_XDR_GIT_REF }} \ - QUICKSTART_GIT_REF=${{ env.QUICKSTART_GIT_REF }} build; + build; - if: ${{ env.PUSH_ENABLED == 'true' }} name: Save Docker Image to file run: | diff --git a/Dockerfile b/Dockerfile index 9b33967..988bce7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -ARG QUICKSTART_IMAGE_REF=stellar/quickstart:soroban-dev +ARG BASE_IMAGE_REF=ubuntu:24.04 ARG STELLAR_CLI_IMAGE_REF=stellar/system-test-soroban-cli:dev FROM golang:1.24 AS go @@ -22,13 +22,13 @@ ADD features/dapp_develop/dapp_develop.feature ./bin ADD features/dapp_develop/soroban_config.exp ./bin FROM $STELLAR_CLI_IMAGE_REF AS stellar-cli -FROM $QUICKSTART_IMAGE_REF AS base +FROM $BASE_IMAGE_REF AS base ARG RUST_TOOLCHAIN_VERSION ARG NODE_VERSION ENV DEBIAN_FRONTEND=noninteractive -RUN apt-get update && apt-get install -y build-essential expect git libdbus-1-dev libudev-dev && apt-get clean +RUN apt-get update && apt-get install -y build-essential expect curl jq git libdbus-1-dev libudev-dev && apt-get clean # Install Rust RUN ["mkdir", "-p", "/rust"] @@ -38,14 +38,12 @@ ENV RUST_TOOLCHAIN_VERSION=$RUST_TOOLCHAIN_VERSION ENV PATH="/usr/local/go/bin:$CARGO_HOME/bin:${PATH}" RUN curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain "$RUST_TOOLCHAIN_VERSION" RUN rustup show active-toolchain || rustup toolchain install -# Older toolchain to compile soroban examples -RUN rustup toolchain install 1.81-x86_64-unknown-linux-gnu # Wasm toolchain to compile contracts RUN rustup target add wasm32v1-none # Use a non-root user ARG USERNAME=tester -ARG USER_UID=1000 +ARG USER_UID=1018 ARG USER_GID=$USER_UID RUN groupadd --gid $USER_GID $USERNAME \ && useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \ diff --git a/Dockerfile.core b/Dockerfile.core deleted file mode 100644 index 41cca6d..0000000 --- a/Dockerfile.core +++ /dev/null @@ -1,8 +0,0 @@ -ARG CORE_IMAGE= - -FROM $CORE_IMAGE AS stellar-core - -FROM ubuntu -ARG CORE_IMAGE_BIN_PATH= - -COPY --from=stellar-core ${CORE_IMAGE_BIN_PATH} /usr/local/bin/stellar-core diff --git a/Makefile b/Makefile index 91c22f2..44b7daa 100644 --- a/Makefile +++ b/Makefile @@ -2,39 +2,20 @@ SHELL:=/bin/bash MAKEFILE_DIR:=$(dir $(abspath $(lastword $(MAKEFILE_LIST)))) .EXPORT_ALL_VARIABLES: -.PHONY: build build-quickstart build-core build-friendbot build-horizon build-stellar-rpc +.PHONY: build 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 -STELLAR_RPC_STAGE_IMAGE=stellar/system-test-stellar-rpc:dev STELLAR_CLI_STAGE_IMAGE=stellar/system-test-stellar-cli:dev -LAB_STAGE_IMAGE=stellar/system-test-stellar-laboratory:dev # The rest of these variables can be set as environment variables to the makefile # to modify how system test is built. -# The default protocol version that the image should start with. Should -# typically be set to the maximum supported protocol version of all components. -# If not set will default to the core max supported protocol version in quickstart. -PROTOCOL_VERSION_DEFAULT=23 - # variables to set for source code, can be any valid docker context url local # path github remote repo `https://github.com/repo#` -CORE_GIT_REF=https://github.com/stellar/stellar-core.git\#master -STELLAR_RPC_GIT_REF=https://github.com/stellar/stellar-rpc.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 -QUICKSTART_GIT_REF=https://github.com/stellar/quickstart.git\#main -# 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 +# if crate version is set, then it overrides STELLAR_CLI_GIT_REF, cli will be installed from this create instead +STELLAR_CLI_CRATE_VERSION= # variables to set if wanting to use existing dockerhub images instead of compiling # image during build. if using this option, the image ref should provide a version for same @@ -42,82 +23,20 @@ JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git\#master # # image must have soroban cli bin at /usr/local/cargo/bin/soroban STELLAR_CLI_IMAGE= -# -# image must have soroban rpc bin at /bin/stellar-rpc -STELLAR_RPC_IMAGE= -# -# image must have horizon bin at /go/bin/horizon -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 with stellar-core binary, assumes core bin at /usr/local/bin/stellar-core -CORE_IMAGE= -# define a custom path that core bin is located on CORE_IMAGE, other than /usr/local/bin/stellar-core -CORE_IMAGE_BIN_PATH= -# -# a prebuilt 'soroban-dev' image from the quickstart repo, if this is supplied, -# the other core, rpc, horizon, friendbot config settings are mostly ignored, since the quickstart image -# has them compiled in already. the 'stellar/quickstart' images also support multi-arch, so the build will -# work those images whether the build host is arm64 or amd64. -QUICKSTART_IMAGE= +# defauult node version to install in system test image NODE_VERSION?=20.19.4 -# if crate version is set, then it overrides STELLAR_CLI_GIT_REF, cli will be installed from this create instead -STELLAR_CLI_CRATE_VERSION= +# 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 # sets the rustc version in the system test image RUST_TOOLCHAIN_VERSION=stable -# temporarily needed, builds core with soroban enabled features -CORE_COMPILE_CONFIGURE_FLAGS=--disable-tests - # the final image name that is created in local docker images store for system test SYSTEM_TEST_IMAGE=stellar/system-test:dev -build-friendbot: - if [ -z "$(QUICKSTART_IMAGE)" ] && [ -z "$(FRIENDBOT_IMAGE)" ]; then \ - SOURCE_URL="$(GO_GIT_REF)"; \ - if [[ ! "$(GO_GIT_REF)" =~ \.git ]]; then \ - pushd "$(GO_GIT_REF)"; \ - SOURCE_URL=.; \ - fi; \ - docker build -t "$(FRIENDBOT_STAGE_IMAGE)" \ - --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ - -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-stellar-rpc: - if [ -z "$(QUICKSTART_IMAGE)" ] && [ -z "$(STELLAR_RPC_IMAGE)" ]; then \ - SOURCE_URL="$(STELLAR_RPC_GIT_REF)"; \ - if [[ ! "$(STELLAR_RPC_GIT_REF)" =~ \.git ]]; then \ - pushd "$(STELLAR_RPC_GIT_REF)"; \ - SOURCE_URL=.; \ - fi; \ - docker build -t "$(STELLAR_RPC_STAGE_IMAGE)" --target build \ - --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ - -f cmd/stellar-rpc/docker/Dockerfile "$$SOURCE_URL"; \ - fi - build-stellar-cli: if [ -z "$(STELLAR_CLI_IMAGE)" ]; then \ DOCKERHUB_RUST_VERSION=rust:$$( [ "$(RUST_TOOLCHAIN_VERSION)" = "stable" ] && echo "latest" || echo "$(RUST_TOOLCHAIN_VERSION)"); \ @@ -128,83 +47,10 @@ build-stellar-cli: -f- $(STELLAR_CLI_GIT_REF) < $(MAKEFILE_DIR)Dockerfile.stellar-cli; \ fi -build-horizon: - if [ -z "$(QUICKSTART_IMAGE)" ] && [ -z "$(HORIZON_IMAGE)" ]; then \ - SOURCE_URL="$(GO_GIT_REF)"; \ - if [[ ! "$(GO_GIT_REF)" =~ \.git ]]; then \ - pushd "$(GO_GIT_REF)"; \ - SOURCE_URL=.; \ - fi; \ - docker build -t "$(HORIZON_STAGE_IMAGE)" \ - --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ - --target builder -f services/horizon/docker/Dockerfile.dev "$$SOURCE_URL"; \ - fi - -build-core: - if [ -z "$(QUICKSTART_IMAGE)" ] && [ -z "$(CORE_IMAGE)" ]; then \ - SOURCE_URL="$(CORE_GIT_REF)"; \ - if [[ ! "$(CORE_GIT_REF)" =~ \.git ]]; then \ - pushd "$(CORE_GIT_REF)"; \ - SOURCE_URL=.; \ - fi; \ - docker build -t "$(CORE_STAGE_IMAGE)" \ - --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ - --build-arg CONFIGURE_FLAGS="$(CORE_COMPILE_CONFIGURE_FLAGS)" \ - -f docker/Dockerfile.testing "$$SOURCE_URL"; \ - fi; \ - if [ ! -z "$(CORE_IMAGE)" ] && [ ! -z "$(CORE_IMAGE_BIN_PATH)" ]; then \ - docker build -t "$(CORE_STAGE_IMAGE)" \ - --build-arg CORE_IMAGE="$(CORE_IMAGE)" \ - --build-arg CORE_IMAGE_BIN_PATH="$(CORE_IMAGE_BIN_PATH)" \ - -f Dockerfile.core .; \ - fi - -build-lab: - # only build if we don't have a qs image - if [ -z "$(QUICKSTART_IMAGE)" ]; then \ - SOURCE_URL="$(QUICKSTART_GIT_REF)"; \ - if [[ ! "$(QUICKSTART_GIT_REF)" =~ \.git ]]; then \ - pushd "$(QUICKSTART_GIT_REF)"; \ - SOURCE_URL=.; \ - fi; \ - docker build -t "$(LAB_STAGE_IMAGE)" \ - --build-arg NEXT_PUBLIC_COMMIT_HASH=main \ - --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ - -f Dockerfile.lab "$$SOURCE_URL"; \ - fi - -build-quickstart: build-lab build-core build-friendbot build-horizon build-rs-xdr build-stellar-rpc - if [ -z "$(QUICKSTART_IMAGE)" ]; then \ - CORE_IMAGE_REF=$$( [[ -z "$(CORE_IMAGE)" || ! -z "$(CORE_IMAGE_BIN_PATH)" ]] && 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)"); \ - STELLAR_RPC_IMAGE_REF=$$( [ -z "$(STELLAR_RPC_IMAGE)" ] && echo "$(STELLAR_RPC_STAGE_IMAGE)" || echo "$(STELLAR_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)"; \ - SOURCE_URL=.; \ - fi; \ - docker build -t "$(QUICKSTART_STAGE_IMAGE)" \ - --build-arg PROTOCOL_VERSION_DEFAULT=$$PROTOCOL_VERSION_DEFAULT \ - --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 \ - --build-arg FRIENDBOT_IMAGE_REF=$$FRIENDBOT_IMAGE_REF \ - --build-arg STELLAR_RPC_IMAGE_REF=$$STELLAR_RPC_IMAGE_REF \ - --build-arg LAB_IMAGE_REF=$(LAB_STAGE_IMAGE) \ - -f Dockerfile "$$SOURCE_URL"; \ - fi - -build: build-quickstart build-stellar-cli - QUICKSTART_IMAGE_REF=$$( [ -z "$(QUICKSTART_IMAGE)" ] && echo "$(QUICKSTART_STAGE_IMAGE)" || echo "$(QUICKSTART_IMAGE)"); \ +build: build-stellar-cli 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 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) \ diff --git a/README.md b/README.md index abfa376..98541b4 100644 --- a/README.md +++ b/README.md @@ -2,74 +2,33 @@ ### Running system tests: -Identify the system-test image you want to use for running tests: +Identify the quickstart image you want to use as target for running tests. Quickstart contains the server stack of core, rpc: - 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, stellar cli, this will create a docker - image named `stellar/system-test:dev`. All `GIT_REF` variables can refer to + `dockerhub.io/stellar/quickstart` +- Or build the system test docker image locally with specific versions of cli and stellar-js-sdk, + 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#` ``` make - QUICKSTART_GIT_REF=? \ - CORE_GIT_REF=? \ - CORE_COMPILE_CONFIGURE_FLAGS=? \ - STELLAR_RPC_GIT_REF=? \ STELLAR_CLI_GIT_REF=? \ - GO_GIT_REF=? \ RUST_TOOLCHAIN_VERSION=? \ STELLAR_CLI_CRATE_VERSION=? \ JS_STELLAR_SDK_NPM_VERSION=? \ NODE_VERSION=? \ - PROTOCOL_VERSION_DEFAULT=? \ build ``` -example of build using specific git refs, mainline from repos in this example, -or use tags, branches, etc: +all settings have defaults pre-set, and optionally be overriden, refer to the Makefile for the defaulted values. -``` -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" \ - STELLAR_RPC_GIT_REF=https://github.com/stellar/soroban-tools.git#main \ - RUST_TOOLCHAIN_VERSION=stable \ - STELLAR_CLI_GIT_REF=https://github.com/stellar/soroban-tools.git#main \ - QUICKSTART_GIT_REF=https://github.com/stellar/quickstart.git#main \ - JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git#master \ - build -``` - -example of build using an existing quickstart image, this can dramatically speed -up the build time, as the existing quickstart image will provide the -pre-compiled rpc, and core runtimes already: - -``` -make QUICKSTART_IMAGE=stellar/quickstart:soroban-dev \ - RUST_TOOLCHAIN_VERSION=1.66.0 \ - STELLAR_CLI_GIT_REF=/Users/user/stellar-cli-build -``` - -some settings have defaults pre-set, and optionally be overriden: +#### Optional Build Params ``` +# cli will be compiled from this git ref STELLAR_CLI_GIT_REF=https://github.com/stellar/stellar-cli.git#main -STELLAR_RPC_GIT_REF=https://github.com/stellar/stellar-rpc.git#main -RUST_TOOLCHAIN_VERSION=stable -QUICKSTART_GIT_REF=https://github.com/stellar/quickstart.git#main -# the GO_GIT_REF provides the reference on the stellar/go repo from which -# to build horizon -GO_GIT_REF=https://github.com/stellar/go.git#master -CORE_COMPILE_CONFIGURE_FLAGS="--disable-tests" -CORE_GIT_REF=https://github.com/stellar/stellar-core.git#master -JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git#master -``` -optional params to set: - -``` # this will override STELLAR_CLI_GIT_REF, and install stellar cli from crates repo instead STELLAR_CLI_CRATE_VERSION=0.4.0 @@ -86,42 +45,26 @@ JS_STELLAR_SDK_NPM_VERSION=https://github.com/stellar/js-stellar-sdk.git#master # platform arch as the build host is running on, i.e. linux/amd64 or linux/arm64. # Otherwise, build will fail if image is not available for matching host platform. # -# this will skip building from source for core(CORE_GIT_REF), rpc(STELLAR_RPC_GIT_REF) and quickstart(QUICKSTART_GIT_REF), instead -# will use the versions already compiled in the existing quickstart docker image provided: -QUICKSTART_IMAGE=/: - -# this will skip building core from CORE_GIT_REF and instead -# will use the `stellar-core` by default at /usr/local/bin/stellar-core in the existing docker image provided: -CORE_IMAGE=/: - -# define a custom path that `stellar-core` bin is located on CORE_IMAGE, -# to override the default of /usr/local/bin/stellar-core -CORE_IMAGE_BIN_PATH= - -# this will skip building stellar-rpc from STELLAR_RPC_GIT_REF and instead -# will use the bin already compiled at /bin/stellar-rpc in the existing docker image provided: -STELLAR_RPC_IMAGE=/: # 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: STELLAR_CLI_IMAGE=/: +``` + +#### Required runtime params -# 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: -HORIZON_IMAGE=/: +Set the target network to test. This just needs to be the RPC server of the network. It can be from a running quickstart instance or testnet or pubnet: + `--TargetNetworkRPCURL {http:///soroban/rpc}` -# this will skip building friendbot from GO_GIT_REF and instead -# will use the bin already compiled at /app/friendbot in the existing docker image provided: -FRIENDBOT_IMAGE=/: +Note - If you are running quickstart as a docker container on the same host machine, then specify the rpc url as `--TargetNetworkRPCURL http://host.docker.internal:8000/rpc` to use Docker's convention to reference host network. -# set the default network protocol version which the internal core runtime built from `CORE_GIT_REF` should start with. -# Should typically be set to the maximum supported protocol version of all components. -# If not set or set to empty, will default to the core max supported protocol version defined in quickstart. -PROTOCOL_VERSION_DEFAULT= -``` +#### Optional runtime params -Optional parameters to pass when running the system-test image, -`stellar/system-test:`: +System test will by default use the network settings for `local` network from quickstart. +If `TargetNetworkRPCURL` is pointed at any stellar network other than a `local` network instance provided from quickstart, then you'll need to provide the network specifics. +`--TargetNetworkPassphrase "{passphrase}"` +`--TargetNetworkTestAccountSecret "{your test account key pair info}"` +`--TargetNetworkTestAccountPublic "{your test account key pair info}"` To specify git version of the smart contract source code used in soroban test fixtures. `--SorobanExamplesGitHash {branch, tag, git commit hash}` @@ -134,46 +77,12 @@ scenario outline is postfixed with '#01', '#02', examples: or `--TestFilter "^TestDappDevelop$/^DApp developer compiles, deploys and invokes a contract#01$"` -The default target network for system tests is a new/empty instance of local -network hosted inside the docker container, tests will use the default root -account already seeded into local network. Alternatively, can override the -network settings for local and remote usages: - -- Tests will use an internally hosted core watcher node: - `--TargetNetwork {standalone|futurenet|testnet}` -- Tests will use an external rpc instance and the container will not run core, - horizon, rpc services internally: - `--TargetNetworkRPCURL {http:///soroban/rpc}` -- Tests use these settings in either target network mode, and these are by - default set to work with local: `--TargetNetworkPassphrase "{passphrase}"` - `--TargetNetworkTestAccountSecret "{your test account key pair info}"` - `--TargetNetworkTestAccountPublic "{your test account key pair info}"` - -Debug mode, the docker container will exit with error code when any pre-setup or -test fails to pass, you can enable DEBUG_MODE flag, and the container will stay -running, prompting you for enter key before shutting down, make sure you invoke -docker with `-it` so the prompt will reach your command line. While container is -kept running, you can shell into it via `docker exec -it ` -and view log files of services in the stack such as core, rpc located in -container at `/var/log/supervisor`. `--DebugMode=true` +Set verbose logging output `--VerboseOutput true` -The docker run follows standard exit code conventions, so if all tests pass in -the container run, exit code from command line execution will be 0, otherwise, -if any failures in container or tests, then exit code will be greater than 0. +#### Running Tests -#### Running Test Examples - -- Run tests against an instance of core and rpc on a local network all running - in the test container: - - ``` - docker run --rm -t --name e2e_test stellar/system-test: \ - --VerboseOutput true - ``` - -- Run tests against a remote instance of rpc configured for testnet, this will - not run core or rpc instances locally in the test container. It requires you - provide a key pair of an account that is funded with Lumens on the target +- Run tests against a remote instance of rpc hosted on a quickstart configured for testnet. + The tests requires you provide a key pair of an account that is funded with Lumens on the target network for the tests to use as source account on transactions it will submit to target network: @@ -184,9 +93,23 @@ if any failures in container or tests, then exit code will be greater than 0. --TargetNetworkPassphrase "Test SDF Network ; September 2015" \ --TargetNetworkTestAccountSecret \ --TargetNetworkTestAccountPublic \ - --SorobanExamplesGitHash v20.0.0-rc2 + --SorobanExamplesGitHash v22.0.1 ``` +#### Debug test failures +Use `--VerboseOutput true` and may need to check the lops of the rpc server instance if you have access to those at same time. + +The docker container will exit with error code when any pre-setup or +test fails to pass, you can enable DEBUG_MODE flag, and the container will stay +running, prompting you for depressing enter key before shutting down, make sure you invoke +docker with `-it` so the prompt will reach your command line. While container is +kept running, you can shell into it via `docker exec -it ` +and manually re-run tests in container, check local outputs. + +The docker run follows standard exit code conventions, so if all tests pass in +the container run, exit code from command line execution will be 0, otherwise, +if any failures in container or tests, then exit code will be greater than 0. + ### Development mode and running tests directly from checked out system-test repo. This approach allows to run the tests from source code directly on host as go @@ -200,17 +123,11 @@ tests, no docker image is used. https://www.rust-lang.org/tools/install 3. `stellar` 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 stellar-rpc instance. You can - use an existing/running instance if reachable or can use the quickstart - image `stellar/quickstart:testing` 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. +4. run an instance of RPC locally by running quickstart on a local network such as `stellar/quickstart:latest`. ``` - docker run --rm -it -p 8000:8000 --name stellar stellar/quickstart:dev --local --enable rpc + docker run --rm -it -p 8000:8000 --name stellar stellar/quickstart:latest --local ``` -5. locally checkout stellar/system-test GH repo and go into top folder - +5. locally checkout stellar/system-test `git clone https://github.com/stellar/system-test.git;cd system-test` #### Running tests locally as go programs diff --git a/start b/start index 8102a0a..ec09084 100755 --- a/start +++ b/start @@ -5,17 +5,14 @@ set -o pipefail # the versions of software that tests will use SOROBAN_EXAMPLES_GIT_HASH="main" SOROBAN_EXAMPLES_REPO_URL="https://github.com/stellar/soroban-examples.git" -DEBUG_MODE= +DEBUG_MODE=false # the target network under test -TARGET_NETWORK= +# defaults to local quickstart network settings TARGET_NETWORK_PASSPHRASE="Standalone Network ; February 2017" TARGET_NETWORK_SECRET_KEY="SC5O7VZUXDJ6JBDSZ74DSERXL7W3Y5LTOAMRF7RQRL3TAGAPS7LUVG3L" TARGET_NETWORK_PUBLIC_KEY="GBZXN7PIRZGNMHGA7MUUUF4GWPY5AYPV6LY4UV2GL6VJGIQRXFDNMADI" -TARGET_NETWORK_RPC_URL= -QUICKSTART_LOG_FILE=/var/log/system-test-quickstart.log -LOCAL_CORE=false -ENABLE_SOROBAN_DIAGNOSTIC_EVENTS=--enable-soroban-diagnostic-events +TARGET_NETWORK_RPC_URL="http://host.docker.internal:8000/rpc" # example filter for all combos of one scenario outline: ^TestDappDevelop$/^DApp developer compiles, deploys and invokes a contract.*$ # each row in example data for a scenario outline is postfixed with '#01', '#02', example: @@ -41,15 +38,6 @@ printout() { trap finish EXIT function finish { - if [ -z "$TARGET_NETWORK_RPC_URL" ] && [ $? -ne 0 ] && [ "$VERBOSE_OUTPUT" != "true" ]; then - # dump the local server logs if they were running in container. - echo "" >&2 - echo "" >&2 - echo "dumping system log output $QUICKSTART_LOG_FILE ..." >&2 - echo "" >&2 - echo "" >&2 - cat $QUICKSTART_LOG_FILE >&2 - fi CANCELLED=true if [ "$DEBUG_MODE" = "true" ]; then @@ -61,56 +49,17 @@ function finish { function main() { process_args "$@" - if [ ! -z "$TARGET_NETWORK_RPC_URL" ] && [ ! -z "$TARGET_NETWORK" ]; then - echo "Invalid TargetNetwork config, must set TargetNetwork or TargetNetworkRPCURL, aborting test ..." >&2 - exit 1 - fi - - if [ -z "$TARGET_NETWORK_RPC_URL" ] && \ - [ "$TARGET_NETWORK" != "standalone" ] && \ - [ "$TARGET_NETWORK" != "local" ] && \ - [ "$TARGET_NETWORK" != "futurenet" && ] && \ - [ "$TARGET_NETWORK" != "testnet" && ]; then - echo "Invalid TargetNetwork, must be one of: standalone or local(both mean the same), futurenet, or testnet, aborting test ..." >&2 + if [ -z "$TARGET_NETWORK_RPC_URL" ]; then + echo "Invalid, TargetNetworkRPCUrl must be set" >&2 exit 1 fi - if [ -z "$TARGET_NETWORK_RPC_URL" ]; then - - TARGET_NETWORK_RPC_URL=http://localhost:8000/rpc - LOCAL_CORE=true - print_screen_output "starting target stack on $TARGET_NETWORK with following server versions:" - print_screen_output " CORE VERSION=$(stellar-core version 2>/dev/null || echo "n/a")" - print_screen_output " HORIZON VERSION=$(stellar-horizon version 2>/dev/null || echo "n/a")" - print_screen_output " STELLAR RPC VERSION=$(stellar-rpc version 2>/dev/null || echo "n/a")" - - if [ "$TARGET_NETWORK" = "futurenet" ]; then - TARGET_NETWORK_PASSPHRASE="Test SDF Future Network ; October 2022" - fi - - if [ "$VERBOSE_OUTPUT" = "true" ]; then - # redirects all quickstart output to console during test execution - /start --$TARGET_NETWORK --enable rpc $ENABLE_SOROBAN_DIAGNOSTIC_EVENTS --logs 2>&1 & - else - # don't show any quickstart output on console during test execution - # all quickstart output is redirected(buffering disabled) to log file, which will be dumped to - # console if tests fail. - stdbuf -o0 -e0 /start --$TARGET_NETWORK --enable rpc $ENABLE_SOROBAN_DIAGNOSTIC_EVENTS --logs >> $QUICKSTART_LOG_FILE 2>&1 & - fi - fi - stellar_rpc_status - # quickstart runs horizon, but sys tests don't need it. - if [ "$LOCAL_CORE" = "true" ]; then - supervisorctl stop horizon - 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 " 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" print_screen_output " TARGET_NETWORK_PASSPHRASE=$TARGET_NETWORK_PASSPHRASE" print_screen_output " TARGET_NETWORK_SECRET_KEY=$TARGET_NETWORK_SECRET_KEY" print_screen_output " TARGET_NETWORK_PUBLIC_KEY=$TARGET_NETWORK_PUBLIC_KEY" @@ -127,7 +76,6 @@ function main() { export TargetNetworkPublicKey=${TARGET_NETWORK_PUBLIC_KEY} export TargetNetworkRPCURL=${TARGET_NETWORK_RPC_URL} export VerboseOutput=${VERBOSE_OUTPUT} - export LocalCore=${LOCAL_CORE} export FeaturePath=${FEATURE_PATH} for file in ./*; @@ -170,10 +118,6 @@ function process_args() { VERBOSE_OUTPUT="$1" shift ;; - --TargetNetwork) - TARGET_NETWORK="$1" - shift - ;; --TargetNetworkPassphrase) TARGET_NETWORK_PASSPHRASE="$1" shift @@ -193,10 +137,6 @@ function process_args() { *) esac done - - if [ -z "$TARGET_NETWORK_RPC_URL" ] && [ -z "$TARGET_NETWORK" ]; then - TARGET_NETWORK=local - fi } function stellar_rpc_status () { From edd58db43b2fad08f6545edca7b1553c6a182702 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 15:25:22 -0700 Subject: [PATCH 02/60] #92: added callable workflow using qs pipeline from system-test --- .github/workflows/test_ng.yml | 317 ++++++++++++++++++++++++++++++++++ 1 file changed, 317 insertions(+) create mode 100644 .github/workflows/test_ng.yml diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml new file mode 100644 index 0000000..2badb90 --- /dev/null +++ b/.github/workflows/test_ng.yml @@ -0,0 +1,317 @@ +name: Systems test workflow, next gen, uses quickstart pipelines + +on: + workflow_call: + inputs: + runner: + description: "GitHub runner to use" + required: false + type: string + default: "ubuntu-latest" + + system-test-git-ref: + description: "the git ref (branch, tag, sha) to use for system-test" + required: false + type: string + default: master + + stellar-cli-ref: + description: | + the soroban CLI source code to compile and run from system test + refers to checked out source of current GitHub ref context or branch + required: false + type: string + + stellar-cli-version: + required: false + type: string + default: "23.0.0" + + test-filter: + description: | + example filter for all combos of one scenario outline: ^TestDappDevelop$/^DApp developer compiles, deploys and invokes a contract.*$ + each row in example data for a scenario outline is postfixed with '#01', '#02', example: + TestDappDevelop/DApp developer compiles, deploys and invokes a contract#01 + required: false + type: string + default: "^TestDappDevelop$/^.*$" + + js-stellar-sdk-npm-version: + description: | + set the version of js-stellar-sdk to use, need to choose one of either + resolution options, using npm release or a gh ref: + option #1, set the version of stellar-sdk based on a npm release version + required: false + type: string + default: 14.0.0-rc.3 + + js-stellar-sdk-gh-repo: + description: | + option #2, set the version of stellar-sdk based on a gh repo, e.g. stellar/js-stellar-sdk + if set, takes precedence over js-stellar-sdk-npm-version + required: false + type: string + + js-stellar-sdk-gh-ref: + description: "The git ref (branch, tag, sha) to use for js-stellar-sdk if using gh repo option" + required: false + type: string + + stellar-xdr-version: + description: "Version of stellar-xdr to use" + required: false + type: string + default: "v23.0.0" + + stellar-core-version: + description: "Version of stellar-core to use" + required: false + type: string + default: "v23.0.1" + + horizon-version: + description: "Version of horizon to use" + required: false + type: string + default: "horizon-v23.0.0" + + lab-version: + description: "Version of stellar laboratory to use" + required: false + type: string + default: "main" + + protocol-version: + description: "Protocol version to use" + required: false + type: string + default: "23" + + rust-toolchain-version: + description: "Version of Rust toolchain to use in test runtime environment" + required: false + type: string + default: "stable" + + verbose-output: + required: false + type: boolean + default: true + + soroban-examples-git-hash: + description: "The git ref (branch, tag, sha) to use for soroban-examples" + required: false + type: string + default: "v22.0.1" + + soroban-examples-repo-url: + description: "The git repo URL to use for soroban-examples" + required: false + type: string + default: "https://github.com/stellar/soroban-examples" + +env: + SYSTEM_TEST_IMAGE: ${{ github.repository }}:system-test + SYSTEM_TEST_IMAGE_CACHE_REGISTRY: ghcr.io + +jobs: + prepare-config: + runs-on: ubuntu-latest + outputs: + images-config: ${{ steps.set-config.outputs.images }} + system-test-image-cache-registry: ${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }} + system-test-image-cached: "${{ steps.set-image-name.outputs.base-image }}_${{ steps.set-cache-key.outputs.cache-key }}" + should-push-to-registry: ${{ steps.check-fork.outputs.should-push }} + steps: + - id: check-fork + name: Check if should push to registry + run: | + if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]; then + echo "should-push=true" >> $GITHUB_OUTPUT + else + echo "should-push=false" >> $GITHUB_OUTPUT + fi + + - id: set-image-name + name: Set system test image name with optional registry prefix + run: | + if [ "${{ steps.check-fork.outputs.should-push }}" == "true" ]; then + IMAGE_NAME="${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }}/${{ env.SYSTEM_TEST_IMAGE }}" + else + IMAGE_NAME="${{ env.SYSTEM_TEST_IMAGE }}" + fi + echo "base-image=${IMAGE_NAME}" >> $GITHUB_OUTPUT + echo "Using image name: ${IMAGE_NAME}" + + - id: set-cache-key + run: | + # Fetch commit SHAs for each dependency repo + SYSTEM_TEST_SHA="${{ github.sha }}" + + # Parse STELLAR_CLI_REF which is in format: URL\#ref + CLI_URL_REF="${{ inputs.stellar-cli-ref }}" + CLI_URL="${CLI_URL_REF%\\#*}" + CLI_REF="${CLI_URL_REF##*\\#}" + STELLAR_CLI_SHA=$(git ls-remote "$CLI_URL" "$CLI_REF" | awk '{print $1}') + if [ -z "$STELLAR_CLI_SHA" ]; then + echo "Error: Could not find ref $CLI_REF in $CLI_URL" + exit 1 + fi + + # Handle JS Stellar SDK + if [ -n "${{ inputs.js-stellar-sdk-gh-repo }}" ]; then + JS_SDK_PART=$(git ls-remote https://github.com/${{ inputs.js-stellar-sdk-gh-repo }} ${{ inputs.js-stellar-sdk-gh-ref }} | awk '{print $1}') + if [ -z "$JS_SDK_PART" ]; then + echo "Error: Could not find ref ${{ inputs.js-stellar-sdk-gh-ref }} in ${{ inputs.js-stellar-sdk-gh-repo }}" + exit 1 + fi + else + JS_SDK_PART="${{ inputs.js-stellar-sdk-npm-version }}" + fi + + # Create cache key by hashing all components + CACHE_INPUT="${SYSTEM_TEST_SHA}${STELLAR_CLI_SHA}${JS_SDK_PART}" + CACHE_KEY=$(echo -n "$CACHE_INPUT" | sha256sum | cut -c1-16) + echo "cache-key=${CACHE_KEY}" >> $GITHUB_OUTPUT + echo "Generated cache key: ${CACHE_KEY}" + + - id: set-config + run: | + cat <> $GITHUB_OUTPUT + images< /dev/null 2>&1; then + echo "Image exists in registry" + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "Image not found in registry" + echo "exists=false" >> $GITHUB_OUTPUT + fi + + build-system-test: + runs-on: ubuntu-latest-4-cores + needs: [prepare-config, check-system-test-cache] + if: needs.check-system-test-cache.outputs.cache-hit != 'true' + env: + SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} + steps: + - uses: actions/checkout@v3 + with: + ref: ${{ inputs.system-test-git-ref }} + path: system-test + + - if: inputs.js-stellar-sdk-gh-repo != '' + name: prepare local js-stellar-sdk + run: | + rm -rf $GITHUB_WORKSPACE/system-test/js-stellar-sdk; + + - if: inputs.js-stellar-sdk-gh-repo != '' + uses: actions/checkout@v4 + with: + repository: ${{ inputs.js-stellar-sdk-gh-repo }} + ref: ${{ inputs.js-stellar-sdk-gh-ref }} + path: system-test/js-stellar-sdk + + - uses: stellar/actions/rust-cache@main + + - name: Build system test with component versions + run: | + cd $GITHUB_WORKSPACE/system-test + if [ -z "${{ inputs.js-stellar-sdk-gh-repo }}" ]; then \ + JS_STELLAR_SDK_REF="${{ inputs.js-stellar-sdk-npm-version }}"; \ + else \ + JS_STELLAR_SDK_REF="file:/home/tester/js-stellar-sdk"; \ + fi + make \ + STELLAR_CLI_GIT_REF=${{ inputs.stellar-cli-ref }} \ + RUST_TOOLCHAIN_VERSION=${{ inputs.rust-toolchain-version }} \ + JS_STELLAR_SDK_NPM_VERSION=$JS_STELLAR_SDK_REF \ + SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ + build + - name: login to ghcr + if: needs.prepare-config.outputs.should-push-to-registry == 'true' + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} + username: ${{ github.actor }} + password: ${{ github.token }} + - name: Publish system-test image + if: needs.prepare-config.outputs.should-push-to-registry == 'true' + run: | + docker push $SYSTEM_TEST_IMAGE + + integration: + name: System tests + needs: [build-system-test, build-quickstart, prepare-config] + # Run if build-system-test succeeded OR was skipped because image is already in built(cache hit) + if: needs.build-system-test.result == 'success' || needs.build-system-test.result == 'skipped' + + strategy: + matrix: + scenario-filter: ["${{ inputs.test-filter }}"] + runs-on: ubuntu-latest + env: + SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} + steps: + - name: login to ghcr + if: needs.prepare-config.outputs.should-push-to-registry == 'true' + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + with: + registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} + username: ${{ github.actor }} + password: ${{ github.token }} + + - name: download system-test image + if: needs.prepare-config.outputs.should-push-to-registry == 'true' + run: | + docker pull $SYSTEM_TEST_IMAGE + - name: Start quickstart with rpc + uses: stellar/quickstart@main + with: + artifact: image-quickstart-rpc-custom-amd64.tar + tag: rpc-custom-amd64 + enable: core,rpc + + - name: Run system test scenarios + run: | + docker run \ + --rm -t --name e2e_test $SYSTEM_TEST_IMAGE \ + --VerboseOutput ${{ inputs.verbose-output }} \ + --TargetNetworkRPCURL http://host.docker.internal:8000/rpc \ + --TestFilter "${{ matrix.scenario-filter }}" \ + --SorobanExamplesGitHash ${{ inputs.soroban-examples-git-hash }} \ + --SorobanExamplesRepoURL ${{ inputs.soroban-examples-repo-url }} \ No newline at end of file From fef8f6b23062be6560863f21a8951850f00f0af9 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 16:02:20 -0700 Subject: [PATCH 03/60] #92: fixed cli ref url parsing for sha lookup --- .github/workflows/test_ng.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 2badb90..1201b85 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -148,10 +148,10 @@ jobs: # Fetch commit SHAs for each dependency repo SYSTEM_TEST_SHA="${{ github.sha }}" - # Parse STELLAR_CLI_REF which is in format: URL\#ref + # Parse STELLAR_CLI_REF which is in format: URL#ref CLI_URL_REF="${{ inputs.stellar-cli-ref }}" - CLI_URL="${CLI_URL_REF%\\#*}" - CLI_REF="${CLI_URL_REF##*\\#}" + CLI_URL="${CLI_URL_REF%#*}" + CLI_REF="${CLI_URL_REF##*#}" STELLAR_CLI_SHA=$(git ls-remote "$CLI_URL" "$CLI_REF" | awk '{print $1}') if [ -z "$STELLAR_CLI_SHA" ]; then echo "Error: Could not find ref $CLI_REF in $CLI_URL" From 625411e9826673735b8329f41cf840d906595035 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 16:18:18 -0700 Subject: [PATCH 04/60] #92: fixed cli ref url parse with delimeter --- .github/workflows/test_ng.yml | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 1201b85..1d2561c 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -150,12 +150,21 @@ jobs: # Parse STELLAR_CLI_REF which is in format: URL#ref CLI_URL_REF="${{ inputs.stellar-cli-ref }}" - CLI_URL="${CLI_URL_REF%#*}" - CLI_REF="${CLI_URL_REF##*#}" - STELLAR_CLI_SHA=$(git ls-remote "$CLI_URL" "$CLI_REF" | awk '{print $1}') - if [ -z "$STELLAR_CLI_SHA" ]; then - echo "Error: Could not find ref $CLI_REF in $CLI_URL" - exit 1 + + # Only fetch if stellar-cli-ref is provided + if [ -n "$CLI_URL_REF" ]; then + # Split on # to get URL and ref + CLI_URL=$(echo "$CLI_URL_REF" | cut -d'#' -f1) + CLI_REF=$(echo "$CLI_URL_REF" | cut -d'#' -f2) + + STELLAR_CLI_SHA=$(git ls-remote "$CLI_URL" "$CLI_REF" | awk '{print $1}') + if [ -z "$STELLAR_CLI_SHA" ]; then + echo "Error: Could not find ref $CLI_REF in $CLI_URL" + exit 1 + fi + else + # If no CLI ref provided + STELLAR_CLI_SHA="${{ inputs.stellar-cli-version }}" fi # Handle JS Stellar SDK From e62f762b3a1973fa45d5ff9bfb2e9e62c5f5b5f1 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 16:34:39 -0700 Subject: [PATCH 05/60] #92: fixed system test checkout to workspace in job --- .github/workflows/test_ng.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 1d2561c..c29813f 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -240,6 +240,7 @@ jobs: steps: - uses: actions/checkout@v3 with: + repository: stellar/system-test ref: ${{ inputs.system-test-git-ref }} path: system-test From 5a0766e1e79217da1bb93c146fc1c3dfec2ea17b Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 16:55:22 -0700 Subject: [PATCH 06/60] get the proper commit sha for system test git ref job parameter --- .github/workflows/test_ng.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index c29813f..1d3bc57 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -111,7 +111,7 @@ on: default: "https://github.com/stellar/soroban-examples" env: - SYSTEM_TEST_IMAGE: ${{ github.repository }}:system-test + SYSTEM_TEST_IMAGE: stellar/system-test:cache SYSTEM_TEST_IMAGE_CACHE_REGISTRY: ghcr.io jobs: @@ -146,7 +146,12 @@ jobs: - id: set-cache-key run: | # Fetch commit SHAs for each dependency repo - SYSTEM_TEST_SHA="${{ github.sha }}" + + SYSTEM_TEST_SHA=$(git ls-remote https://github.com/stellar/system-test ${{ inputs.system-test-git-ref }} | awk '{print $1}') + if [ -z "$SYSTEM_TEST_SHA" ]; then + echo "Error: Could not find ref ${{ inputs.system-test-git-ref }} in stellar/system-test" + exit 1 + fi # Parse STELLAR_CLI_REF which is in format: URL#ref CLI_URL_REF="${{ inputs.stellar-cli-ref }}" From bf2c832e8ed7c7fb7605d944efac0dff8b49d62c Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 17:32:53 -0700 Subject: [PATCH 07/60] use artifacts for image across jobs on forked prs --- .github/workflows/test_ng.yml | 41 +++++++++++++++++++++++++++-------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 1d3bc57..644b7ce 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -121,21 +121,21 @@ jobs: images-config: ${{ steps.set-config.outputs.images }} system-test-image-cache-registry: ${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }} system-test-image-cached: "${{ steps.set-image-name.outputs.base-image }}_${{ steps.set-cache-key.outputs.cache-key }}" - should-push-to-registry: ${{ steps.check-fork.outputs.should-push }} + ghcr_allowed: ${{ steps.check-fork.outputs.ghcr-allowed }} steps: - id: check-fork - name: Check if should push to registry + name: Check if GHCR access is allowed run: | if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]; then - echo "should-push=true" >> $GITHUB_OUTPUT + echo "ghcr-allowed=true" >> $GITHUB_OUTPUT else - echo "should-push=false" >> $GITHUB_OUTPUT + echo "ghcr-allowed=false" >> $GITHUB_OUTPUT fi - id: set-image-name name: Set system test image name with optional registry prefix run: | - if [ "${{ steps.check-fork.outputs.should-push }}" == "true" ]; then + if [ "${{ steps.check-fork.outputs.ghcr-allowed }}" == "true" ]; then IMAGE_NAME="${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }}/${{ env.SYSTEM_TEST_IMAGE }}" else IMAGE_NAME="${{ env.SYSTEM_TEST_IMAGE }}" @@ -278,17 +278,28 @@ jobs: SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ build - name: login to ghcr - if: needs.prepare-config.outputs.should-push-to-registry == 'true' + if: needs.prepare-config.outputs.ghcr_allowed == 'true' uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} username: ${{ github.actor }} password: ${{ github.token }} - name: Publish system-test image - if: needs.prepare-config.outputs.should-push-to-registry == 'true' + if: needs.prepare-config.outputs.ghcr_allowed == 'true' run: | docker push $SYSTEM_TEST_IMAGE + - name: extract image to artifact when no gchr + if: needs.prepare-config.outputs.ghcr_allowed != 'true' + run: | + docker save $SYSTEM_TEST_IMAGE -o $GITHUB_WORKSPACE/system-test/image.tar + - name: save to artifact when no ghcr + if: needs.prepare-config.outputs.ghcr_allowed != 'true' + uses: actions/upload-artifact@v4 + with: + name: image-system-test + path: $GITHUB_WORKSPACE/system-test/image.tar + integration: name: System tests needs: [build-system-test, build-quickstart, prepare-config] @@ -303,7 +314,7 @@ jobs: SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} steps: - name: login to ghcr - if: needs.prepare-config.outputs.should-push-to-registry == 'true' + if: needs.prepare-config.outputs.ghcr_allowed == 'true' uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} @@ -311,9 +322,21 @@ jobs: password: ${{ github.token }} - name: download system-test image - if: needs.prepare-config.outputs.should-push-to-registry == 'true' + if: needs.prepare-config.outputs.ghcr_allowed == 'true' run: | docker pull $SYSTEM_TEST_IMAGE + + - name: download artifact if no ghcr + if: needs.prepare-config.outputs.ghcr_allowed != 'true' + uses: actions/download-artifact@v4 + with: + name: image-system-test + path: /tmp/ + + - name: load system-test image if no ghcr + if: needs.prepare-config.outputs.ghcr_allowed != 'true' + run: | + docker load -i /tmp/image.tar - name: Start quickstart with rpc uses: stellar/quickstart@main with: From 6ff551392753431b0e2a8afa2a00d99d2348a63c Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 17:53:58 -0700 Subject: [PATCH 08/60] use tmp for artifact path --- .github/workflows/test_ng.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 644b7ce..89eb7cc 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -292,13 +292,13 @@ jobs: - name: extract image to artifact when no gchr if: needs.prepare-config.outputs.ghcr_allowed != 'true' run: | - docker save $SYSTEM_TEST_IMAGE -o $GITHUB_WORKSPACE/system-test/image.tar + docker save $SYSTEM_TEST_IMAGE -o /tmp/image.tar - name: save to artifact when no ghcr if: needs.prepare-config.outputs.ghcr_allowed != 'true' uses: actions/upload-artifact@v4 with: - name: image-system-test - path: $GITHUB_WORKSPACE/system-test/image.tar + name: image-system-test + path: /tmp/image.tar integration: name: System tests From 100b62ce2554f8699c4f01dddec6661504d45839 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 18:17:00 -0700 Subject: [PATCH 09/60] use docker.io for image cache --- .github/workflows/test_ng.yml | 75 +++++++++++++++-------------------- 1 file changed, 31 insertions(+), 44 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 89eb7cc..9ff4adc 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -2,6 +2,11 @@ name: Systems test workflow, next gen, uses quickstart pipelines on: workflow_call: + secrets: + DOCKERHUB_USERNAME: + required: false + DOCKERHUB_TOKEN: + required: false inputs: runner: description: "GitHub runner to use" @@ -112,7 +117,7 @@ on: env: SYSTEM_TEST_IMAGE: stellar/system-test:cache - SYSTEM_TEST_IMAGE_CACHE_REGISTRY: ghcr.io + SYSTEM_TEST_IMAGE_CACHE_REGISTRY: docker.io jobs: prepare-config: @@ -120,29 +125,17 @@ jobs: outputs: images-config: ${{ steps.set-config.outputs.images }} system-test-image-cache-registry: ${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }} - system-test-image-cached: "${{ steps.set-image-name.outputs.base-image }}_${{ steps.set-cache-key.outputs.cache-key }}" - ghcr_allowed: ${{ steps.check-fork.outputs.ghcr-allowed }} + system-test-image-cached: "${{ env.SYSTEM_TEST_IMAGE}}_${{ steps.set-cache-key.outputs.cache-key }}" + registry_allowed: ${{ steps.check-fork.outputs.registry-allowed }} steps: - id: check-fork - name: Check if GHCR access is allowed + name: Check if registry access is allowed run: | if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]; then - echo "ghcr-allowed=true" >> $GITHUB_OUTPUT - else - echo "ghcr-allowed=false" >> $GITHUB_OUTPUT - fi - - - id: set-image-name - name: Set system test image name with optional registry prefix - run: | - if [ "${{ steps.check-fork.outputs.ghcr-allowed }}" == "true" ]; then - IMAGE_NAME="${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }}/${{ env.SYSTEM_TEST_IMAGE }}" + echo "registry-allowed=true" >> $GITHUB_OUTPUT else - IMAGE_NAME="${{ env.SYSTEM_TEST_IMAGE }}" - fi - echo "base-image=${IMAGE_NAME}" >> $GITHUB_OUTPUT - echo "Using image name: ${IMAGE_NAME}" - + echo "registry-allowed=false" >> $GITHUB_OUTPUT + fi - id: set-cache-key run: | # Fetch commit SHAs for each dependency repo @@ -228,7 +221,7 @@ jobs: - id: check name: Check if cached system-test image exists run: | - if docker manifest inspect ${{ needs.prepare-config.outputs.system-test-image-cached }} > /dev/null 2>&1; then + if docker manifest inspect ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/${{ needs.prepare-config.outputs.system-test-image-cached }} > /dev/null 2>&1; then echo "Image exists in registry" echo "exists=true" >> $GITHUB_OUTPUT else @@ -277,24 +270,25 @@ jobs: JS_STELLAR_SDK_NPM_VERSION=$JS_STELLAR_SDK_REF \ SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ build - - name: login to ghcr - if: needs.prepare-config.outputs.ghcr_allowed == 'true' + - name: login to registry + if: needs.prepare-config.outputs.registry_allowed == 'true' uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} - username: ${{ github.actor }} - password: ${{ github.token }} + username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }} + password: ${{ secrets.DOCKERHUB_TOKEN || github.token }} - name: Publish system-test image - if: needs.prepare-config.outputs.ghcr_allowed == 'true' + if: needs.prepare-config.outputs.registry_allowed == 'true' run: | - docker push $SYSTEM_TEST_IMAGE + dockder tag $SYSTEM_TEST_IMAGE ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE + docker push ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE - - name: extract image to artifact when no gchr - if: needs.prepare-config.outputs.ghcr_allowed != 'true' + - name: extract image to artifact when no registry + if: needs.prepare-config.outputs.registry_allowed != 'true' run: | docker save $SYSTEM_TEST_IMAGE -o /tmp/image.tar - - name: save to artifact when no ghcr - if: needs.prepare-config.outputs.ghcr_allowed != 'true' + - name: save to artifact when no registry + if: needs.prepare-config.outputs.registry_allowed != 'true' uses: actions/upload-artifact@v4 with: name: image-system-test @@ -313,28 +307,21 @@ jobs: env: SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} steps: - - name: login to ghcr - if: needs.prepare-config.outputs.ghcr_allowed == 'true' - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} - username: ${{ github.actor }} - password: ${{ github.token }} - - name: download system-test image - if: needs.prepare-config.outputs.ghcr_allowed == 'true' + if: needs.build-system-test.result == 'skipped' run: | - docker pull $SYSTEM_TEST_IMAGE + docker pull ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE + docker tag ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE $SYSTEM_TEST_IMAGE - - name: download artifact if no ghcr - if: needs.prepare-config.outputs.ghcr_allowed != 'true' + - name: download artifact if no registry + if: needs.build-system-test.result != 'skipped' && needs.prepare-config.outputs.registry_allowed != 'true' uses: actions/download-artifact@v4 with: name: image-system-test path: /tmp/ - - name: load system-test image if no ghcr - if: needs.prepare-config.outputs.ghcr_allowed != 'true' + - name: load system-test image if no registry + if: needs.build-system-test.result != 'skipped' && needs.prepare-config.outputs.registry_allowed != 'true' run: | docker load -i /tmp/image.tar - name: Start quickstart with rpc From f6efb85646ca4483fd765501549dda60bc93cc9b Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 18:22:33 -0700 Subject: [PATCH 10/60] add some debug output on artifact upload --- .github/workflows/test_ng.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 9ff4adc..e02e86b 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -280,7 +280,7 @@ jobs: - name: Publish system-test image if: needs.prepare-config.outputs.registry_allowed == 'true' run: | - dockder tag $SYSTEM_TEST_IMAGE ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE + docker tag $SYSTEM_TEST_IMAGE ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE docker push ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE - name: extract image to artifact when no registry @@ -324,6 +324,8 @@ jobs: if: needs.build-system-test.result != 'skipped' && needs.prepare-config.outputs.registry_allowed != 'true' run: | docker load -i /tmp/image.tar + docker images | grep system-test || true + - name: Start quickstart with rpc uses: stellar/quickstart@main with: From f6f73246fc15804e669818e593bafd9dfcade92c Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 19:03:04 -0700 Subject: [PATCH 11/60] add more debug output --- .github/workflows/test_ng.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index e02e86b..4393450 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -335,6 +335,7 @@ jobs: - name: Run system test scenarios run: | + docker images | grep system-test || true docker run \ --rm -t --name e2e_test $SYSTEM_TEST_IMAGE \ --VerboseOutput ${{ inputs.verbose-output }} \ From 2c18c7f3b6de616a75df78676a3b0c1ba5a4504e Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 20:13:59 -0700 Subject: [PATCH 12/60] run quickstart first as it resets docker context, then load system test to docker --- .github/workflows/test_ng.yml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 4393450..1859c4a 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -307,6 +307,12 @@ jobs: env: SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} steps: + - name: Start quickstart with rpc + uses: stellar/quickstart@main + with: + artifact: image-quickstart-rpc-custom-amd64.tar + tag: rpc-custom-amd64 + enable: core,rpc - name: download system-test image if: needs.build-system-test.result == 'skipped' run: | @@ -324,18 +330,9 @@ jobs: if: needs.build-system-test.result != 'skipped' && needs.prepare-config.outputs.registry_allowed != 'true' run: | docker load -i /tmp/image.tar - docker images | grep system-test || true - - name: Start quickstart with rpc - uses: stellar/quickstart@main - with: - artifact: image-quickstart-rpc-custom-amd64.tar - tag: rpc-custom-amd64 - enable: core,rpc - - name: Run system test scenarios run: | - docker images | grep system-test || true docker run \ --rm -t --name e2e_test $SYSTEM_TEST_IMAGE \ --VerboseOutput ${{ inputs.verbose-output }} \ From 786126cf1b93ee7bd47a17556e0e5d3992e0800b Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 23:09:03 -0700 Subject: [PATCH 13/60] add ddebug out on startup --- start | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/start b/start index ec09084..9a28408 100755 --- a/start +++ b/start @@ -151,6 +151,16 @@ function stellar_rpc_status () { }' | jq --exit-status '.result.status == "healthy"' 2>/dev/null | grep -o true || echo false ); do + + curl --location --request POST "$TARGET_NETWORK_RPC_URL" \ + --header 'Content-Type: application/json' \ + --data-raw '{ + "jsonrpc": "2.0", + "id": 10235, + "method": "getHealth" + + }' + if [ $(expr $COUNTER % 12) -eq 0 ]; then print_screen_output "waited $(expr $COUNTER / 12) minutes for Stellar RPC to report ready state..." fi From e844ce2c1ae9542fdeda1a71f967c42286d5014f Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 14 Oct 2025 23:17:54 -0700 Subject: [PATCH 14/60] use add-host to reference quickstart container ports from system test container --- .github/workflows/test_ng.yml | 1 + start | 12 +----------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test_ng.yml index 1859c4a..17cd653 100644 --- a/.github/workflows/test_ng.yml +++ b/.github/workflows/test_ng.yml @@ -334,6 +334,7 @@ jobs: - name: Run system test scenarios run: | docker run \ + --add-host=host.docker.internal:host-gateway \ --rm -t --name e2e_test $SYSTEM_TEST_IMAGE \ --VerboseOutput ${{ inputs.verbose-output }} \ --TargetNetworkRPCURL http://host.docker.internal:8000/rpc \ diff --git a/start b/start index 9a28408..aed88b6 100755 --- a/start +++ b/start @@ -151,22 +151,12 @@ function stellar_rpc_status () { }' | jq --exit-status '.result.status == "healthy"' 2>/dev/null | grep -o true || echo false ); do - - curl --location --request POST "$TARGET_NETWORK_RPC_URL" \ - --header 'Content-Type: application/json' \ - --data-raw '{ - "jsonrpc": "2.0", - "id": 10235, - "method": "getHealth" - - }' - if [ $(expr $COUNTER % 12) -eq 0 ]; then print_screen_output "waited $(expr $COUNTER / 12) minutes for Stellar RPC to report ready state..." fi COUNTER=$[$COUNTER +1] - if [ $COUNTER -gt 900 ]; then + if [ $COUNTER -gt 180 ]; then echo "Waited longer than 15 minutes for Stellar RPC, cancelling and exit." exit 1 fi From e8ce9e8824d70575f59c6fe063e5b88a6446c853 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Wed, 15 Oct 2025 11:01:50 -0700 Subject: [PATCH 15/60] #92: renamed new workflow to test-workflow --- .github/workflows/{test_ng.yml => test-workflow.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{test_ng.yml => test-workflow.yml} (100%) diff --git a/.github/workflows/test_ng.yml b/.github/workflows/test-workflow.yml similarity index 100% rename from .github/workflows/test_ng.yml rename to .github/workflows/test-workflow.yml From 4355789ff7d30cd57d53af5b6f7ce05f812002bd Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Wed, 15 Oct 2025 12:52:59 -0700 Subject: [PATCH 16/60] #92: refined registry allowed check for dockerhub --- .github/workflows/test-workflow.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 17cd653..e647ca3 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -126,12 +126,12 @@ jobs: images-config: ${{ steps.set-config.outputs.images }} system-test-image-cache-registry: ${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }} system-test-image-cached: "${{ env.SYSTEM_TEST_IMAGE}}_${{ steps.set-cache-key.outputs.cache-key }}" - registry_allowed: ${{ steps.check-fork.outputs.registry-allowed }} + registry_allowed: ${{ steps.check-registry.outputs.registry-allowed }} steps: - - id: check-fork + - id: check-registry name: Check if registry access is allowed run: | - if [ "${{ github.event_name }}" != "pull_request" ] || [ "${{ github.event.pull_request.head.repo.fork }}" == "false" ]; then + if [ "${{ secrets.DOCKERHUB_TOKEN }}" ]; then echo "registry-allowed=true" >> $GITHUB_OUTPUT else echo "registry-allowed=false" >> $GITHUB_OUTPUT @@ -275,8 +275,8 @@ jobs: uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} - username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }} - password: ${{ secrets.DOCKERHUB_TOKEN || github.token }} + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} - name: Publish system-test image if: needs.prepare-config.outputs.registry_allowed == 'true' run: | From d83626d4205097f4d9f9118827007ff5467f1e6e Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Wed, 15 Oct 2025 13:47:02 -0700 Subject: [PATCH 17/60] #92: fix check for absent docker creds --- .github/workflows/test-workflow.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index e647ca3..cf71ce4 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -131,10 +131,10 @@ jobs: - id: check-registry name: Check if registry access is allowed run: | - if [ "${{ secrets.DOCKERHUB_TOKEN }}" ]; then - echo "registry-allowed=true" >> $GITHUB_OUTPUT - else + if [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then echo "registry-allowed=false" >> $GITHUB_OUTPUT + else + echo "registry-allowed=true" >> $GITHUB_OUTPUT fi - id: set-cache-key run: | From 9305bc366a0adf3202cc3a1c9d6d7b8d5a14cb27 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 16 Oct 2025 11:51:51 -0700 Subject: [PATCH 18/60] fixed job filter to check for skipped due to image cache or success on image build when running tests --- .github/workflows/test-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index cf71ce4..75553a9 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -298,7 +298,7 @@ jobs: name: System tests needs: [build-system-test, build-quickstart, prepare-config] # Run if build-system-test succeeded OR was skipped because image is already in built(cache hit) - if: needs.build-system-test.result == 'success' || needs.build-system-test.result == 'skipped' + if: always() && (needs.build-system-test.result == 'success' || needs.build-system-test.result == 'skipped') strategy: matrix: From 68bf3978acbc17693f82e435f0189b9b65a28873 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 16 Oct 2025 13:43:16 -0700 Subject: [PATCH 19/60] #92: make rpc version an input variable and all input component names use ref term --- .github/workflows/test-workflow.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 75553a9..8174c22 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -73,7 +73,17 @@ on: required: false type: string default: "v23.0.1" + stellar-rpc-repo: + description: "The git repo URL to use for stellar-rpc" + required: false + type: string + default: "stellar/stellar-rpc" + stellar-rpc-version: + description: "Version of stellar-rpc to use" + required: false + type: string + default: "" horizon-version: description: "Version of horizon to use" required: false @@ -195,7 +205,7 @@ jobs: "deps": [ { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "${{ inputs.stellar-xdr-version }}" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "${{ inputs.stellar-core-version }}", "options": { "configure_flags": "--disable-tests" } }, - { "name": "rpc", "repo": "${{ github.repository }}", "ref": "${{ github.ref }}" }, + { "name": "rpc", "repo": "${{ inputs.stellar-rpc-repo }}", "ref": "${{ inputs.stellar-rpc-version }}" }, { "name": "horizon", "repo": "stellar/go", "ref": "${{ inputs.horizon-version }}" }, { "name": "friendbot", "repo": "stellar/go", "ref": "${{ inputs.horizon-version }}" }, { "name": "lab", "repo": "stellar/laboratory", "ref": "${{ inputs.lab-version }}" } From c71f463f70852211bb360715734a8cf090a20d8a Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 16 Oct 2025 13:57:43 -0700 Subject: [PATCH 20/60] #92: allow cli crate version input variable on workflow --- .github/workflows/test-workflow.yml | 105 ++++++++++++++-------------- 1 file changed, 53 insertions(+), 52 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 8174c22..4b8b37c 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -18,19 +18,24 @@ on: description: "the git ref (branch, tag, sha) to use for system-test" required: false type: string - default: master + default: master + stellar-cli-repo: + description: "The git repo for stellar-cli" + required: false + type: string + default: "stellar/stellar-cli" stellar-cli-ref: description: | - the soroban CLI source code to compile and run from system test - refers to checked out source of current GitHub ref context or branch + git ref of stellar cli software version to build required: false type: string - stellar-cli-version: + stellar-cli-crate-version: + description: | + version of stellar-cli crate to use, if not using git ref and repo required: false type: string - default: "23.0.0" test-filter: description: | @@ -44,15 +49,13 @@ on: js-stellar-sdk-npm-version: description: | set the version of js-stellar-sdk to use, need to choose one of either - resolution options, using npm release or a gh ref: - option #1, set the version of stellar-sdk based on a npm release version + resolution options, using this for npm release or a gh ref using js-stellar-sdk-gh-ref: required: false type: string - default: 14.0.0-rc.3 js-stellar-sdk-gh-repo: description: | - option #2, set the version of stellar-sdk based on a gh repo, e.g. stellar/js-stellar-sdk + set the version of stellar-sdk based on a gh repo, e.g. stellar/js-stellar-sdk if set, takes precedence over js-stellar-sdk-npm-version required: false type: string @@ -62,62 +65,55 @@ on: required: false type: string - stellar-xdr-version: - description: "Version of stellar-xdr to use" - required: false + stellar-xdr-ref: + description: "git ref of stellar-xdr to use" + required: true type: string - default: "v23.0.0" - stellar-core-version: - description: "Version of stellar-core to use" - required: false + stellar-core-ref: + description: "git ref of stellar-core to use" + required: true type: string - default: "v23.0.1" stellar-rpc-repo: - description: "The git repo URL to use for stellar-rpc" + description: "The git repo to use for stellar-rpc" required: false type: string default: "stellar/stellar-rpc" - stellar-rpc-version: - description: "Version of stellar-rpc to use" - required: false + stellar-rpc-ref: + description: "git ref of stellar-rpc to use" + required: true type: string - default: "" - horizon-version: - description: "Version of horizon to use" - required: false + + horizon-ref: + description: "git ref of horizon to use" + required: true type: string - default: "horizon-v23.0.0" - lab-version: - description: "Version of stellar laboratory to use" - required: false + lab-ref: + description: "git ref of stellar laboratory to use" + required: true type: string - default: "main" protocol-version: description: "Protocol version to use" - required: false + required: true type: string - default: "23" rust-toolchain-version: description: "Version of Rust toolchain to use in test runtime environment" - required: false + required: true type: string - default: "stable" verbose-output: required: false type: boolean default: true - soroban-examples-git-hash: + soroban-examples-ref: description: "The git ref (branch, tag, sha) to use for soroban-examples" - required: false + required: true type: string - default: "v22.0.1" soroban-examples-repo-url: description: "The git repo URL to use for soroban-examples" @@ -156,14 +152,12 @@ jobs: exit 1 fi - # Parse STELLAR_CLI_REF which is in format: URL#ref - CLI_URL_REF="${{ inputs.stellar-cli-ref }}" + CLI_REF="${{ inputs.stellar-cli-ref }}" + CLI_REPO="${{ inputs.stellar-cli-repo }}" - # Only fetch if stellar-cli-ref is provided - if [ -n "$CLI_URL_REF" ]; then - # Split on # to get URL and ref - CLI_URL=$(echo "$CLI_URL_REF" | cut -d'#' -f1) - CLI_REF=$(echo "$CLI_URL_REF" | cut -d'#' -f2) + # Only fetch if stellar-cli-ref and repo is provided + if [ -n "$CLI_REF" ] && [ -n "$CLI_REPO" ]; then + CLI_URL=https://github.com/$CLI_REPO STELLAR_CLI_SHA=$(git ls-remote "$CLI_URL" "$CLI_REF" | awk '{print $1}') if [ -z "$STELLAR_CLI_SHA" ]; then @@ -172,7 +166,7 @@ jobs: fi else # If no CLI ref provided - STELLAR_CLI_SHA="${{ inputs.stellar-cli-version }}" + STELLAR_CLI_SHA="${{ inputs.stellar-cli-crate-version }}" fi # Handle JS Stellar SDK @@ -203,12 +197,12 @@ jobs: "protocol_version_default": ${{ inputs.protocol-version }} }, "deps": [ - { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "${{ inputs.stellar-xdr-version }}" }, - { "name": "core", "repo": "stellar/stellar-core", "ref": "${{ inputs.stellar-core-version }}", "options": { "configure_flags": "--disable-tests" } }, - { "name": "rpc", "repo": "${{ inputs.stellar-rpc-repo }}", "ref": "${{ inputs.stellar-rpc-version }}" }, - { "name": "horizon", "repo": "stellar/go", "ref": "${{ inputs.horizon-version }}" }, - { "name": "friendbot", "repo": "stellar/go", "ref": "${{ inputs.horizon-version }}" }, - { "name": "lab", "repo": "stellar/laboratory", "ref": "${{ inputs.lab-version }}" } + { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "${{ inputs.stellar-xdr-ref }}" }, + { "name": "core", "repo": "stellar/stellar-core", "ref": "${{ inputs.stellar-core-ref }}", "options": { "configure_flags": "--disable-tests" } }, + { "name": "rpc", "repo": "${{ inputs.stellar-rpc-repo }}", "ref": "${{ inputs.stellar-rpc-ref }}" }, + { "name": "horizon", "repo": "stellar/go", "ref": "${{ inputs.horizon-ref }}" }, + { "name": "friendbot", "repo": "stellar/go", "ref": "${{ inputs.horizon-ref }}" }, + { "name": "lab", "repo": "stellar/laboratory", "ref": "${{ inputs.lab-ref }}" } ], "additional-tests": [] } @@ -274,8 +268,15 @@ jobs: else \ JS_STELLAR_SDK_REF="file:/home/tester/js-stellar-sdk"; \ fi + if [ -n "${{ inputs.stellar-cli-ref }}" ] && [ -n "${{ inputs.stellar-cli-repo }}" ]; then \ + STELLAR_CLI_GIT_REF="https://github.com/${{ inputs.stellar-cli-repo }}#${{ inputs.stellar-cli-ref }}"; \ + else \ + STELLAR_CLI_CRATE_VERSION="${{ inputs.stellar-cli-crate-version }}"; \ + fi + make \ - STELLAR_CLI_GIT_REF=${{ inputs.stellar-cli-ref }} \ + STELLAR_CLI_GIT_REF=$STELLAR_CLI_GIT_REF \ + STELLAR_CLI_CRATE_VERSION=$STELLAR_CLI_CRATE_VERSION \ RUST_TOOLCHAIN_VERSION=${{ inputs.rust-toolchain-version }} \ JS_STELLAR_SDK_NPM_VERSION=$JS_STELLAR_SDK_REF \ SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ From 77445f4a7f2961452876e030a1a6ed8ba919076c Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 16 Oct 2025 14:03:36 -0700 Subject: [PATCH 21/60] #92: consistent js stellar sdk gh input var names --- .github/workflows/test-workflow.yml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 4b8b37c..09faea4 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -49,18 +49,18 @@ on: js-stellar-sdk-npm-version: description: | set the version of js-stellar-sdk to use, need to choose one of either - resolution options, using this for npm release or a gh ref using js-stellar-sdk-gh-ref: + resolution options, using this for npm release or a gh ref using js-stellar-sdk-ref: required: false type: string - js-stellar-sdk-gh-repo: + js-stellar-sdk-repo: description: | set the version of stellar-sdk based on a gh repo, e.g. stellar/js-stellar-sdk if set, takes precedence over js-stellar-sdk-npm-version required: false type: string - js-stellar-sdk-gh-ref: + js-stellar-sdk-ref: description: "The git ref (branch, tag, sha) to use for js-stellar-sdk if using gh repo option" required: false type: string @@ -170,10 +170,10 @@ jobs: fi # Handle JS Stellar SDK - if [ -n "${{ inputs.js-stellar-sdk-gh-repo }}" ]; then - JS_SDK_PART=$(git ls-remote https://github.com/${{ inputs.js-stellar-sdk-gh-repo }} ${{ inputs.js-stellar-sdk-gh-ref }} | awk '{print $1}') + if [ -n "${{ inputs.js-stellar-sdk-repo }}" ]; then + JS_SDK_PART=$(git ls-remote https://github.com/${{ inputs.js-stellar-sdk-repo }} ${{ inputs.js-stellar-sdk-ref }} | awk '{print $1}') if [ -z "$JS_SDK_PART" ]; then - echo "Error: Could not find ref ${{ inputs.js-stellar-sdk-gh-ref }} in ${{ inputs.js-stellar-sdk-gh-repo }}" + echo "Error: Could not find ref ${{ inputs.js-stellar-sdk-ref }} in ${{ inputs.js-stellar-sdk-repo }}" exit 1 fi else @@ -246,16 +246,16 @@ jobs: ref: ${{ inputs.system-test-git-ref }} path: system-test - - if: inputs.js-stellar-sdk-gh-repo != '' + - if: inputs.js-stellar-sdk-repo != '' name: prepare local js-stellar-sdk run: | rm -rf $GITHUB_WORKSPACE/system-test/js-stellar-sdk; - - if: inputs.js-stellar-sdk-gh-repo != '' + - if: inputs.js-stellar-sdk-repo != '' uses: actions/checkout@v4 with: - repository: ${{ inputs.js-stellar-sdk-gh-repo }} - ref: ${{ inputs.js-stellar-sdk-gh-ref }} + repository: ${{ inputs.js-stellar-sdk-repo }} + ref: ${{ inputs.js-stellar-sdk-ref }} path: system-test/js-stellar-sdk - uses: stellar/actions/rust-cache@main @@ -263,7 +263,7 @@ jobs: - name: Build system test with component versions run: | cd $GITHUB_WORKSPACE/system-test - if [ -z "${{ inputs.js-stellar-sdk-gh-repo }}" ]; then \ + if [ -z "${{ inputs.js-stellar-sdk-repo }}" ]; then \ JS_STELLAR_SDK_REF="${{ inputs.js-stellar-sdk-npm-version }}"; \ else \ JS_STELLAR_SDK_REF="file:/home/tester/js-stellar-sdk"; \ From ab61d6d6ada77704ec7cb83b72ed7c52f970a10e Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 16 Oct 2025 14:19:55 -0700 Subject: [PATCH 22/60] #92: consistent input variable names for soroban examples repo/ref --- .github/workflows/test-workflow.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 09faea4..6c83239 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -115,11 +115,11 @@ on: required: true type: string - soroban-examples-repo-url: - description: "The git repo URL to use for soroban-examples" + soroban-examples-repo: + description: "The git repo to use for soroban-examples" required: false type: string - default: "https://github.com/stellar/soroban-examples" + default: "stellar/soroban-examples" env: SYSTEM_TEST_IMAGE: stellar/system-test:cache @@ -350,5 +350,5 @@ jobs: --VerboseOutput ${{ inputs.verbose-output }} \ --TargetNetworkRPCURL http://host.docker.internal:8000/rpc \ --TestFilter "${{ matrix.scenario-filter }}" \ - --SorobanExamplesGitHash ${{ inputs.soroban-examples-git-hash }} \ - --SorobanExamplesRepoURL ${{ inputs.soroban-examples-repo-url }} \ No newline at end of file + --SorobanExamplesGitHash ${{ inputs.soroban-examples-ref }} \ + --SorobanExamplesRepoURL https://github.com/${{ inputs.soroban-examples-repo }} \ No newline at end of file From f396c7aedb3feab06bf11c1f745a81defeddfb65 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Thu, 16 Oct 2025 14:38:28 -0700 Subject: [PATCH 23/60] #92: fixed cli repo docker git url for context format --- .github/workflows/test-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 6c83239..b5a85d8 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -269,7 +269,7 @@ jobs: JS_STELLAR_SDK_REF="file:/home/tester/js-stellar-sdk"; \ fi if [ -n "${{ inputs.stellar-cli-ref }}" ] && [ -n "${{ inputs.stellar-cli-repo }}" ]; then \ - STELLAR_CLI_GIT_REF="https://github.com/${{ inputs.stellar-cli-repo }}#${{ inputs.stellar-cli-ref }}"; \ + STELLAR_CLI_GIT_REF="https://github.com/${{ inputs.stellar-cli-repo }}.git#${{ inputs.stellar-cli-ref }}"; \ else \ STELLAR_CLI_CRATE_VERSION="${{ inputs.stellar-cli-crate-version }}"; \ fi From 6f8fddd4ab099153d79391952ee553b70f8f09c9 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Fri, 24 Oct 2025 16:28:35 -0700 Subject: [PATCH 24/60] #92: use gha caches for docker build layer caching --- .github/workflows/test-workflow.yml | 88 +++++++---------------------- Makefile | 17 +++++- 2 files changed, 35 insertions(+), 70 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index b5a85d8..68d65b1 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -2,11 +2,6 @@ name: Systems test workflow, next gen, uses quickstart pipelines on: workflow_call: - secrets: - DOCKERHUB_USERNAME: - required: false - DOCKERHUB_TOKEN: - required: false inputs: runner: description: "GitHub runner to use" @@ -123,25 +118,14 @@ on: env: SYSTEM_TEST_IMAGE: stellar/system-test:cache - SYSTEM_TEST_IMAGE_CACHE_REGISTRY: docker.io - + jobs: prepare-config: runs-on: ubuntu-latest outputs: images-config: ${{ steps.set-config.outputs.images }} - system-test-image-cache-registry: ${{ env.SYSTEM_TEST_IMAGE_CACHE_REGISTRY }} system-test-image-cached: "${{ env.SYSTEM_TEST_IMAGE}}_${{ steps.set-cache-key.outputs.cache-key }}" - registry_allowed: ${{ steps.check-registry.outputs.registry-allowed }} steps: - - id: check-registry - name: Check if registry access is allowed - run: | - if [ -z "${{ secrets.DOCKERHUB_TOKEN }}" ]; then - echo "registry-allowed=false" >> $GITHUB_OUTPUT - else - echo "registry-allowed=true" >> $GITHUB_OUTPUT - fi - id: set-cache-key run: | # Fetch commit SHAs for each dependency repo @@ -216,27 +200,9 @@ jobs: images: ${{ needs.prepare-config.outputs.images-config }} archs: '["amd64"]' - check-system-test-cache: - runs-on: ubuntu-latest - needs: prepare-config - outputs: - cache-hit: ${{ steps.check.outputs.exists }} - steps: - - id: check - name: Check if cached system-test image exists - run: | - if docker manifest inspect ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/${{ needs.prepare-config.outputs.system-test-image-cached }} > /dev/null 2>&1; then - echo "Image exists in registry" - echo "exists=true" >> $GITHUB_OUTPUT - else - echo "Image not found in registry" - echo "exists=false" >> $GITHUB_OUTPUT - fi - build-system-test: runs-on: ubuntu-latest-4-cores - needs: [prepare-config, check-system-test-cache] - if: needs.check-system-test-cache.outputs.cache-hit != 'true' + needs: [prepare-config] env: SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} steps: @@ -275,34 +241,20 @@ jobs: fi make \ + USE_GHA_CACHE=true \ STELLAR_CLI_GIT_REF=$STELLAR_CLI_GIT_REF \ STELLAR_CLI_CRATE_VERSION=$STELLAR_CLI_CRATE_VERSION \ RUST_TOOLCHAIN_VERSION=${{ inputs.rust-toolchain-version }} \ JS_STELLAR_SDK_NPM_VERSION=$JS_STELLAR_SDK_REF \ SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ build - - name: login to registry - if: needs.prepare-config.outputs.registry_allowed == 'true' - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 - with: - registry: ${{ needs.prepare-config.outputs.system-test-image-cache-registry }} - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Publish system-test image - if: needs.prepare-config.outputs.registry_allowed == 'true' - run: | - docker tag $SYSTEM_TEST_IMAGE ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE - docker push ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE - - - name: extract image to artifact when no registry - if: needs.prepare-config.outputs.registry_allowed != 'true' + - name: extract image to file run: | docker save $SYSTEM_TEST_IMAGE -o /tmp/image.tar - - name: save to artifact when no registry - if: needs.prepare-config.outputs.registry_allowed != 'true' - uses: actions/upload-artifact@v4 + - name: save file to cache + uses: actions/cache@v4 with: - name: image-system-test + key: ${{ env.SYSTEM_TEST_IMAGE }} path: /tmp/image.tar integration: @@ -324,21 +276,19 @@ jobs: artifact: image-quickstart-rpc-custom-amd64.tar tag: rpc-custom-amd64 enable: core,rpc - - name: download system-test image - if: needs.build-system-test.result == 'skipped' - run: | - docker pull ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE - docker tag ${{ needs.prepare-config.outputs.system-test-image-cache-registry }}/$SYSTEM_TEST_IMAGE $SYSTEM_TEST_IMAGE - - - name: download artifact if no registry - if: needs.build-system-test.result != 'skipped' && needs.prepare-config.outputs.registry_allowed != 'true' - uses: actions/download-artifact@v4 + - name: Get system-test image from cache + id: get-system-test-image + uses: actions/cache/restore/v4 with: - name: image-system-test - path: /tmp/ - - - name: load system-test image if no registry - if: needs.build-system-test.result != 'skipped' && needs.prepare-config.outputs.registry_allowed != 'true' + key: ${{ env.SYSTEM_TEST_IMAGE }} + path: /tmp/image.tar + - name: Fail if cache not found + run: | + if [ "${{ steps.get-system-test-image.outputs.cache-hit }}" != "true" ]; then + echo "Required cache key $SYSTEM_TEST_IMAGE not found, failing job." + exit 1 + fi + - name: load system-test image from cache file run: | docker load -i /tmp/image.tar diff --git a/Makefile b/Makefile index 44b7daa..ad3524a 100644 --- a/Makefile +++ b/Makefile @@ -37,6 +37,19 @@ RUST_TOOLCHAIN_VERSION=stable # the final image name that is created in local docker images store for system test SYSTEM_TEST_IMAGE=stellar/system-test:dev +# set to true to enable github actions cache for layer caching during build +USE_GHA_CACHE=false + +# github actions cache arguments for docker build +GHA_CACHE_ARGS=--cache-from=type=gha --cache-to=type=gha,mode=max,compression=zstd + +# set cache args based on USE_GHA_CACHE flag +ifeq ($(USE_GHA_CACHE),true) + CACHE_ARGS=$(GHA_CACHE_ARGS) +else + CACHE_ARGS= +endif + build-stellar-cli: if [ -z "$(STELLAR_CLI_IMAGE)" ]; then \ DOCKERHUB_RUST_VERSION=rust:$$( [ "$(RUST_TOOLCHAIN_VERSION)" = "stable" ] && echo "latest" || echo "$(RUST_TOOLCHAIN_VERSION)"); \ @@ -44,6 +57,7 @@ build-stellar-cli: --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg DOCKERHUB_RUST_VERSION="$$DOCKERHUB_RUST_VERSION" \ --build-arg STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ + $(CACHE_ARGS) \ -f- $(STELLAR_CLI_GIT_REF) < $(MAKEFILE_DIR)Dockerfile.stellar-cli; \ fi @@ -56,4 +70,5 @@ build: build-stellar-cli --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) \ - --label org.opencontainers.image.revision="$(SYSTEM_TEST_SHA)" .; + --label org.opencontainers.image.revision="$(SYSTEM_TEST_SHA)" \ + $(CACHE_ARGS) .; From ac79f9ff349656e2478603fd89ffd4c5fe5c1695 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Fri, 24 Oct 2025 16:51:37 -0700 Subject: [PATCH 25/60] #92: fix gha cache verstion syntax on step --- .github/workflows/test-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 68d65b1..3d5afc1 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -278,7 +278,7 @@ jobs: enable: core,rpc - name: Get system-test image from cache id: get-system-test-image - uses: actions/cache/restore/v4 + uses: actions/cache/restore@v4 with: key: ${{ env.SYSTEM_TEST_IMAGE }} path: /tmp/image.tar From 60f098c6dfb02800a0ff02ae076a81218a7f783c Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Fri, 24 Oct 2025 17:34:08 -0700 Subject: [PATCH 26/60] #92: remove unnecessary cache key creation --- .github/workflows/test-workflow.yml | 50 ++--------------------------- Makefile | 2 +- 2 files changed, 4 insertions(+), 48 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 3d5afc1..5caf8cf 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -124,52 +124,8 @@ jobs: runs-on: ubuntu-latest outputs: images-config: ${{ steps.set-config.outputs.images }} - system-test-image-cached: "${{ env.SYSTEM_TEST_IMAGE}}_${{ steps.set-cache-key.outputs.cache-key }}" + system-test-image: "${{ env.SYSTEM_TEST_IMAGE}}" steps: - - id: set-cache-key - run: | - # Fetch commit SHAs for each dependency repo - - SYSTEM_TEST_SHA=$(git ls-remote https://github.com/stellar/system-test ${{ inputs.system-test-git-ref }} | awk '{print $1}') - if [ -z "$SYSTEM_TEST_SHA" ]; then - echo "Error: Could not find ref ${{ inputs.system-test-git-ref }} in stellar/system-test" - exit 1 - fi - - CLI_REF="${{ inputs.stellar-cli-ref }}" - CLI_REPO="${{ inputs.stellar-cli-repo }}" - - # Only fetch if stellar-cli-ref and repo is provided - if [ -n "$CLI_REF" ] && [ -n "$CLI_REPO" ]; then - CLI_URL=https://github.com/$CLI_REPO - - STELLAR_CLI_SHA=$(git ls-remote "$CLI_URL" "$CLI_REF" | awk '{print $1}') - if [ -z "$STELLAR_CLI_SHA" ]; then - echo "Error: Could not find ref $CLI_REF in $CLI_URL" - exit 1 - fi - else - # If no CLI ref provided - STELLAR_CLI_SHA="${{ inputs.stellar-cli-crate-version }}" - fi - - # Handle JS Stellar SDK - if [ -n "${{ inputs.js-stellar-sdk-repo }}" ]; then - JS_SDK_PART=$(git ls-remote https://github.com/${{ inputs.js-stellar-sdk-repo }} ${{ inputs.js-stellar-sdk-ref }} | awk '{print $1}') - if [ -z "$JS_SDK_PART" ]; then - echo "Error: Could not find ref ${{ inputs.js-stellar-sdk-ref }} in ${{ inputs.js-stellar-sdk-repo }}" - exit 1 - fi - else - JS_SDK_PART="${{ inputs.js-stellar-sdk-npm-version }}" - fi - - # Create cache key by hashing all components - CACHE_INPUT="${SYSTEM_TEST_SHA}${STELLAR_CLI_SHA}${JS_SDK_PART}" - CACHE_KEY=$(echo -n "$CACHE_INPUT" | sha256sum | cut -c1-16) - echo "cache-key=${CACHE_KEY}" >> $GITHUB_OUTPUT - echo "Generated cache key: ${CACHE_KEY}" - - id: set-config run: | cat <> $GITHUB_OUTPUT @@ -204,7 +160,7 @@ jobs: runs-on: ubuntu-latest-4-cores needs: [prepare-config] env: - SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} + SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image }} steps: - uses: actions/checkout@v3 with: @@ -268,7 +224,7 @@ jobs: scenario-filter: ["${{ inputs.test-filter }}"] runs-on: ubuntu-latest env: - SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image-cached }} + SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image }} steps: - name: Start quickstart with rpc uses: stellar/quickstart@main diff --git a/Makefile b/Makefile index ad3524a..45040fa 100644 --- a/Makefile +++ b/Makefile @@ -63,7 +63,7 @@ build-stellar-cli: build: build-stellar-cli 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 \ + docker buildx build -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ --build-arg STELLAR_CLI_IMAGE_REF=$$STELLAR_CLI_IMAGE_REF \ From 405dab956e86fce934d1f4b5f822ff383cadcda6 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 27 Oct 2025 13:02:43 -0700 Subject: [PATCH 27/60] #92: use artifacts instead of cache for interim docker image for system test --- .github/workflows/test-workflow.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 5caf8cf..46e8c0c 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -207,10 +207,10 @@ jobs: - name: extract image to file run: | docker save $SYSTEM_TEST_IMAGE -o /tmp/image.tar - - name: save file to cache - uses: actions/cache@v4 + - name: save file to artifact + uses: actions/upload-artifact@v4 with: - key: ${{ env.SYSTEM_TEST_IMAGE }} + name: image-system-test path: /tmp/image.tar integration: @@ -232,19 +232,12 @@ jobs: artifact: image-quickstart-rpc-custom-amd64.tar tag: rpc-custom-amd64 enable: core,rpc - - name: Get system-test image from cache - id: get-system-test-image - uses: actions/cache/restore@v4 + - name: Download system-test image artifact + uses: actions/download-artifact@v4 with: - key: ${{ env.SYSTEM_TEST_IMAGE }} - path: /tmp/image.tar - - name: Fail if cache not found - run: | - if [ "${{ steps.get-system-test-image.outputs.cache-hit }}" != "true" ]; then - echo "Required cache key $SYSTEM_TEST_IMAGE not found, failing job." - exit 1 - fi - - name: load system-test image from cache file + name: image-system-test + path: /tmp/ + - name: load system-test image from artifact file run: | docker load -i /tmp/image.tar From 34febf8d2492fa0194240eaee4fd25cd2360acdb Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 12:45:32 -0800 Subject: [PATCH 28/60] #92: specify system-test repo for gha cache ownership --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 45040fa..62a0113 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ SYSTEM_TEST_IMAGE=stellar/system-test:dev USE_GHA_CACHE=false # github actions cache arguments for docker build -GHA_CACHE_ARGS=--cache-from=type=gha --cache-to=type=gha,mode=max,compression=zstd +GHA_CACHE_ARGS=--cache-from=type=gha,repository=stellar/system-test,scope=system-test-layer-cache --cache-to=type=gha,repository=stellar/system-test,scope=system-test-layer-cache,mode=max,compression=zstd # set cache args based on USE_GHA_CACHE flag ifeq ($(USE_GHA_CACHE),true) From 202124c0b71d69ca009d9e444b6aaaf21e803d91 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 13:19:35 -0800 Subject: [PATCH 29/60] #92: enable plain logging on docker build to see caching activity --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 62a0113..2d611e2 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ endif 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 "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \ + docker buildx build --progress=plain -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 STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ @@ -63,7 +63,7 @@ build-stellar-cli: build: build-stellar-cli STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ - docker buildx build -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ + docker buildx build --progress=plain -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ --build-arg STELLAR_CLI_IMAGE_REF=$$STELLAR_CLI_IMAGE_REF \ From eb1c902df1f491168a45c9825e16334ac91d6321 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 13:59:04 -0800 Subject: [PATCH 30/60] #92: dont' use repository param in gha caching, not effective --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 2d611e2..7a5949b 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ SYSTEM_TEST_IMAGE=stellar/system-test:dev USE_GHA_CACHE=false # github actions cache arguments for docker build -GHA_CACHE_ARGS=--cache-from=type=gha,repository=stellar/system-test,scope=system-test-layer-cache --cache-to=type=gha,repository=stellar/system-test,scope=system-test-layer-cache,mode=max,compression=zstd +GHA_CACHE_ARGS=--cache-from=type=gha,scope=system-test-layer-cache --cache-to=type=gha,scope=system-test-layer-cache,mode=max,compression=zstd # set cache args based on USE_GHA_CACHE flag ifeq ($(USE_GHA_CACHE),true) From ada2d32fa4ed618082ac8d6c10ed8fff38264c96 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 16:20:51 -0800 Subject: [PATCH 31/60] #92: dont' use gha docker buildx action --- .github/workflows/test-workflow.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 46e8c0c..13362fe 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -181,6 +181,7 @@ jobs: path: system-test/js-stellar-sdk - uses: stellar/actions/rust-cache@main + - uses: docker/setup-buildx-action@v3 - name: Build system test with component versions run: | From f2edf874a895c81f153bc6ad1bcc5acd3c83712f Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 16:40:04 -0800 Subject: [PATCH 32/60] #92: need --load for docker buildx to save to local repo --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7a5949b..9b1fc53 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ endif 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 --progress=plain -t "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \ + docker buildx build --progress=plain --load -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 STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ @@ -63,7 +63,7 @@ build-stellar-cli: build: build-stellar-cli STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ - docker buildx build --progress=plain -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ + docker buildx build --progress=plain --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ --build-arg STELLAR_CLI_IMAGE_REF=$$STELLAR_CLI_IMAGE_REF \ From b19e8bdd9f51ee2ab116ab48964e818b1f668ab0 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 18:06:53 -0800 Subject: [PATCH 33/60] #92: specify docker driver for buildx --- .github/workflows/test-workflow.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 13362fe..b639f61 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -182,6 +182,8 @@ jobs: - uses: stellar/actions/rust-cache@main - uses: docker/setup-buildx-action@v3 + with: + driver: docker # Use docker driver instead of default docker-container - name: Build system test with component versions run: | From 6509db3bb8e23ad2d09df33d0e60a32c0c8d884d Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 20:06:02 -0800 Subject: [PATCH 34/60] #92: use gha cache on ci test build --- .github/workflows/Dockerfile.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 0b0b573..5f88b6f 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -40,9 +40,12 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.HEAD_SHA }} + - uses: docker/setup-buildx-action@v3 + with: + driver: docker # Use docker driver instead of default docker-container - name: Build System Test Image run: | - make SOROBAN_CLI_GIT_REF=${{ env.SOROBAN_CLI_GIT_REF }} \ + make USE_GHA_CACHE=true \ SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ build; From 6df0d5ce3a87be481d0bf50ba7997731fd45fa8e Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 20:51:39 -0800 Subject: [PATCH 35/60] #92: added debug on buildx --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 9b1fc53..52cea84 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ endif 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 --progress=plain --load -t "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \ + docker buildx build --progress=plain --debug --load -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 STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ @@ -63,7 +63,7 @@ build-stellar-cli: build: build-stellar-cli STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ - docker buildx build --progress=plain --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ + docker buildx build --progress=plain --debug --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ --build-arg STELLAR_CLI_IMAGE_REF=$$STELLAR_CLI_IMAGE_REF \ From 272cc86f29eb2d4e3c218f9aaec364fca74d4aba Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 20:59:03 -0800 Subject: [PATCH 36/60] #92: corrected debug on buildx --- .github/workflows/Dockerfile.yml | 2 +- Makefile | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 5f88b6f..4fd5c53 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -45,7 +45,7 @@ jobs: driver: docker # Use docker driver instead of default docker-container - name: Build System Test Image run: | - make USE_GHA_CACHE=true \ + make BUILDX_DEBUG=1 USE_GHA_CACHE=true \ SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ build; diff --git a/Makefile b/Makefile index 52cea84..9b1fc53 100644 --- a/Makefile +++ b/Makefile @@ -53,7 +53,7 @@ endif 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 --progress=plain --debug --load -t "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \ + docker buildx build --progress=plain --load -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 STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ @@ -63,7 +63,7 @@ build-stellar-cli: build: build-stellar-cli STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ - docker buildx build --progress=plain --debug --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ + docker buildx build --progress=plain --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ --build-arg STELLAR_CLI_IMAGE_REF=$$STELLAR_CLI_IMAGE_REF \ From ff8a819c580d7e481ec0a6e8c45bc5c69cbbf8fa Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 21:10:40 -0800 Subject: [PATCH 37/60] #92: don't use equals on the buildx cache params --- .github/workflows/Dockerfile.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 4fd5c53..5f88b6f 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -45,7 +45,7 @@ jobs: driver: docker # Use docker driver instead of default docker-container - name: Build System Test Image run: | - make BUILDX_DEBUG=1 USE_GHA_CACHE=true \ + make USE_GHA_CACHE=true \ SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ build; diff --git a/Makefile b/Makefile index 9b1fc53..d9f5417 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ SYSTEM_TEST_IMAGE=stellar/system-test:dev USE_GHA_CACHE=false # github actions cache arguments for docker build -GHA_CACHE_ARGS=--cache-from=type=gha,scope=system-test-layer-cache --cache-to=type=gha,scope=system-test-layer-cache,mode=max,compression=zstd +GHA_CACHE_ARGS="--cache-from type=gha,scope=system-test-layer-cache --cache-to type=gha,scope=system-test-layer-cache,mode=max,compression=zstd" # set cache args based on USE_GHA_CACHE flag ifeq ($(USE_GHA_CACHE),true) From 9ec67782323a7a8f4719a6c52257309a459892b0 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 4 Nov 2025 21:12:33 -0800 Subject: [PATCH 38/60] #92: don't use quotes on makefile variable --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index d9f5417..f69ca3e 100644 --- a/Makefile +++ b/Makefile @@ -41,7 +41,7 @@ SYSTEM_TEST_IMAGE=stellar/system-test:dev USE_GHA_CACHE=false # github actions cache arguments for docker build -GHA_CACHE_ARGS="--cache-from type=gha,scope=system-test-layer-cache --cache-to type=gha,scope=system-test-layer-cache,mode=max,compression=zstd" +GHA_CACHE_ARGS=--cache-from type=gha,scope=system-test-layer-cache --cache-to type=gha,scope=system-test-layer-cache,mode=max,compression=zstd # set cache args based on USE_GHA_CACHE flag ifeq ($(USE_GHA_CACHE),true) From 8b77666ed27d18466766df934909682a7443463c Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Fri, 14 Nov 2025 16:26:04 -0800 Subject: [PATCH 39/60] #92: use new horizon and friendbot refs to quickstart flow --- .github/workflows/test-workflow.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index b639f61..f2e3116 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -81,10 +81,15 @@ on: type: string horizon-ref: - description: "git ref of horizon to use" + description: "git ref of stellar/stellar-horizon to use" required: true type: string + friendbot-ref: + description: "git ref of stellar/friendbot to use" + required: true + type: string + lab-ref: description: "git ref of stellar laboratory to use" required: true @@ -140,8 +145,8 @@ jobs: { "name": "xdr", "repo": "stellar/rs-stellar-xdr", "ref": "${{ inputs.stellar-xdr-ref }}" }, { "name": "core", "repo": "stellar/stellar-core", "ref": "${{ inputs.stellar-core-ref }}", "options": { "configure_flags": "--disable-tests" } }, { "name": "rpc", "repo": "${{ inputs.stellar-rpc-repo }}", "ref": "${{ inputs.stellar-rpc-ref }}" }, - { "name": "horizon", "repo": "stellar/go", "ref": "${{ inputs.horizon-ref }}" }, - { "name": "friendbot", "repo": "stellar/go", "ref": "${{ inputs.horizon-ref }}" }, + { "name": "horizon", "repo": "stellar/stellar-horizon", "ref": "${{ inputs.horizon-ref }}", "options": { "pkg": "github.com/stellar/stellar-horizon" } }, + { "name": "friendbot", "repo": "stellar/friendbot", "ref": "${{ inputs.friendbot-ref }}", "options": { "pkg": "github.com/stellar/friendbot" } }, { "name": "lab", "repo": "stellar/laboratory", "ref": "${{ inputs.lab-ref }}" } ], "additional-tests": [] From 68bbc32d6ebcf7fbc95ea8f413abaa56847103b6 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 10:22:31 -0800 Subject: [PATCH 40/60] #92: include crazy-max gha action to assist docker gha caching --- .github/workflows/Dockerfile.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 5f88b6f..473d536 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -40,6 +40,8 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.HEAD_SHA }} + - name: Expose GitHub Runtime + uses: crazy-max/ghaction-github-runtime@v3 - uses: docker/setup-buildx-action@v3 with: driver: docker # Use docker driver instead of default docker-container From 64ad22d68d667b461a00d0c29916eb7fa32d205a Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 10:31:17 -0800 Subject: [PATCH 41/60] #92: use docker container driver for buildx --- .github/workflows/Dockerfile.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 473d536..7546090 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -42,9 +42,7 @@ jobs: ref: ${{ env.HEAD_SHA }} - name: Expose GitHub Runtime uses: crazy-max/ghaction-github-runtime@v3 - - uses: docker/setup-buildx-action@v3 - with: - driver: docker # Use docker driver instead of default docker-container + - uses: docker/setup-buildx-action@v3 - name: Build System Test Image run: | make USE_GHA_CACHE=true \ From 0357394d300674b25e3418f3e658c41e40456a54 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 10:58:58 -0800 Subject: [PATCH 42/60] #92: fix getEvents endLedger requirement for latest v24 js sdk --- events.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/events.ts b/events.ts index 6095e93..2cd184c 100755 --- a/events.ts +++ b/events.ts @@ -29,6 +29,7 @@ async function main() { let response = await server.getEvents({ startLedger: Number(ledgerFrom), + endLedger: 0, filters: filters, limit: Number(size) }); From de79a026f66815f0ab738ab01bfb593671570690 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 15:11:18 -0800 Subject: [PATCH 43/60] #92: use docker-container driver for cache exports, oci export for cli image --- .github/workflows/test-workflow.yml | 2 ++ .gitignore | 1 + Makefile | 37 +++++++++++++++++++++++++---- 3 files changed, 36 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index f2e3116..8bb95b5 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -186,6 +186,8 @@ jobs: path: system-test/js-stellar-sdk - uses: stellar/actions/rust-cache@main + - name: Expose GitHub Runtime + uses: crazy-max/ghaction-github-runtime@v3 - uses: docker/setup-buildx-action@v3 with: driver: docker # Use docker driver instead of default docker-container diff --git a/.gitignore b/.gitignore index 74c80e4..3e5f133 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ systest.sublime-project systest.sublime-workspace .quickstart_repo node_modules/ +cli_oci_image diff --git a/Makefile b/Makefile index f69ca3e..564d1bc 100644 --- a/Makefile +++ b/Makefile @@ -40,12 +40,21 @@ SYSTEM_TEST_IMAGE=stellar/system-test:dev # set to true to enable github actions cache for layer caching during build USE_GHA_CACHE=false +# set to true to enable local directory cache for layer caching during build +USE_LOCAL_CACHE=false + # github actions cache arguments for docker build GHA_CACHE_ARGS=--cache-from type=gha,scope=system-test-layer-cache --cache-to type=gha,scope=system-test-layer-cache,mode=max,compression=zstd -# set cache args based on USE_GHA_CACHE flag +# local directory cache arguments for docker build +LOCAL_CACHE_ARGS=--cache-from type=local,src=/tmp/buildx-cache --cache-to type=local,dest=/tmp/buildx-cache,mode=max,compression=zstd + + +# set cache args based on USE_GHA_CACHE or USE_LOCAL_CACHE flag ifeq ($(USE_GHA_CACHE),true) CACHE_ARGS=$(GHA_CACHE_ARGS) +else ifeq ($(USE_LOCAL_CACHE),true) + CACHE_ARGS=$(LOCAL_CACHE_ARGS) else CACHE_ARGS= endif @@ -53,16 +62,32 @@ endif 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 --progress=plain --load -t "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \ + OUTPUT_ARG="--load"; \ + if [ -n "$(CACHE_ARGS)" ]; then \ + rm -rf $(MAKEFILE_DIR)cli_oci_image; \ + mkdir -p $(MAKEFILE_DIR)cli_oci_image; \ + OUTPUT_ARG="--output type=oci,dest=$(MAKEFILE_DIR)cli_oci_image.tar"; \ + fi; \ + docker buildx build --progress=plain $$OUTPUT_ARG -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 STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ $(CACHE_ARGS) \ -f- $(STELLAR_CLI_GIT_REF) < $(MAKEFILE_DIR)Dockerfile.stellar-cli; \ + if [ -n "$(CACHE_ARGS)" ]; then \ + tar -xf $(MAKEFILE_DIR)cli_oci_image.tar -C $(MAKEFILE_DIR)cli_oci_image; \ + rm $(MAKEFILE_DIR)cli_oci_image.tar; \ + fi; \ fi build: build-stellar-cli - STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ + if [ -z "$(STELLAR_CLI_IMAGE)" ] && [ -n "$(CACHE_ARGS)" ]; then \ + STELLAR_CLI_IMAGE_REF="cli_oci"; \ + BUILD_CONTEXT_ARG="--build-context cli_oci=oci-layout://$(MAKEFILE_DIR)cli_oci_image"; \ + else \ + STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ + BUILD_CONTEXT_ARG=""; \ + fi; \ docker buildx build --progress=plain --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ @@ -71,4 +96,8 @@ build: build-stellar-cli --build-arg NODE_VERSION=$(NODE_VERSION) \ --build-arg JS_STELLAR_SDK_NPM_VERSION=$(JS_STELLAR_SDK_NPM_VERSION) \ --label org.opencontainers.image.revision="$(SYSTEM_TEST_SHA)" \ - $(CACHE_ARGS) .; + $$BUILD_CONTEXT_ARG \ + $(CACHE_ARGS) .; \ + if [ -n "$(CACHE_ARGS)" ]; then \ + rm -rf $(MAKEFILE_DIR)cli_oci_image; \ + fi; From 25b5aec5c7d7c6fdcae1f9146043426000d42b34 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 15:25:35 -0800 Subject: [PATCH 44/60] #92: use docker-container for driver with buildx on callable workflow --- .github/workflows/test-workflow.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 8bb95b5..b5e81c2 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -189,9 +189,6 @@ jobs: - name: Expose GitHub Runtime uses: crazy-max/ghaction-github-runtime@v3 - uses: docker/setup-buildx-action@v3 - with: - driver: docker # Use docker driver instead of default docker-container - - name: Build system test with component versions run: | cd $GITHUB_WORKSPACE/system-test From 3ef80d1bad21aa46586b6b244c489a8c15c7c1a3 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 18:25:42 -0800 Subject: [PATCH 45/60] #92: focus on local buildx cache using incremental action cache keys --- .github/workflows/Dockerfile.yml | 91 +++++++++++++++++------------ .github/workflows/test-workflow.yml | 43 +++++++++----- Makefile | 12 +--- 3 files changed, 84 insertions(+), 62 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 7546090..73b8f2c 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -5,7 +5,7 @@ on: branches: - master tags: - - '*' + - "*" pull_request: release: types: [published] @@ -29,36 +29,51 @@ jobs: needs: [build] runs-on: ubuntu-latest steps: - - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') - run: exit 1 + - if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled') + run: exit 1 build: runs-on: ubuntu-latest-16-cores outputs: push_enabled: ${{ env.PUSH_ENABLED }} steps: - - uses: actions/checkout@v4 - with: - ref: ${{ env.HEAD_SHA }} - - name: Expose GitHub Runtime - uses: crazy-max/ghaction-github-runtime@v3 - - uses: docker/setup-buildx-action@v3 - - name: Build System Test Image - run: | - make USE_GHA_CACHE=true \ - SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ - JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ - build; - - if: ${{ env.PUSH_ENABLED == 'true' }} - name: Save Docker Image to file - run: | - docker save ${{ env.IMAGE }} -o /tmp/image; - - if: ${{ env.PUSH_ENABLED == 'true' }} - name: Upload System Test Image - uses: actions/upload-artifact@v4 - with: - name: image-Dockerfile - path: /tmp/image + - uses: actions/checkout@v4 + with: + ref: ${{ env.HEAD_SHA }} + - uses: docker/setup-buildx-action@v3 + + - name: Restore Docker buildx cache + uses: actions/cache/restore@v4 + with: + path: /tmp/buildx-cache + key: buildx-${{ runner.os }}-${{ github.sha }} + restore-keys: | + buildx-${{ runner.os }}- + + - name: Build System Test Image + run: | + make USE_LOCAL_CACHE=true \ + SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ + JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ + build; + + - name: Save Docker buildx cache + uses: actions/cache/save@v4 + if: always() + with: + path: /tmp/buildx-cache + key: buildx-${{ runner.os }}-${{ github.sha }} + + - if: ${{ env.PUSH_ENABLED == 'true' }} + name: Save Docker Image to file + run: | + docker save ${{ env.IMAGE }} -o /tmp/image; + - if: ${{ env.PUSH_ENABLED == 'true' }} + name: Upload System Test Image + uses: actions/upload-artifact@v4 + with: + name: image-Dockerfile + path: /tmp/image push: # Only push non 'vX.Y.Z' tags as pre-built system test image with versions compiled into image. @@ -71,16 +86,16 @@ jobs: runs-on: ubuntu-latest if: needs.build.outputs.push_enabled == 'true' steps: - - uses: actions/checkout@v4 - with: - ref: ${{ env.HEAD_SHA }} - - id: push - uses: ./.github/actions/push - with: - head_sha: ${{ env.HEAD_SHA }} - artifact_name: image-Dockerfile - artifact_image_file: image - image: ${{ env.IMAGE }} - registry: ${{ secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io' }} - username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }} - password: ${{ secrets.DOCKERHUB_TOKEN || github.token }} + - uses: actions/checkout@v4 + with: + ref: ${{ env.HEAD_SHA }} + - id: push + uses: ./.github/actions/push + with: + head_sha: ${{ env.HEAD_SHA }} + artifact_name: image-Dockerfile + artifact_image_file: image + image: ${{ env.IMAGE }} + registry: ${{ secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io' }} + username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }} + password: ${{ secrets.DOCKERHUB_TOKEN || github.token }} diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index b5e81c2..67383a6 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -58,7 +58,7 @@ on: js-stellar-sdk-ref: description: "The git ref (branch, tag, sha) to use for js-stellar-sdk if using gh repo option" required: false - type: string + type: string stellar-xdr-ref: description: "git ref of stellar-xdr to use" @@ -88,7 +88,7 @@ on: friendbot-ref: description: "git ref of stellar/friendbot to use" required: true - type: string + type: string lab-ref: description: "git ref of stellar laboratory to use" @@ -114,7 +114,7 @@ on: description: "The git ref (branch, tag, sha) to use for soroban-examples" required: true type: string - + soroban-examples-repo: description: "The git repo to use for soroban-examples" required: false @@ -155,11 +155,11 @@ jobs: DELIMITER EOF build-quickstart: - needs: prepare-config - uses: stellar/quickstart/.github/workflows/build.yml@main - with: - images: ${{ needs.prepare-config.outputs.images-config }} - archs: '["amd64"]' + needs: prepare-config + uses: stellar/quickstart/.github/workflows/build.yml@main + with: + images: ${{ needs.prepare-config.outputs.images-config }} + archs: '["amd64"]' build-system-test: runs-on: ubuntu-latest-4-cores @@ -186,9 +186,16 @@ jobs: path: system-test/js-stellar-sdk - uses: stellar/actions/rust-cache@main - - name: Expose GitHub Runtime - uses: crazy-max/ghaction-github-runtime@v3 - uses: docker/setup-buildx-action@v3 + + - name: Restore Docker buildx cache + uses: actions/cache/restore@v4 + with: + path: /tmp/buildx-cache + key: system-test-buildx-cache-${{ runner.os }}-${{ github.sha }} + restore-keys: | + system-test-buildx-cache-${{ runner.os }}- + - name: Build system test with component versions run: | cd $GITHUB_WORKSPACE/system-test @@ -204,13 +211,21 @@ jobs: fi make \ - USE_GHA_CACHE=true \ + USE_LOCAL_CACHE=true \ STELLAR_CLI_GIT_REF=$STELLAR_CLI_GIT_REF \ STELLAR_CLI_CRATE_VERSION=$STELLAR_CLI_CRATE_VERSION \ RUST_TOOLCHAIN_VERSION=${{ inputs.rust-toolchain-version }} \ JS_STELLAR_SDK_NPM_VERSION=$JS_STELLAR_SDK_REF \ SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ build + + - name: Save Docker buildx cache + uses: actions/cache/save@v4 + if: always() + with: + path: /tmp/buildx-cache + key: system-test-buildx-cache-${{ runner.os }}-${{ github.sha }} + - name: extract image to file run: | docker save $SYSTEM_TEST_IMAGE -o /tmp/image.tar @@ -225,7 +240,7 @@ jobs: needs: [build-system-test, build-quickstart, prepare-config] # Run if build-system-test succeeded OR was skipped because image is already in built(cache hit) if: always() && (needs.build-system-test.result == 'success' || needs.build-system-test.result == 'skipped') - + strategy: matrix: scenario-filter: ["${{ inputs.test-filter }}"] @@ -247,7 +262,7 @@ jobs: - name: load system-test image from artifact file run: | docker load -i /tmp/image.tar - + - name: Run system test scenarios run: | docker run \ @@ -257,4 +272,4 @@ jobs: --TargetNetworkRPCURL http://host.docker.internal:8000/rpc \ --TestFilter "${{ matrix.scenario-filter }}" \ --SorobanExamplesGitHash ${{ inputs.soroban-examples-ref }} \ - --SorobanExamplesRepoURL https://github.com/${{ inputs.soroban-examples-repo }} \ No newline at end of file + --SorobanExamplesRepoURL https://github.com/${{ inputs.soroban-examples-repo }} diff --git a/Makefile b/Makefile index 564d1bc..e585440 100644 --- a/Makefile +++ b/Makefile @@ -37,23 +37,15 @@ RUST_TOOLCHAIN_VERSION=stable # the final image name that is created in local docker images store for system test SYSTEM_TEST_IMAGE=stellar/system-test:dev -# set to true to enable github actions cache for layer caching during build -USE_GHA_CACHE=false - # set to true to enable local directory cache for layer caching during build USE_LOCAL_CACHE=false -# github actions cache arguments for docker build -GHA_CACHE_ARGS=--cache-from type=gha,scope=system-test-layer-cache --cache-to type=gha,scope=system-test-layer-cache,mode=max,compression=zstd - # local directory cache arguments for docker build LOCAL_CACHE_ARGS=--cache-from type=local,src=/tmp/buildx-cache --cache-to type=local,dest=/tmp/buildx-cache,mode=max,compression=zstd -# set cache args based on USE_GHA_CACHE or USE_LOCAL_CACHE flag -ifeq ($(USE_GHA_CACHE),true) - CACHE_ARGS=$(GHA_CACHE_ARGS) -else ifeq ($(USE_LOCAL_CACHE),true) +# set cache args based on USE_LOCAL_CACHE flag +ifeq ($(USE_LOCAL_CACHE),true) CACHE_ARGS=$(LOCAL_CACHE_ARGS) else CACHE_ARGS= From a3e28fc12514112680f02961302deec246e35aac Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 19:34:39 -0800 Subject: [PATCH 46/60] #92: trying to use volume mount from buildkit container to runner host for cache path --- .github/workflows/Dockerfile.yml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 73b8f2c..fa0776c 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -41,7 +41,8 @@ jobs: with: ref: ${{ env.HEAD_SHA }} - uses: docker/setup-buildx-action@v3 - + with: + install: true - name: Restore Docker buildx cache uses: actions/cache/restore@v4 with: @@ -49,7 +50,13 @@ jobs: key: buildx-${{ runner.os }}-${{ github.sha }} restore-keys: | buildx-${{ runner.os }}- - + - name: Ensure cache directory exists + run: mkdir -p /tmp/buildx-cache + - name: Manually create and use custom builder with volume mount to cache directory + run: | + docker buildx create --name custombuilder --driver docker-container \ + --use --bootstrap \ + -v /tmp/buildx-cache:/tmp/buildx-cache - name: Build System Test Image run: | make USE_LOCAL_CACHE=true \ @@ -59,7 +66,6 @@ jobs: - name: Save Docker buildx cache uses: actions/cache/save@v4 - if: always() with: path: /tmp/buildx-cache key: buildx-${{ runner.os }}-${{ github.sha }} From 3d776712f3a31b3dd40d5b926ede5ab9b87304de Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 20:20:08 -0800 Subject: [PATCH 47/60] #92: use driver-opt param for vol mount --- .github/workflows/Dockerfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index fa0776c..e19c51b 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -56,7 +56,7 @@ jobs: run: | docker buildx create --name custombuilder --driver docker-container \ --use --bootstrap \ - -v /tmp/buildx-cache:/tmp/buildx-cache + --driver-opt volume=/tmp/buildx-cache:/tmp/buildx-cache - name: Build System Test Image run: | make USE_LOCAL_CACHE=true \ From 5c4485d373fcb8c80d80cc91648c214d51cc1fa4 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 20:41:32 -0800 Subject: [PATCH 48/60] #92: run buildkitd container directly to specify vol mount to gha runner host cache dir --- .github/workflows/Dockerfile.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index e19c51b..12ffb24 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -52,11 +52,17 @@ jobs: buildx-${{ runner.os }}- - name: Ensure cache directory exists run: mkdir -p /tmp/buildx-cache - - name: Manually create and use custom builder with volume mount to cache directory + - name: Start custom BuildKit container (UNIX Socket) run: | - docker buildx create --name custombuilder --driver docker-container \ - --use --bootstrap \ - --driver-opt volume=/tmp/buildx-cache:/tmp/buildx-cache + docker run -d --name custom_buildkitd \ + --privileged \ + -v /tmp/buildx-cache:/tmp/buildx-cache \ + moby/buildkit:latest --addr unix:///run/buildkit/buildkitd.sock + - name: Create buildx builder instance (UNIX Socket) + run: | + docker buildx create --name custombuilder --driver remote unix:///tmp/buildkit-socket/buildkitd.sock --use + docker buildx inspect custombuilder --bootstrap + - name: Build System Test Image run: | make USE_LOCAL_CACHE=true \ From de1f98a306e66cdd418751923ce393358f13e09e Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 20:51:40 -0800 Subject: [PATCH 49/60] #92: fix unix socket name, don't use setup-buildx action, not needed --- .github/workflows/Dockerfile.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 12ffb24..f204a8a 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -40,9 +40,6 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.HEAD_SHA }} - - uses: docker/setup-buildx-action@v3 - with: - install: true - name: Restore Docker buildx cache uses: actions/cache/restore@v4 with: @@ -52,7 +49,7 @@ jobs: buildx-${{ runner.os }}- - name: Ensure cache directory exists run: mkdir -p /tmp/buildx-cache - - name: Start custom BuildKit container (UNIX Socket) + - name: Start custom BuildKit container with volume mount to gha runner(UNIX Socket) run: | docker run -d --name custom_buildkitd \ --privileged \ @@ -60,7 +57,7 @@ jobs: moby/buildkit:latest --addr unix:///run/buildkit/buildkitd.sock - name: Create buildx builder instance (UNIX Socket) run: | - docker buildx create --name custombuilder --driver remote unix:///tmp/buildkit-socket/buildkitd.sock --use + docker buildx create --name custombuilder --driver remote unix:///run/buildkit/buildkitd.sock --use docker buildx inspect custombuilder --bootstrap - name: Build System Test Image From e0eb6e5df2f23da8cdcef9709e905d5bb8fd3cab Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 21:03:21 -0800 Subject: [PATCH 50/60] #92: fix vol mounts for socket path on buildkitd run --- .github/workflows/Dockerfile.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index f204a8a..92851c0 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -48,16 +48,19 @@ jobs: restore-keys: | buildx-${{ runner.os }}- - name: Ensure cache directory exists - run: mkdir -p /tmp/buildx-cache + run: | + mkdir -p /tmp/buildx-cache + mkdir -p /tmp/buildkit-socket - name: Start custom BuildKit container with volume mount to gha runner(UNIX Socket) run: | docker run -d --name custom_buildkitd \ --privileged \ - -v /tmp/buildx-cache:/tmp/buildx-cache \ - moby/buildkit:latest --addr unix:///run/buildkit/buildkitd.sock + -v /tmp/buildkit-socket:/tmp/buildkit-socket \ + -v /tmp/buildx-cache:/tmp/buildx-cache \ + moby/buildkit:latest --addr unix:///tmp/buildkit-socket/buildkitd.sock - name: Create buildx builder instance (UNIX Socket) run: | - docker buildx create --name custombuilder --driver remote unix:///run/buildkit/buildkitd.sock --use + docker buildx create --name custombuilder --driver remote unix:///tmp/buildkit-socket/buildkitd.sock --use docker buildx inspect custombuilder --bootstrap - name: Build System Test Image From f91366a4e880c33699f1d9cf10ce9c47177668aa Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 21:15:55 -0800 Subject: [PATCH 51/60] #92: print logs of buildkit container start error --- .github/workflows/Dockerfile.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 92851c0..deb93f6 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -58,6 +58,16 @@ jobs: -v /tmp/buildkit-socket:/tmp/buildkit-socket \ -v /tmp/buildx-cache:/tmp/buildx-cache \ moby/buildkit:latest --addr unix:///tmp/buildkit-socket/buildkitd.sock + - name: Confirm custom_buildkitd is active + run: | + docker ps --filter name=custom_buildkitd + # Wait for the socket + timeout 30s bash -c 'while [ ! -S /tmp/buildkit-socket/buildkitd.sock ]; do sleep 0.5; done' + if [ $? -ne 0 ]; then + echo "Timeout reached. Printing container logs before exiting:" + docker logs custom_buildkitd + exit 1 # Explicitly fail the GHA step after printing logs + fi - name: Create buildx builder instance (UNIX Socket) run: | docker buildx create --name custombuilder --driver remote unix:///tmp/buildkit-socket/buildkitd.sock --use From 3fdc993171bbf6b1fe6fefe47459a9458296c188 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 21:38:13 -0800 Subject: [PATCH 52/60] #92: use tcp port for buildkitd instead of unix socket to gha runner --- .github/workflows/Dockerfile.yml | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index deb93f6..f1197c5 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -50,27 +50,34 @@ jobs: - name: Ensure cache directory exists run: | mkdir -p /tmp/buildx-cache - mkdir -p /tmp/buildkit-socket - - name: Start custom BuildKit container with volume mount to gha runner(UNIX Socket) + - name: Get free port for BuildKit daemon + id: get-port + run: | + # Find a free port by letting the OS assign one + PORT=$(python3 -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()') + echo "port=$PORT" >> $GITHUB_OUTPUT + echo "Using port: $PORT" + - name: Start custom BuildKit container with volume mount run: | docker run -d --name custom_buildkitd \ --privileged \ - -v /tmp/buildkit-socket:/tmp/buildkit-socket \ -v /tmp/buildx-cache:/tmp/buildx-cache \ - moby/buildkit:latest --addr unix:///tmp/buildkit-socket/buildkitd.sock + -p ${{ steps.get-port.outputs.port }}:${{ steps.get-port.outputs.port }} \ + moby/buildkit:latest --addr tcp://0.0.0.0:${{ steps.get-port.outputs.port }} - name: Confirm custom_buildkitd is active run: | docker ps --filter name=custom_buildkitd - # Wait for the socket - timeout 30s bash -c 'while [ ! -S /tmp/buildkit-socket/buildkitd.sock ]; do sleep 0.5; done' + # Wait for the TCP port to be ready + timeout 30s bash -c 'until nc -z localhost ${{ steps.get-port.outputs.port }}; do sleep 0.5; done' if [ $? -ne 0 ]; then echo "Timeout reached. Printing container logs before exiting:" docker logs custom_buildkitd - exit 1 # Explicitly fail the GHA step after printing logs + exit 1 fi - - name: Create buildx builder instance (UNIX Socket) + echo "BuildKit daemon is listening on port ${{ steps.get-port.outputs.port }}" + - name: Create buildx builder instance (TCP) run: | - docker buildx create --name custombuilder --driver remote unix:///tmp/buildkit-socket/buildkitd.sock --use + docker buildx create --name custombuilder --driver remote tcp://localhost:${{ steps.get-port.outputs.port }} --use docker buildx inspect custombuilder --bootstrap - name: Build System Test Image From 6b90e1f85c8d71d419f38a4aa80f8e0206847e7f Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Mon, 17 Nov 2025 22:42:09 -0800 Subject: [PATCH 53/60] #92: revert back to image file cache pattern for ci build --- .github/workflows/Dockerfile.yml | 65 ++++++++------------------------ 1 file changed, 16 insertions(+), 49 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index f1197c5..30190fa 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -40,69 +40,36 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ env.HEAD_SHA }} - - name: Restore Docker buildx cache + - name: Restore image cache + id: image-cache uses: actions/cache/restore@v4 with: - path: /tmp/buildx-cache - key: buildx-${{ runner.os }}-${{ github.sha }} - restore-keys: | - buildx-${{ runner.os }}- - - name: Ensure cache directory exists - run: | - mkdir -p /tmp/buildx-cache - - name: Get free port for BuildKit daemon - id: get-port - run: | - # Find a free port by letting the OS assign one - PORT=$(python3 -c 'import socket; s=socket.socket(); s.bind(("", 0)); print(s.getsockname()[1]); s.close()') - echo "port=$PORT" >> $GITHUB_OUTPUT - echo "Using port: $PORT" - - name: Start custom BuildKit container with volume mount - run: | - docker run -d --name custom_buildkitd \ - --privileged \ - -v /tmp/buildx-cache:/tmp/buildx-cache \ - -p ${{ steps.get-port.outputs.port }}:${{ steps.get-port.outputs.port }} \ - moby/buildkit:latest --addr tcp://0.0.0.0:${{ steps.get-port.outputs.port }} - - name: Confirm custom_buildkitd is active - run: | - docker ps --filter name=custom_buildkitd - # Wait for the TCP port to be ready - timeout 30s bash -c 'until nc -z localhost ${{ steps.get-port.outputs.port }}; do sleep 0.5; done' - if [ $? -ne 0 ]; then - echo "Timeout reached. Printing container logs before exiting:" - docker logs custom_buildkitd - exit 1 - fi - echo "BuildKit daemon is listening on port ${{ steps.get-port.outputs.port }}" - - name: Create buildx builder instance (TCP) - run: | - docker buildx create --name custombuilder --driver remote tcp://localhost:${{ steps.get-port.outputs.port }} --use - docker buildx inspect custombuilder --bootstrap - + path: /tmp/image.tar + key: systemtest-image-${{ runner.os }}-${{ github.sha }} - name: Build System Test Image + if: steps.image-cache.outputs.cache-hit != 'true' run: | - make USE_LOCAL_CACHE=true \ - SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ + make SYSTEM_TEST_IMAGE=${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} \ JS_STELLAR_SDK_NPM_VERSION=${{ env.JS_STELLAR_SDK_NPM_VERSION }} \ build; - - name: Save Docker buildx cache + - name: Save Docker Image to file + if: steps.image-cache.outputs.cache-hit != 'true' + run: | + docker save ${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} -o /tmp/image.tar + + - name: Save image cache + if: steps.image-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: /tmp/buildx-cache - key: buildx-${{ runner.os }}-${{ github.sha }} - - - if: ${{ env.PUSH_ENABLED == 'true' }} - name: Save Docker Image to file - run: | - docker save ${{ env.IMAGE }} -o /tmp/image; + path: /tmp/image.tar + key: systemtest-image-${{ runner.os }}-${{ github.sha }} - if: ${{ env.PUSH_ENABLED == 'true' }} name: Upload System Test Image uses: actions/upload-artifact@v4 with: name: image-Dockerfile - path: /tmp/image + path: /tmp/image.tar push: # Only push non 'vX.Y.Z' tags as pre-built system test image with versions compiled into image. From 1923043639a38e5927cfd63f07464bdfe4d876d4 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 10:24:31 -0800 Subject: [PATCH 54/60] #92: revert back to doing cache per image on callable workflow --- .github/workflows/Dockerfile.yml | 20 +++++-- .github/workflows/test-workflow.yml | 92 ++++++++++++++++++++++------- Makefile | 42 +------------ 3 files changed, 90 insertions(+), 64 deletions(-) diff --git a/.github/workflows/Dockerfile.yml b/.github/workflows/Dockerfile.yml index 30190fa..148f9d4 100644 --- a/.github/workflows/Dockerfile.yml +++ b/.github/workflows/Dockerfile.yml @@ -44,8 +44,14 @@ jobs: id: image-cache uses: actions/cache/restore@v4 with: - path: /tmp/image.tar + path: /tmp/image.tar.zst key: systemtest-image-${{ runner.os }}-${{ github.sha }} + + - name: Load cached Docker image + if: steps.image-cache.outputs.cache-hit == 'true' + run: | + zstd -d -c /tmp/image.tar.zst | docker load + - name: Build System Test Image if: steps.image-cache.outputs.cache-hit != 'true' run: | @@ -56,14 +62,20 @@ jobs: - name: Save Docker Image to file if: steps.image-cache.outputs.cache-hit != 'true' run: | - docker save ${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} -o /tmp/image.tar + docker save ${{ env.PUSH_ENABLED == 'true' && env.IMAGE || 'stellar/system-test:dev' }} | zstd -19 -o /tmp/image.tar.zst - name: Save image cache if: steps.image-cache.outputs.cache-hit != 'true' uses: actions/cache/save@v4 with: - path: /tmp/image.tar + path: /tmp/image.tar.zst key: systemtest-image-${{ runner.os }}-${{ github.sha }} + + - if: ${{ env.PUSH_ENABLED == 'true' }} + name: Decompress image for upload + run: | + zstd -d /tmp/image.tar.zst -o /tmp/image.tar + - if: ${{ env.PUSH_ENABLED == 'true' }} name: Upload System Test Image uses: actions/upload-artifact@v4 @@ -90,7 +102,7 @@ jobs: with: head_sha: ${{ env.HEAD_SHA }} artifact_name: image-Dockerfile - artifact_image_file: image + artifact_image_file: image.tar image: ${{ env.IMAGE }} registry: ${{ secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io' }} username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }} diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 67383a6..545066e 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -122,7 +122,8 @@ on: default: "stellar/soroban-examples" env: - SYSTEM_TEST_IMAGE: stellar/system-test:cache + SYSTEM_TEST_IMAGE: stellar/system-test:dev + STELLAR_CLI_STAGED_IMAGE: stellar/system-test-stellar-cli:dev jobs: prepare-config: @@ -130,7 +131,22 @@ jobs: outputs: images-config: ${{ steps.set-config.outputs.images }} system-test-image: "${{ env.SYSTEM_TEST_IMAGE}}" + stellar-cli-staged-image: "${{ env.STELLAR_CLI_STAGED_IMAGE}}" + cli-image-cache-key: ${{ steps.compute-cache-keys.outputs.cli-image-cache-key }} + system-test-image-cache-key: ${{ steps.compute-cache-keys.outputs.system-test-image-cache-key }} steps: + - id: compute-cache-keys + run: | + # Compute CLI image cache key + CLI_CACHE_INPUT="${{ runner.os }}-${{ inputs.stellar-cli-repo }}-${{ inputs.stellar-cli-ref }}-${{ inputs.stellar-cli-crate-version }}" + CLI_CACHE_KEY="cli-image-$(echo -n "$CLI_CACHE_INPUT" | sha256sum | cut -d' ' -f1)" + echo "cli-image-cache-key=$CLI_CACHE_KEY" >> $GITHUB_OUTPUT + + # Compute system test image cache key (includes CLI key + additional inputs) + SYSTEM_TEST_CACHE_INPUT="$CLI_CACHE_KEY-${{ inputs.js-stellar-sdk-repo }}-${{ inputs.js-stellar-sdk-ref }}-${{ inputs.js-stellar-sdk-npm-version }}-${{ inputs.rust-toolchain-version }}" + SYSTEM_TEST_CACHE_KEY="system-test-image-$(echo -n "$SYSTEM_TEST_CACHE_INPUT" | sha256sum | cut -d' ' -f1)" + echo "system-test-image-cache-key=$SYSTEM_TEST_CACHE_KEY" >> $GITHUB_OUTPUT + - id: set-config run: | cat <> $GITHUB_OUTPUT @@ -166,6 +182,7 @@ jobs: needs: [prepare-config] env: SYSTEM_TEST_IMAGE: ${{ needs.prepare-config.outputs.system-test-image }} + STELLAR_CLI_STAGED_IMAGE: ${{ needs.prepare-config.outputs.stellar-cli-staged-image }} steps: - uses: actions/checkout@v3 with: @@ -186,17 +203,33 @@ jobs: path: system-test/js-stellar-sdk - uses: stellar/actions/rust-cache@main - - uses: docker/setup-buildx-action@v3 - - - name: Restore Docker buildx cache + - name: Restore system test image cache + id: restore-system-test-image + uses: actions/cache/restore@v4 + with: + path: /tmp/system-test-image.tar.zst + key: ${{ needs.prepare-config.outputs.system-test-image-cache-key }} + + - name: Load cached system test image + if: steps.restore-system-test-image.outputs.cache-hit == 'true' + run: | + zstd -d -c /tmp/system-test-image.tar.zst | docker load + + - name: Restore cli image cache + if: steps.restore-system-test-image.outputs.cache-hit != 'true' + id: restore-cli-image uses: actions/cache/restore@v4 with: - path: /tmp/buildx-cache - key: system-test-buildx-cache-${{ runner.os }}-${{ github.sha }} - restore-keys: | - system-test-buildx-cache-${{ runner.os }}- + path: /tmp/cli-image.tar.zst + key: ${{ needs.prepare-config.outputs.cli-image-cache-key }} + + - name: Load cached cli image + if: steps.restore-cli-image.outputs.cache-hit == 'true' + run: | + zstd -d -c /tmp/cli-image.tar.zst | docker load - name: Build system test with component versions + if: steps.restore-system-test-image.outputs.cache-hit != 'true' run: | cd $GITHUB_WORKSPACE/system-test if [ -z "${{ inputs.js-stellar-sdk-repo }}" ]; then \ @@ -204,14 +237,19 @@ jobs: else \ JS_STELLAR_SDK_REF="file:/home/tester/js-stellar-sdk"; \ fi - if [ -n "${{ inputs.stellar-cli-ref }}" ] && [ -n "${{ inputs.stellar-cli-repo }}" ]; then \ - STELLAR_CLI_GIT_REF="https://github.com/${{ inputs.stellar-cli-repo }}.git#${{ inputs.stellar-cli-ref }}"; \ - else \ - STELLAR_CLI_CRATE_VERSION="${{ inputs.stellar-cli-crate-version }}"; \ + + if [ "${{ steps.restore-cli-image.outputs.cache-hit }}" == 'true' ]; then \ + STELLAR_CLI_IMAGE=$STELLAR_CLI_STAGED_IMAGE; \ + else + if [ -n "${{ inputs.stellar-cli-ref }}" ] && [ -n "${{ inputs.stellar-cli-repo }}" ]; then \ + STELLAR_CLI_GIT_REF="https://github.com/${{ inputs.stellar-cli-repo }}.git#${{ inputs.stellar-cli-ref }}"; \ + else \ + STELLAR_CLI_CRATE_VERSION="${{ inputs.stellar-cli-crate-version }}"; \ + fi fi - + make \ - USE_LOCAL_CACHE=true \ + STELLAR_CLI_IMAGE=$STELLAR_CLI_IMAGE \ STELLAR_CLI_GIT_REF=$STELLAR_CLI_GIT_REF \ STELLAR_CLI_CRATE_VERSION=$STELLAR_CLI_CRATE_VERSION \ RUST_TOOLCHAIN_VERSION=${{ inputs.rust-toolchain-version }} \ @@ -219,21 +257,33 @@ jobs: SYSTEM_TEST_IMAGE=$SYSTEM_TEST_IMAGE \ build - - name: Save Docker buildx cache + if [ "${{ steps.restore-cli-image.outputs.cache-hit }}" != 'true' ]; then \ + docker save $STELLAR_CLI_STAGED_IMAGE | zstd -19 -o /tmp/cli-image.tar.zst + fi + docker save $SYSTEM_TEST_IMAGE | zstd -19 -o /tmp/system-test-image.tar.zst + + - name: Save cache for cli uses: actions/cache/save@v4 - if: always() + if: steps.restore-cli-image.outputs.cache-hit != 'true' with: - path: /tmp/buildx-cache - key: system-test-buildx-cache-${{ runner.os }}-${{ github.sha }} + path: /tmp/cli-image.tar.zst + key: ${{ needs.prepare-config.outputs.cli-image-cache-key }} + - name: Save cache for system test image + uses: actions/cache/save@v4 + if: steps.restore-system-test-image.outputs.cache-hit != 'true' + with: + path: /tmp/system-test-image.tar.zst + key: ${{ needs.prepare-config.outputs.system-test-image-cache-key }} - - name: extract image to file + - name: Decompress system test image for artifact run: | - docker save $SYSTEM_TEST_IMAGE -o /tmp/image.tar + zstd -d /tmp/system-test-image.tar.zst -o /tmp/system-test-image.tar + - name: save file to artifact uses: actions/upload-artifact@v4 with: name: image-system-test - path: /tmp/image.tar + path: /tmp/system-test-image.tar integration: name: System tests diff --git a/Makefile b/Makefile index e585440..53987f2 100644 --- a/Makefile +++ b/Makefile @@ -37,49 +37,18 @@ RUST_TOOLCHAIN_VERSION=stable # the final image name that is created in local docker images store for system test SYSTEM_TEST_IMAGE=stellar/system-test:dev -# set to true to enable local directory cache for layer caching during build -USE_LOCAL_CACHE=false - -# local directory cache arguments for docker build -LOCAL_CACHE_ARGS=--cache-from type=local,src=/tmp/buildx-cache --cache-to type=local,dest=/tmp/buildx-cache,mode=max,compression=zstd - - -# set cache args based on USE_LOCAL_CACHE flag -ifeq ($(USE_LOCAL_CACHE),true) - CACHE_ARGS=$(LOCAL_CACHE_ARGS) -else - CACHE_ARGS= -endif - build-stellar-cli: if [ -z "$(STELLAR_CLI_IMAGE)" ]; then \ DOCKERHUB_RUST_VERSION=rust:$$( [ "$(RUST_TOOLCHAIN_VERSION)" = "stable" ] && echo "latest" || echo "$(RUST_TOOLCHAIN_VERSION)"); \ - OUTPUT_ARG="--load"; \ - if [ -n "$(CACHE_ARGS)" ]; then \ - rm -rf $(MAKEFILE_DIR)cli_oci_image; \ - mkdir -p $(MAKEFILE_DIR)cli_oci_image; \ - OUTPUT_ARG="--output type=oci,dest=$(MAKEFILE_DIR)cli_oci_image.tar"; \ - fi; \ - docker buildx build --progress=plain $$OUTPUT_ARG -t "$(STELLAR_CLI_STAGE_IMAGE)" --target builder \ + docker buildx build --progress=plain --load -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 STELLAR_CLI_CRATE_VERSION="$(STELLAR_CLI_CRATE_VERSION)" \ - $(CACHE_ARGS) \ -f- $(STELLAR_CLI_GIT_REF) < $(MAKEFILE_DIR)Dockerfile.stellar-cli; \ - if [ -n "$(CACHE_ARGS)" ]; then \ - tar -xf $(MAKEFILE_DIR)cli_oci_image.tar -C $(MAKEFILE_DIR)cli_oci_image; \ - rm $(MAKEFILE_DIR)cli_oci_image.tar; \ - fi; \ fi build: build-stellar-cli - if [ -z "$(STELLAR_CLI_IMAGE)" ] && [ -n "$(CACHE_ARGS)" ]; then \ - STELLAR_CLI_IMAGE_REF="cli_oci"; \ - BUILD_CONTEXT_ARG="--build-context cli_oci=oci-layout://$(MAKEFILE_DIR)cli_oci_image"; \ - else \ - STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ - BUILD_CONTEXT_ARG=""; \ - fi; \ + STELLAR_CLI_IMAGE_REF=$$( [ -z "$(STELLAR_CLI_IMAGE)" ] && echo "$(STELLAR_CLI_STAGE_IMAGE)" || echo "$(STELLAR_CLI_IMAGE)"); \ docker buildx build --progress=plain --load -t "$(SYSTEM_TEST_IMAGE)" -f Dockerfile \ --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true \ --build-arg STELLAR_CLI_CRATE_VERSION=$(STELLAR_CLI_CRATE_VERSION) \ @@ -87,9 +56,4 @@ build: build-stellar-cli --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) \ - --label org.opencontainers.image.revision="$(SYSTEM_TEST_SHA)" \ - $$BUILD_CONTEXT_ARG \ - $(CACHE_ARGS) .; \ - if [ -n "$(CACHE_ARGS)" ]; then \ - rm -rf $(MAKEFILE_DIR)cli_oci_image; \ - fi; + --label org.opencontainers.image.revision="$(SYSTEM_TEST_SHA)" .; \ From 92ba87e73e4a31da9a7fc482e83bebd6c3ec5ead Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 11:15:46 -0800 Subject: [PATCH 55/60] #92: pass the compressed image tar from build to run job --- .github/workflows/test-workflow.yml | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 545066e..bf1d4ee 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -209,12 +209,6 @@ jobs: with: path: /tmp/system-test-image.tar.zst key: ${{ needs.prepare-config.outputs.system-test-image-cache-key }} - - - name: Load cached system test image - if: steps.restore-system-test-image.outputs.cache-hit == 'true' - run: | - zstd -d -c /tmp/system-test-image.tar.zst | docker load - - name: Restore cli image cache if: steps.restore-system-test-image.outputs.cache-hit != 'true' id: restore-cli-image @@ -274,16 +268,11 @@ jobs: with: path: /tmp/system-test-image.tar.zst key: ${{ needs.prepare-config.outputs.system-test-image-cache-key }} - - - name: Decompress system test image for artifact - run: | - zstd -d /tmp/system-test-image.tar.zst -o /tmp/system-test-image.tar - - name: save file to artifact uses: actions/upload-artifact@v4 with: name: image-system-test - path: /tmp/system-test-image.tar + path: /tmp/system-test-image.tar.zst integration: name: System tests @@ -311,7 +300,7 @@ jobs: path: /tmp/ - name: load system-test image from artifact file run: | - docker load -i /tmp/image.tar + zstd -d -c /tmp/system-test-image.tar.zst | docker load - name: Run system test scenarios run: | From 5c006645e51b11aa31e73e4317ddfaab390ff4f9 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 11:26:06 -0800 Subject: [PATCH 56/60] #92: added console output for compression stats on image files --- .github/workflows/test-workflow.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index bf1d4ee..2ae259a 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -252,9 +252,15 @@ jobs: build if [ "${{ steps.restore-cli-image.outputs.cache-hit }}" != 'true' ]; then \ - docker save $STELLAR_CLI_STAGED_IMAGE | zstd -19 -o /tmp/cli-image.tar.zst - fi + echo "Starting CLI image extract and compression..."; \ + docker save $STELLAR_CLI_STAGED_IMAGE | zstd -19 -o /tmp/cli-image.tar.zst; \ + CLI_SIZE=$(stat -f%z /tmp/cli-image.tar.zst 2>/dev/null || stat -c%s /tmp/cli-image.tar.zst 2>/dev/null); \ + echo "Finished CLI image extract, compressed size = $CLI_SIZE bytes"; \ + fi + echo "Starting system test image extract and compression..." docker save $SYSTEM_TEST_IMAGE | zstd -19 -o /tmp/system-test-image.tar.zst + SYSTEM_SIZE=$(stat -f%z /tmp/system-test-image.tar.zst 2>/dev/null || stat -c%s /tmp/system-test-image.tar.zst 2>/dev/null) + echo "Finished system test image extract, compressed size = $SYSTEM_SIZE bytes" - name: Save cache for cli uses: actions/cache/save@v4 From 4316c541edaafb3a15a25b377f8fb18b58c224fa Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 11:46:49 -0800 Subject: [PATCH 57/60] #92 use lower compression ration on image files for faster time --- .github/workflows/test-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 2ae259a..3253867 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -253,12 +253,12 @@ jobs: if [ "${{ steps.restore-cli-image.outputs.cache-hit }}" != 'true' ]; then \ echo "Starting CLI image extract and compression..."; \ - docker save $STELLAR_CLI_STAGED_IMAGE | zstd -19 -o /tmp/cli-image.tar.zst; \ + docker save $STELLAR_CLI_STAGED_IMAGE | zstd -10 -o /tmp/cli-image.tar.zst; \ CLI_SIZE=$(stat -f%z /tmp/cli-image.tar.zst 2>/dev/null || stat -c%s /tmp/cli-image.tar.zst 2>/dev/null); \ echo "Finished CLI image extract, compressed size = $CLI_SIZE bytes"; \ fi echo "Starting system test image extract and compression..." - docker save $SYSTEM_TEST_IMAGE | zstd -19 -o /tmp/system-test-image.tar.zst + docker save $SYSTEM_TEST_IMAGE | zstd -10 -o /tmp/system-test-image.tar.zst SYSTEM_SIZE=$(stat -f%z /tmp/system-test-image.tar.zst 2>/dev/null || stat -c%s /tmp/system-test-image.tar.zst 2>/dev/null) echo "Finished system test image extract, compressed size = $SYSTEM_SIZE bytes" From 4a6862eba39e66105ce58a222c84fe5b071e9067 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 12:14:16 -0800 Subject: [PATCH 58/60] #92 console verbose logging on compression status --- .github/workflows/test-workflow.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 3253867..7f30bec 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -253,12 +253,12 @@ jobs: if [ "${{ steps.restore-cli-image.outputs.cache-hit }}" != 'true' ]; then \ echo "Starting CLI image extract and compression..."; \ - docker save $STELLAR_CLI_STAGED_IMAGE | zstd -10 -o /tmp/cli-image.tar.zst; \ + docker save $STELLAR_CLI_STAGED_IMAGE | zstd -vv -10 -o /tmp/cli-image.tar.zst; \ CLI_SIZE=$(stat -f%z /tmp/cli-image.tar.zst 2>/dev/null || stat -c%s /tmp/cli-image.tar.zst 2>/dev/null); \ echo "Finished CLI image extract, compressed size = $CLI_SIZE bytes"; \ fi echo "Starting system test image extract and compression..." - docker save $SYSTEM_TEST_IMAGE | zstd -10 -o /tmp/system-test-image.tar.zst + docker save $SYSTEM_TEST_IMAGE | zstd -vv -10 -o /tmp/system-test-image.tar.zst SYSTEM_SIZE=$(stat -f%z /tmp/system-test-image.tar.zst 2>/dev/null || stat -c%s /tmp/system-test-image.tar.zst 2>/dev/null) echo "Finished system test image extract, compressed size = $SYSTEM_SIZE bytes" From 16aa20c6d9be6c5fa0c662a3d0f20db729bd56c9 Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 14:28:18 -0800 Subject: [PATCH 59/60] #92: include the git ref for system-test version in the hashed system-test image cache key --- .github/workflows/test-workflow.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index 7f30bec..b50ec41 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -143,7 +143,7 @@ jobs: echo "cli-image-cache-key=$CLI_CACHE_KEY" >> $GITHUB_OUTPUT # Compute system test image cache key (includes CLI key + additional inputs) - SYSTEM_TEST_CACHE_INPUT="$CLI_CACHE_KEY-${{ inputs.js-stellar-sdk-repo }}-${{ inputs.js-stellar-sdk-ref }}-${{ inputs.js-stellar-sdk-npm-version }}-${{ inputs.rust-toolchain-version }}" + SYSTEM_TEST_CACHE_INPUT="$CLI_CACHE_KEY-${{ inputs.js-stellar-sdk-repo }}-${{ inputs.js-stellar-sdk-ref }}-${{ inputs.js-stellar-sdk-npm-version }}-${{ inputs.rust-toolchain-version }}-${{ inputs.system-test-git-ref }}" SYSTEM_TEST_CACHE_KEY="system-test-image-$(echo -n "$SYSTEM_TEST_CACHE_INPUT" | sha256sum | cut -d' ' -f1)" echo "system-test-image-cache-key=$SYSTEM_TEST_CACHE_KEY" >> $GITHUB_OUTPUT From df2e9f4fecc25a789d1c027f28269af0730ccaee Mon Sep 17 00:00:00 2001 From: Shawn Reuland Date: Tue, 18 Nov 2025 14:55:43 -0800 Subject: [PATCH 60/60] #92: resolve component refs to shas for cache keys --- .github/workflows/test-workflow.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-workflow.yml b/.github/workflows/test-workflow.yml index b50ec41..7397b8c 100644 --- a/.github/workflows/test-workflow.yml +++ b/.github/workflows/test-workflow.yml @@ -137,13 +137,34 @@ jobs: steps: - id: compute-cache-keys run: | + # Helper function to resolve ref to commit SHA + get_commit_sha() { + local repo="$1" + local ref="$2" + + # Return empty if either repo or ref is blank + if [ -z "$repo" ] || [ -z "$ref" ]; then + echo "" + return + fi + + # Fetch the commit SHA for the ref (works for branches, tags, and SHAs) + local sha=$(git ls-remote "https://github.com/$repo.git" "$ref" 2>/dev/null | cut -f1) + echo "${sha:-$ref}" + } + + # Resolve commit SHAs for cache key stability + CLI_SHA=$(get_commit_sha "${{ inputs.stellar-cli-repo }}" "${{ inputs.stellar-cli-ref }}") + JS_SDK_SHA=$(get_commit_sha "${{ inputs.js-stellar-sdk-repo }}" "${{ inputs.js-stellar-sdk-ref }}") + SYSTEM_TEST_SHA=$(get_commit_sha "stellar/system-test" "${{ inputs.system-test-git-ref }}") + # Compute CLI image cache key - CLI_CACHE_INPUT="${{ runner.os }}-${{ inputs.stellar-cli-repo }}-${{ inputs.stellar-cli-ref }}-${{ inputs.stellar-cli-crate-version }}" + CLI_CACHE_INPUT="${{ runner.os }}-${{ inputs.stellar-cli-repo }}-$CLI_SHA-${{ inputs.stellar-cli-crate-version }}" CLI_CACHE_KEY="cli-image-$(echo -n "$CLI_CACHE_INPUT" | sha256sum | cut -d' ' -f1)" echo "cli-image-cache-key=$CLI_CACHE_KEY" >> $GITHUB_OUTPUT # Compute system test image cache key (includes CLI key + additional inputs) - SYSTEM_TEST_CACHE_INPUT="$CLI_CACHE_KEY-${{ inputs.js-stellar-sdk-repo }}-${{ inputs.js-stellar-sdk-ref }}-${{ inputs.js-stellar-sdk-npm-version }}-${{ inputs.rust-toolchain-version }}-${{ inputs.system-test-git-ref }}" + SYSTEM_TEST_CACHE_INPUT="$CLI_CACHE_KEY-${{ inputs.js-stellar-sdk-repo }}-$JS_SDK_SHA-${{ inputs.js-stellar-sdk-npm-version }}-${{ inputs.rust-toolchain-version }}-$SYSTEM_TEST_SHA" SYSTEM_TEST_CACHE_KEY="system-test-image-$(echo -n "$SYSTEM_TEST_CACHE_INPUT" | sha256sum | cut -d' ' -f1)" echo "system-test-image-cache-key=$SYSTEM_TEST_CACHE_KEY" >> $GITHUB_OUTPUT