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

A0-2349: Test access to dot cargo [do not merge] #37

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
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
28 changes: 28 additions & 0 deletions .github/workflows/integration_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: E2E Shielder tests.

on:
pull_request:
push:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: true

jobs:
rust-checks:
runs-on: self-hosted
steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Install Rust toolchain
uses: actions-rs/toolchain@v1

- name: Install WASM target
run: rustup target add wasm32-unknown-unknown

- name: Run e2e tests for shielder
run: |
cd shielder && make test-shielder-clean
4 changes: 1 addition & 3 deletions shielder/cli/tests/setup_local.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ get_timestamp() {
}

log_progress() {
bold=$(tput bold)
normal=$(tput sgr0)
echo "[$(get_timestamp)] [INFO] ${bold}${1}${normal}"
echo "[$(get_timestamp)] [INFO] ${1}"
}

function setup_testdir() {
Expand Down
31 changes: 27 additions & 4 deletions shielder/deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ set -euo pipefail

# Check if run in e2e shielder test context. Defaults to unset.
E2E_TEST_CONTEXT=${E2E_TEST:-}
# Check if running in CI context.
CI=${CI:-}

SCRIPT_DIR=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)

Expand Down Expand Up @@ -41,9 +43,7 @@ get_timestamp() {
}

log_progress() {
bold=$(tput bold)
normal=$(tput sgr0)
echo "[$(get_timestamp)] [INFO] ${bold}${1}${normal}"
echo "[$(get_timestamp)] [INFO] ${1}"
}

random_salt() {
Expand Down Expand Up @@ -142,6 +142,18 @@ move_keys() {
}

docker_ink_dev() {
# if [[ -z "${CI}" ]]; then
local_docker_cargo "$@"
# else
# ci_docker_cargo "$@"
# fi
}

local_docker_cargo() {
mkdir -p ~/.cargo/git
mkdir -p ~/.cargo/registry
chown ${DOCKER_USER} ~/.cargo/git
chown ${DOCKER_USER} ~/.cargo/registry
docker run --rm \
-u "${DOCKER_USER}" \
-v "${PWD}":/code \
Expand All @@ -153,6 +165,15 @@ docker_ink_dev() {
-c "${1}"
}

ci_docker_cargo() {
docker run --rm \
-v "${PWD}":/code \
--network host \
--entrypoint /bin/sh \
"${INK_DEV_IMAGE}" \
-c "cargo ${1}"
}

build() {
cd "${SCRIPT_DIR}"/..

Expand Down Expand Up @@ -193,6 +214,7 @@ prefund_users() {
for recipient in "${DAMIAN_PUBKEY}" "${HANS_PUBKEY}"; do
transfer ${recipient}
done
log_progress "✅ Test accounts prefunded with SNZERO tokens."
}

# Distribute TOKEN_PER_PERSON of TOKEN_A and TOKEN_B to DAMIAN and HANS.
Expand All @@ -204,13 +226,14 @@ distribute_tokens() {
contract_call "--contract ${token} --message PSP22::transfer --args ${recipient} ${TOKEN_PER_PERSON} 0x00 --suri ${ADMIN}" 1>/dev/null
done
done
log_progress "✅ PSP22 tokens distributed"
}

deploy_shielder_contract() {
cd "${SCRIPT_DIR}"/..
SHIELDER_ADDRESS=$(contract_instantiate "--args ${MERKLE_LEAVES} --manifest-path contract/Cargo.toml" | jq -r '.contract')
export SHIELDER_ADDRESS
log_progress "Shielder address: ${SHIELDER_ADDRESS}"
log_progress "Shielder address: ${SHIELDER_ADDRESS}"
}

# Set allowance at TOKEN_ALLOWANCE on TOKEN_A and TOKEN_B from SHIELDER, from DAMIAN and HANS.
Expand Down