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

LW-11615 Update deployed envs e2e test to latest sdk version #1503

Merged
merged 1 commit into from
Oct 7, 2024
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
41 changes: 23 additions & 18 deletions .github/workflows/test-deploy-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,25 @@ on:
workflow_dispatch:
inputs:
environment:
description: 'Environment to run e2e tests against'
description: 'Target environment'
type: choice
required: true
default: 'dev-preprod'
options:
- live-preprod
- live-preview
- dev-preprod
- dev-preview
- staging-preprod
- 'dev'
- 'staging'
- 'live'
network:
description: 'Target network'
type: choice
required: true
options:
- 'preview'
- 'preprod'
- 'sanchonet'
cluster:
description: 'Specific cluster to run e2e tests against'
description: 'Target cluster'
type: choice
required: true
default: 'any'
options:
- any
- eu-central-1
Expand All @@ -27,7 +31,6 @@ on:
description: 'Log level'
type: choice
required: true
default: 'fatal'
options:
- fatal
- error
Expand All @@ -36,10 +39,6 @@ on:
- debug
- trace

env:
TL_DEPTH: ${{ github.event.pull_request.head.repo.fork && '0' || fromJson(vars.TL_DEPTH) }}
TL_LEVEL: ${{ github.event.pull_request.head.repo.fork && 'info' || vars.TL_LEVEL }}

jobs:
build_and_test:
strategy:
Expand All @@ -52,10 +51,13 @@ jobs:

- name: Generate .env file
working-directory: ./packages/e2e/
env:
CLUSTER: ${{ inputs.cluster }}
ENVIRONMENT: ${{ inputs.environment }}
MNEMONIC: ${{ secrets.MNEMONIC }}
NETWORK: ${{ inputs.network }}
run: |
if [[ "${{ inputs.environment }}" == *"preprod"* ]]; then networkMagic=1; else networkMagic=2; fi
./src/scripts/generate-dotenv.sh ${{ inputs.environment }} ${{ inputs.cluster }}
echo "KEY_MANAGEMENT_PARAMS='$(jq --argjson networkMagic $networkMagic --arg mnemonic "${{ secrets.MNEMONIC }}" <<< '{"bip32Ed25519": "Sodium", "accountIndex": 0, "chainId":{"networkId": 0, "networkMagic": 0}, "passphrase":"some_passphrase","mnemonic":"mnemonics"}' '.mnemonic=$mnemonic | .chainId.networkMagic=$networkMagic')'" >> .env
./src/scripts/generate-dotenv.sh

- name: 🧰 Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -71,6 +73,9 @@ jobs:
NODE_OPTIONS: '--max_old_space_size=8192'

- name: 🔬 Test - e2e - wallet
env:
TL_DEPTH: 0
TL_LEVEL: ${{ inputs.level }}
run: |
TL_DEPTH=0 TL_LEVEL=${{ inputs.level }} yarn workspace @cardano-sdk/e2e test:wallet-real-ada
yarn workspace @cardano-sdk/e2e test:wallet-real-ada
shell: bash
61 changes: 46 additions & 15 deletions packages/e2e/src/scripts/generate-dotenv.sh
Original file line number Diff line number Diff line change
@@ -1,48 +1,79 @@
#!/bin/bash

set -e
set -x
set -o

case $2 in
target="${ENVIRONMENT}-${NETWORK}"

case $CLUSTER in
any)
environment="$1"
environment="${target}"
;;
*)
environment="${target}.${CLUSTER}"
;;
esac

case $NETWORK in
preprod)
networkMagic=1
;;
preview)
networkMagic=2
;;
sanchonet)
networkMagic=4
;;
*)
environment="$1.$2"
echo "${NETWORK}: Unknown network"
exit 1
;;
esac

domain="${environment}.lw.iog.io"
url="https://${domain}/"

# Construct the environment file content
envFileContent="
# Logger
envFileContent="\
LOGGER_MIN_SEVERITY=info

# Key management setup - required by getWallet
KEY_MANAGEMENT_PROVIDER=inMemory

# Providers setup - required by getWallet
TEST_CLIENT_ASSET_PROVIDER=http
TEST_CLIENT_ASSET_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_CHAIN_HISTORY_PROVIDER=http
TEST_CLIENT_CHAIN_HISTORY_PROVIDER=ws
TEST_CLIENT_CHAIN_HISTORY_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_HANDLE_PROVIDER=http
TEST_CLIENT_HANDLE_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_NETWORK_INFO_PROVIDER=http
TEST_CLIENT_NETWORK_INFO_PROVIDER=ws
TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_REWARDS_PROVIDER=http
TEST_CLIENT_REWARDS_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_TX_SUBMIT_PROVIDER=http
TEST_CLIENT_TX_SUBMIT_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_UTXO_PROVIDER=http
TEST_CLIENT_UTXO_PROVIDER=ws
TEST_CLIENT_UTXO_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
TEST_CLIENT_STAKE_POOL_PROVIDER=http
TEST_CLIENT_STAKE_POOL_PROVIDER_PARAMS='{\"baseUrl\":\"${url}\"}'
WS_PROVIDER_URL='wss://${domain}/ws'
"

KEY_MANAGEMENT_PROVIDER=inMemory
KEY_MANAGEMENT_PARAMS='{
\"bip32Ed25519\": \"Sodium\",
\"accountIndex\": 0,
\"chainId\": {
\"networkId\": 0,
\"networkMagic\": ${networkMagic}
},
\"passphrase\": \"some_passphrase\",
\"mnemonic\": \"${MNEMONIC}\"
}'"

# Write the environment file content to the specified file
echo "$envFileContent" > .env

# Dump inputs and outputs
echo "
Target environment: ${ENVIRONMENT}
Target network: ${NETWORK}
Target cluster: ${CLUSTER}

Result .env:"
cat .env
Loading