Skip to content

Commit

Permalink
ci(multichain-testing): yarn test:fast-usdc
Browse files Browse the repository at this point in the history
  • Loading branch information
0xpatrickdev committed Nov 4, 2024
1 parent 1556033 commit de0f11b
Show file tree
Hide file tree
Showing 4 changed files with 140 additions and 78 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/multichain-e2e-template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Multichain E2E Workflow Template

on:
workflow_call:
inputs:
config:
required: true
type: string
test_command:
required: true
type: string
description: 'Test command to run (e.g., "test:main" or "test:fast-usdc")'

jobs:
multichain-e2e:
runs-on: ubuntu-latest-16core

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
path: ./agoric-sdk

- uses: ./agoric-sdk/.github/actions/restore-node
with:
node-version: 18.x
path: ./agoric-sdk

# Extract chain and relayer information
- name: Extract config information
id: extract-config
run: |
# Create logs directory
mkdir -p ./agoric-sdk/multichain-testing/logs
# Extract namespace name
NAMESPACE=$(yq e '.name' ./agoric-sdk/multichain-testing/${{ inputs.config }})
echo "NAMESPACE=${NAMESPACE}" >> $GITHUB_ENV
# Build validator pod names (chainid-genesis-0)
VALIDATOR_PODS=$(yq e '.chains[] | .id + "-genesis-0"' ./agoric-sdk/multichain-testing/${{ inputs.config }} | tr '\n' ' ')
echo "VALIDATOR_PODS=${VALIDATOR_PODS}" >> $GITHUB_ENV
# Build relayer pod names (type-name-0)
RELAYER_PODS=$(yq e '.relayers[] | .type + "-" + .name + "-0"' ./agoric-sdk/multichain-testing/${{ inputs.config }} | tr '\n' ' ')
echo "RELAYER_PODS=${RELAYER_PODS}" >> $GITHUB_ENV
# For debugging
echo "Namespace: ${NAMESPACE}"
echo "Validator pods: ${VALIDATOR_PODS}"
echo "Relayer pods: ${RELAYER_PODS}"
- name: yarn link
run: |
yarn link-cli ~/bin/agoric
echo "/home/runner/bin" >> $GITHUB_PATH
working-directory: ./agoric-sdk

- name: Enable Corepack
run: corepack enable
working-directory: ./agoric-sdk/multichain-testing

- name: Install @agoric/multichain-testing deps
run: yarn install
working-directory: ./agoric-sdk/multichain-testing

- name: Lint @agoric/multichain-testing
run: yarn lint
working-directory: ./agoric-sdk/multichain-testing

- name: Setup Starship Infrastructure
id: starship-infra
uses: cosmology-tech/[email protected]
with:
values: ./agoric-sdk/multichain-testing/${{ inputs.config }}
port-forward: true
version: 0.2.20
timeout: 30m
namespace: ${{ env.NAMESPACE }}

- name: Fund Provision Pool
run: |
kubectl config set-context --current --namespace=${NAMESPACE}
kubectl get pods
make fund-provision-pool
working-directory: ./agoric-sdk/multichain-testing

- name: Override Chain Registry
run: make override-chain-registry
working-directory: ./agoric-sdk/multichain-testing

- name: Run @agoric/multichain-testing E2E Tests
run: yarn ${{ inputs.test_command }}
working-directory: ./agoric-sdk/multichain-testing
env:
FILE: ${{ inputs.config }}

- name: Capture validator logs
if: always()
run: |
for pod in ${VALIDATOR_PODS}; do
echo "Capturing validator logs for ${pod}"
kubectl logs ${pod} --container=validator > ./agoric-sdk/multichain-testing/logs/${pod}.log 2>&1 || true
done
working-directory: ./agoric-sdk

- name: Capture relayer logs
if: always()
run: |
for pod in ${RELAYER_PODS}; do
echo "Capturing relayer logs for ${pod}"
kubectl logs ${pod} --container=relayer > ./agoric-sdk/multichain-testing/logs/${pod}.log 2>&1 || true
done
working-directory: ./agoric-sdk

