Skip to content

Commit 31bacdd

Browse files
authored
Lw 10449 sdk e2e tests ci (#1332)
Add SDK E2E Tests - Create shell script to generate .env file for workflow - Add new workflow definition for tests
1 parent dbde8e1 commit 31bacdd

File tree

2 files changed

+82
-8
lines changed

2 files changed

+82
-8
lines changed
Lines changed: 47 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,54 @@
1-
name: CI/CD
1+
name: Deployed Environments - SDK E2E Tests
22

33
on:
4-
push:
54
workflow_dispatch:
5+
inputs:
6+
environment:
7+
description: 'Environment to run e2e tests against'
8+
type: choice
9+
required: true
10+
default: 'dev-preprod'
11+
options:
12+
- live-preprod
13+
- live-preview
14+
- dev-preprod
15+
- dev-preview
16+
- staging-preprod
617

7-
jobs:
8-
hello-world-placeholder:
9-
name: Hello World Placeholder
10-
runs-on: ubuntu-22.04
18+
env:
19+
TL_DEPTH: ${{ github.event.pull_request.head.repo.fork && '0' || fromJson(vars.TL_DEPTH) }}
20+
TL_LEVEL: ${{ github.event.pull_request.head.repo.fork && 'info' || vars.TL_LEVEL }}
1121

22+
jobs:
23+
build_and_test:
24+
strategy:
25+
matrix:
26+
os: [ubuntu-20.04]
27+
runs-on: ${{ matrix.os }}
1228
steps:
13-
- name: Hello World
29+
- name: 📥 Checkout repository
30+
uses: actions/checkout@v3
31+
32+
- name: Generate .env file
33+
working-directory: ./packages/e2e/
34+
run: |
35+
if [[ "${{ inputs.environment }}" == *"preprod"* ]]; then networkMagic=1; else networkMagic=2; fi
36+
./src/scripts/generate-dotenv.sh ${{ inputs.environment }}
37+
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
38+
39+
- name: 🧰 Setup Node.js
40+
uses: actions/setup-node@v3
41+
with:
42+
node-version: 18.12.0
43+
44+
- name: 🔨 Build
45+
run: |
46+
yarn install --immutable --inline-builds --mode=skip-build
47+
yarn build:cjs
48+
docker build --no-cache .
49+
env:
50+
NODE_OPTIONS: '--max_old_space_size=8192'
51+
52+
- name: 🔬 Test - e2e - wallet at epoch 0
1453
run: |
15-
echo 'Hello, World!'
54+
yarn workspace @cardano-sdk/e2e test:wallet
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/bash
2+
set -x
3+
set -o
4+
5+
environment="$1"
6+
7+
url="https://${environment}.lw.iog.io"
8+
9+
# Construct the environment file content
10+
envFileContent="
11+
# Logger
12+
LOGGER_MIN_SEVERITY=info
13+
14+
# Key management setup - required by getWallet
15+
KEY_MANAGEMENT_PROVIDER=inMemory
16+
17+
# Providers setup - required by getWallet
18+
ASSET_PROVIDER=http
19+
ASSET_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
20+
HANDLE_PROVIDER=http
21+
HANDLE_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4011/\"}'
22+
NETWORK_INFO_PROVIDER=http
23+
NETWORK_INFO_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
24+
REWARDS_PROVIDER=http
25+
REWARDS_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
26+
TX_SUBMIT_PROVIDER=http
27+
TX_SUBMIT_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
28+
UTXO_PROVIDER=http
29+
UTXO_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
30+
STAKE_POOL_PROVIDER=http
31+
STAKE_POOL_PROVIDER_PARAMS='{\"baseUrl\":\"$url:4000/\"}'
32+
"
33+
34+
# Write the environment file content to the specified file
35+
echo "$envFileContent" > .env

0 commit comments

Comments
 (0)