Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions .github/workflows/Dockerfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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: |
Expand Down
317 changes: 317 additions & 0 deletions .github/workflows/test_ng.yml
Original file line number Diff line number Diff line change
@@ -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 <<EOF >> $GITHUB_OUTPUT
images<<DELIMITER
[
{
"tag": "rpc-custom",
"config": {
"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": "${{ github.repository }}", "ref": "${{ github.ref }}" },
{ "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 }}" }
],
"additional-tests": []
}
]
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"]'

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-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'
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 }}
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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"]
Expand All @@ -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 \
Expand Down
Loading