- name: Upload test logs
if: always()
uses: actions/upload-artifact@v4
with:
name: multichain-e2e-logs-${NAMESPACE}
path: ./agoric-sdk/multichain-testing/logs/
91 changes: 13 additions & 78 deletions .github/workflows/multichain-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,81 +5,16 @@ on:
workflow_call:

jobs:
multichain-e2e:
runs-on: ubuntu-latest-16core

steps:
- uses: actions/checkout@v4
with:
submodules: 'true'
path: ./agoric-sdk
- uses: ./agoric-sdk/.github/actions/restore-node
with:
node-version: 18.x
path: ./agoric-sdk

- name: yarn link
run: |
yarn link-cli ~/bin/agoric
echo "/home/runner/bin" >> $GITHUB_PATH
working-directory: ./agoric-sdk

- name: Enable Corepack
run: corepack enable
working-directory: ./agoric-sdk/multichain-testing

- name: Install @agoric/multichain-testing deps
run: yarn install
working-directory: ./agoric-sdk/multichain-testing

- name: Lint @agoric/multichain-testing
run: yarn lint
working-directory: ./agoric-sdk/multichain-testing

- name: Setup Starship Infrastructure
id: starship-infra
uses: cosmology-tech/[email protected]
with:
# uses ghcr.io/agoric/agoric-sdk:dev image (latest master)
values: ./agoric-sdk/multichain-testing/config.yaml
port-forward: true
version: 0.2.20
timeout: 30m
namespace: agoric-multichain

- name: Fund Provision Pool
run: |
kubectl config set-context --current --namespace=agoric-multichain
kubectl get pods
make fund-provision-pool
working-directory: ./agoric-sdk/multichain-testing

- name: Ensure ports are forwarded
run: |
curl --fail --retry 3 --retry-delay 10 http://localhost:26657/status || (echo "agoriclocal node is available")
curl --fail --retry 3 --retry-delay 10 http://localhost:8081/chains/agoriclocal || (echo "agoriclocal URL check failed")
curl --fail --retry 3 --retry-delay 10 http://localhost:8081/chains/osmosislocal || (echo "osmosislocal URL check failed")
curl --fail --retry 3 --retry-delay 10 http://localhost:8081/chains/gaialocal || (echo "gaialocal URL check failed")
- name: Override Chain Registry
run: make override-chain-registry
working-directory: ./agoric-sdk/multichain-testing

- name: Run @agoric/multichain-testing E2E Tests
run: yarn test
working-directory: ./agoric-sdk/multichain-testing

- name: Capture and print agoric validator logs
if: always()
run: kubectl logs agoriclocal-genesis-0 --container=validator || true
working-directory: ./agoric-sdk/multichain-testing

- name: Capture and print agoric-osmosis relayer logs
if: always()
run: kubectl logs hermes-agoric-osmosis-0 --container=relayer || true
working-directory: ./agoric-sdk/multichain-testing

- name: Capture and print agoric-cosmos relayer logs
if: always()
run: kubectl logs hermes-agoric-gaia-0 --container=relayer || true
working-directory: ./agoric-sdk/multichain-testing
orchestration-api-test:
name: Multichain E2E (Orchestration API)
uses: ./.github/workflows/multichain-e2e-template.yml
with:
config: config.yaml
test_command: test:main

fast-usdc-test:
name: Multichain E2E (Fast USDC)
uses: ./.github/workflows/multichain-e2e-template.yml
with:
config: config.fusdc.yaml
test_command: test:fast-usdc
3 changes: 3 additions & 0 deletions multichain-testing/config.fusdc.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: agoric-multichain-testing-fusdc
version: 0.2.20

chains:
- id: agoriclocal
name: agoric
Expand Down
3 changes: 3 additions & 0 deletions multichain-testing/config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
name: agoric-multichain-testing
version: 0.2.20

chains:
- id: agoriclocal
name: agoric
Expand Down

0 comments on commit de0f11b

Please sign in to comment.