Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

added test solana programs #284

Merged
Merged
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
9 changes: 6 additions & 3 deletions .github/workflows/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,16 +105,19 @@ def run_subprocess(command):
@cli.command(name="run_tests")
@click.option('--github_sha')
@click.option('--neon_test_branch')
def run_tests(github_sha, neon_test_branch):
@click.option('--base_ref_branch')
def run_tests(github_sha, neon_test_branch, base_ref_branch):
os.environ["EVM_LOADER_IMAGE"] = f"{IMAGE_NAME}:{github_sha}"

if neon_test_branch in GithubClient.get_branches_list(NEON_TESTS_ENDPOINT) \
if GithubClient.is_branch_exist(NEON_TESTS_ENDPOINT, neon_test_branch) \
and neon_test_branch not in ('master', 'develop'):
neon_test_image_tag = neon_test_branch
elif re.match(VERSION_BRANCH_TEMPLATE, base_ref_branch): # PR to version branch
neon_test_image_tag = base_ref_branch
else:
neon_test_image_tag = 'latest'
os.environ["NEON_TESTS_IMAGE"] = f"{NEON_TEST_IMAGE_NAME}:{neon_test_image_tag}"

click.echo(f"NEON_TESTS_IMAGE: {os.environ['NEON_TESTS_IMAGE']}")
project_name = f"neon-evm-{github_sha}"
stop_containers(project_name)

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/github_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ def get_branches_list(endpoint):
proxy_branches_obj = requests.get(
f"{endpoint}/branches?per_page=100").json()
return [item["name"] for item in proxy_branches_obj]
@staticmethod
def is_branch_exist(endpoint, branch):
if branch:
response = requests.get(f"{endpoint}/branches/{branch}")
if response.status_code == 200:
click.echo(f"The branch {branch} exist in the {endpoint} repository")
return True
else:
return False

def get_proxy_run_info(self, id):
response = requests.get(
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
elif [[ "${{ steps.tag_creation.outputs.base_branch }}" != "" ]]; then # tag creation
tag=${{ steps.tag_creation.outputs.base_branch }}

elif [[ "${{ github.head_ref }}" != "" ]]; then # pr to feature or version branch
elif [[ "${{ github.head_ref }}" != "" ]]; then # pr to feature or version branch or develop
tag=${{ github.head_ref }}
else
tag='develop'
Expand All @@ -75,7 +75,8 @@ jobs:
run: |
python3 ./.github/workflows/deploy.py run_tests \
--github_sha=${GITHUB_SHA} \
--neon_test_branch=${{ steps.neon_test_branch.outputs.value }}
--neon_test_branch=${{ steps.neon_test_branch.outputs.value }} \
--base_ref_branch=${{ github.base_ref }}
trigger-proxy-tests:
runs-on: trigger-runner
needs:
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ RUN cargo fmt --check && \


# Add neon_test_invoke_program to the genesis
FROM neonlabsorg/neon_test_invoke_program:develop AS neon_test_invoke_program
FROM neonlabsorg/neon_test_programs:latest AS neon_test_programs

# Define solana-image that contains utility
FROM builder AS base
Expand All @@ -40,8 +40,8 @@ COPY --from=evm-loader-builder /opt/neon-evm/evm_loader/target/deploy/evm_loader
COPY --from=evm-loader-builder /opt/neon-evm/evm_loader/target/deploy/evm_loader-dump.txt /opt/
COPY --from=evm-loader-builder /opt/neon-evm/evm_loader/target/release/neon-cli /opt/
COPY --from=evm-loader-builder /opt/neon-evm/evm_loader/target/release/neon-api /opt/
COPY --from=neon_test_invoke_program /opt/neon_test_invoke_program.so /opt/
COPY --from=neon_test_invoke_program /opt/neon_test_invoke_program-keypair.json /opt/

COPY --from=neon_test_programs /opt/deploy/ /opt/deploy/

COPY ci/wait-for-solana.sh \
ci/wait-for-neon.sh \
Expand Down
12 changes: 8 additions & 4 deletions ci/solana-run-neon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ EVM_LOADER_PATH=${NEON_BIN}/evm_loader.so
METAPLEX=metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s
METAPLEX_PATH=${NEON_BIN}/metaplex.so

TEST_INVOKE_PROGRAM_ID_KEYPAIR=${NEON_BIN}/neon_test_invoke_program-keypair.json
TEST_INVOKE=$(solana address -k ${TEST_INVOKE_PROGRAM_ID_KEYPAIR})
TEST_INVOKE_PATH=${NEON_BIN}/neon_test_invoke_program.so

VALIDATOR_ARGS=(
--reset
Expand All @@ -23,9 +20,16 @@ VALIDATOR_ARGS=(
--ticks-per-slot 16
--upgradeable-program ${EVM_LOADER} ${EVM_LOADER_PATH} ${EVM_LOADER_AUTHORITY_KEYPAIR}
--bpf-program ${METAPLEX} ${METAPLEX_PATH}
--bpf-program ${TEST_INVOKE} ${TEST_INVOKE_PATH}
)

LIST_OF_TEST_PROGRAMS=("test_invoke_program" "counter" "cross_program_invocation" "transfer_sol" "transfer_tokens")

for program in "${LIST_OF_TEST_PROGRAMS[@]}"; do
keypair="${NEON_BIN}/deploy/${program}/${program}-keypair.json"
address=$(solana address -k $keypair)
VALIDATOR_ARGS+=(--bpf-program $address ${NEON_BIN}/deploy/$program/$program.so)
done

if [[ -n $GEYSER_PLUGIN_CONFIG ]]; then
echo "Using geyser plugin with config: $GEYSER_PLUGIN_CONFIG"
VALIDATOR_ARGS+=(--geyser-plugin-config $GEYSER_PLUGIN_CONFIG)
Expand Down
Loading