Skip to content

Commit

Permalink
feat(e2e): enable blockfrst e2e test in CI
Browse files Browse the repository at this point in the history
  • Loading branch information
ginnun committed Sep 12, 2024
1 parent 6b2de2e commit 820d241
Show file tree
Hide file tree
Showing 3 changed files with 114 additions and 1 deletion.
111 changes: 111 additions & 0 deletions .github/workflows/continuous-integration-e2e-blockfrost.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
name: Continuous Integration - E2E (Blockfrost Providers)

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 }}
# -----------------------------------------------------------------------------------------
KEY_MANAGEMENT_PROVIDER: 'inMemory'
KEY_MANAGEMENT_PARAMS: '{"bip32Ed25519": "Sodium", "accountIndex": 0, "chainId":{"networkId": 0, "networkMagic": 888}, "passphrase":"some_passphrase","mnemonic":"vacant violin soft weird deliver render brief always monitor general maid smart jelly core drastic erode echo there clump dizzy card filter option defense"}'
TEST_CLIENT_ASSET_PROVIDER: 'http'
TEST_CLIENT_ASSET_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4014/"}'
TEST_CLIENT_CHAIN_HISTORY_PROVIDER: 'http'
TEST_CLIENT_CHAIN_HISTORY_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4000/"}'
DB_SYNC_CONNECTION_STRING: 'postgresql://postgres:doNoUseThisSecret!@localhost:5435/cexplorer'
TEST_CLIENT_HANDLE_PROVIDER: 'http'
TEST_CLIENT_HANDLE_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4011/"}'
STAKE_POOL_CONNECTION_STRING: 'postgresql://postgres:doNoUseThisSecret!@localhost:5435/stake_pool'
STAKE_POOL_TEST_CONNECTION_STRING: 'postgresql://postgres:doNoUseThisSecret!@localhost:5435/stake_pool_test'
TEST_CLIENT_NETWORK_INFO_PROVIDER: 'ws'
TEST_CLIENT_NETWORK_INFO_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4000/"}'
OGMIOS_URL: 'ws://localhost:1340/'
TEST_CLIENT_REWARDS_PROVIDER: 'http'
TEST_CLIENT_REWARDS_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4000/"}'
TEST_CLIENT_TX_SUBMIT_PROVIDER: 'http'
TEST_CLIENT_TX_SUBMIT_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4000/"}'
TEST_CLIENT_UTXO_PROVIDER: 'http'
TEST_CLIENT_UTXO_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4000/"}'
TEST_CLIENT_STAKE_POOL_PROVIDER: 'http'
TEST_CLIENT_STAKE_POOL_PROVIDER_PARAMS: '{"baseUrl":"http://localhost:4000/"}'
WS_PROVIDER_URL: 'http://localhost:4100/ws'
# enable Blockfrost backed providers, the rest will use defaults
ASSET_PROVIDER: 'blockfrost'
UTXO_PROVIDER: 'blockfrost'
CHAIN_HISTORY_PROVIDER: 'blockfrost'
REWARDS_PROVIDER: 'blockfrost'
NETWORK_INFO_PROVIDER: 'blockfrost'
TX_SUBMIT_PROVIDER: 'blockfrost'

on:
pull_request:
push:
branches: ['master']
tags: ['*.*.*']

jobs:
build_and_test:
strategy:
matrix:
os: [ubuntu-20.04]
runs-on: ${{ matrix.os }}
steps:
- name: 📥 Checkout repository
uses: actions/checkout@v3

- name: 🧰 Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18.12.0

- name: 🔨 Build
run: |
yarn install --immutable --inline-builds --mode=skip-build
yarn workspace @cardano-sdk/cardano-services-client build:cjs
yarn workspace @cardano-sdk/cardano-services build:cjs
yarn workspace @cardano-sdk/e2e build:cjs
yarn workspace @cardano-sdk/util-dev build:cjs
docker build --no-cache .
env:
NODE_OPTIONS: '--max_old_space_size=8192'

- name: 🌐 Setup local test network
working-directory: packages/e2e
run: |
yarn local-network:blockfrost:up -d
env:
CARDANO_NODE_CHAINDB_LOG_LEVEL: 'Warning'
CARDANO_NODE_LOG_LEVEL: 'Warning'
OGMIOS_PORT: '1340'
OGMIOS_URL: 'ws://ogmios:1340'
POSTGRES_PORT: '5435'

- name: Wait for network init
run: |
yarn workspace @cardano-sdk/e2e wait-for-network-init
- name: 🔬 Test - e2e - wallet at epoch 0
run: |
yarn workspace @cardano-sdk/e2e test:wallet:epoch0
yarn workspace @cardano-sdk/e2e test:projection
yarn workspace @cardano-sdk/e2e test:ws
- name: Wait for epoch 3
run: |
yarn workspace @cardano-sdk/e2e wait-for-network-epoch-3
- name: 🔬 Test - e2e - wallet at epoch 3
run: |
yarn workspace @cardano-sdk/e2e test:wallet:epoch3
yarn workspace @cardano-sdk/e2e test:pg-boss
yarn workspace @cardano-sdk/e2e test:providers
env:
STAKE_POOL_PROVIDER_URL: 'http://localhost:4000/'

- name: 🔬 Test - e2e - wallet - typeorm stake pool provider
run: |
yarn workspace @cardano-sdk/e2e test:providers -t StakePoolProvider
env:
STAKE_POOL_PROVIDER_URL: 'http://localhost:4010/'

- name: Dump docker logs
if: ${{ cancelled() || failure() }}
uses: jwalton/gh-docker-logs@v2
1 change: 1 addition & 0 deletions packages/e2e/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ services:
NODE_ENV: local-network
volumes:
- ./local-network/config/network/blockfrost-ryo:/app/config
profiles: [blockfrost-ryo]

local-testnet:
<<: *logging
Expand Down
3 changes: 2 additions & 1 deletion packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,9 @@
"test:web-extension:watch": "run-s test:web-extension:build test:web-extension:watch:bg",
"test:web-extension:watch:bg": "run-p test:web-extension:watch:build test:web-extension:watch:run",
"test:ws": "jest -c jest.config.js --forceExit --selectProjects ws-server --runInBand --verbose",
"local-network:common": "DISABLE_DB_CACHE=${DISABLE_DB_CACHE:-true} SUBMIT_API_ARGS='--testnet-magic 888' USE_BLOCKFROST=false __FIX_UMASK__=$(chmod -R a+r ../../compose/placeholder-secrets) docker compose --env-file ../cardano-services/environments/.env.local -p local-network-e2e -f docker-compose.yml -f ../../compose/common.yml -f ../../compose/$(uname -m).yml $FILES up",
"local-network:common": "DISABLE_DB_CACHE=${DISABLE_DB_CACHE:-true} SUBMIT_API_ARGS='--testnet-magic 888' USE_BLOCKFROST=false __FIX_UMASK__=$(chmod -R a+r ../../compose/placeholder-secrets) docker compose --env-file ../cardano-services/environments/.env.local -p local-network-e2e -f docker-compose.yml -f ../../compose/common.yml -f ../../compose/$(uname -m).yml $FILES --profile ${DOCKER_COMPOSE_PROFILE:-none} up",
"local-network:up": "FILES='' yarn local-network:common",
"local-network:blockfrost:up": "FILES='' DOCKER_COMPOSE_PROFILE='blockfrost-ryo' yarn local-network:common",
"local-network:single:up": "FILES='' yarn local-network:common cardano-node file-server local-testnet ogmios postgres",
"local-network:profile:up": "FILES='-f ../../compose/pg-agent.yml' yarn local-network:common",
"local-network:down": "docker compose -p local-network-e2e -f docker-compose.yml -f ../../compose/common.yml -f ../../compose/pg-agent.yml down -v --remove-orphans",
Expand Down

0 comments on commit 820d241

Please sign in to comment.