Skip to content

Commit

Permalink
ci: add interchaintest
Browse files Browse the repository at this point in the history
  • Loading branch information
jim380 committed Jan 30, 2024
1 parent e847498 commit da31f47
Show file tree
Hide file tree
Showing 4 changed files with 144 additions and 6 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/interchaintest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Interchaintest

on:
push:
branches:
- main
pull_request:
types: [opened, synchronize, reopened, labeled]

env:
GO_VERSION: "1.21.0"
GOPRIVATE: github.com/sedaprotocol/vrf-go
GITHUB_TOKEN: ${{ secrets.PAT }}
TAR_PATH: /tmp/seda-docker-image.tar
IMAGE_NAME: seda-docker-image
SEDA_EXPONENT: 6

permissions:
contents: read
repository-projects: read
packages: read

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

jobs:
build-docker-image:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: interchaintest/go.sum

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and export
uses: docker/build-push-action@v5
with:
context: ./dockerfiles
file: Dockerfile.e2e
tags: seda:local
outputs: type=docker,dest=${{ env.TAR_PATH }}

- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: ${{ env.TAR_PATH }}

interchaintest:
needs: build-docker-image
runs-on: ubuntu-latest
strategy:
matrix:
test:
- "ictest-sdk-commands"
- "ictest-sdk-boundaries"
- "ictest-chain-start"
- "ictest-conformance"
- "ictest-state-sync"
- "ictest-ibc-xfer"
- "ictest-packet-forward-middleware"
fail-fast: false

steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache-dependency-path: interchaintest/go.sum

- name: checkout chain
uses: actions/checkout@v4

- name: Download Tarball Artifact
uses: actions/download-artifact@v3
with:
name: ${{ env.IMAGE_NAME }}
path: /tmp

- name: Load Docker Image
run: |
docker image load -i ${{ env.TAR_PATH }}
docker image ls -a
- name: Run Test
run: make ${{ matrix.test }}
27 changes: 27 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,33 @@ endif

.PHONY: cover-html run-tests $(TEST_TARGETS) test test-race docker-build-e2e

###############################################################################
### interchaintest ###
###############################################################################

ictest-sdk-commands: rm-testcache
cd interchaintest && go test -race -v -run TestCoreSDKCommands .

ictest-sdk-boundaries: rm-testcache
cd interchaintest && go test -race -v -run TestSDKBoundaries .

ictest-chain-start: rm-testcache
cd interchaintest && go test -race -v -run TestChainStart .

ictest-conformance: rm-testcache
cd interchaintest && go test -race -v -run TestConformance .

ictest-state-sync: rm-testcache
cd interchaintest && go test -race -v -run TestStateSync .

ictest-ibc-xfer: rm-testcache
cd interchaintest && go test -race -v -run TestIBCTransfer .

ictest-packet-forward-middleware: rm-testcache
cd interchaintest && go test -race -v -run TestPacketForwardMiddleware .

rm-testcache:
go clean -testcache

###############################################################################
### Release ###
Expand Down
25 changes: 21 additions & 4 deletions app/params/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package params

import (
"os"
"strconv"

errorsmod "cosmossdk.io/errors"
"cosmossdk.io/math"

Expand All @@ -10,17 +13,16 @@ import (
)

const (
HumanCoinUnit = "seda"
BaseCoinUnit = "aseda" // atto (10^-18)
SedaExponent = 18

HumanCoinUnit = "seda"
BaseCoinUnit = "aseda" // atto (10^-18)
DefaultBondDenom = BaseCoinUnit

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address.
Bech32PrefixAccAddr = "seda"
)

var (
SedaExponent int64
// Bech32PrefixAccPub defines the Bech32 prefix of an account's public key.
Bech32PrefixAccPub = Bech32PrefixAccAddr + "pub"
// Bech32PrefixValAddr defines the Bech32 prefix of a validator's operator address.
Expand All @@ -33,7 +35,22 @@ var (
Bech32PrefixConsPub = Bech32PrefixAccAddr + "valconspub"
)

func getSedaExponent() int64 {
sedaExponent := os.Getenv("SEDA_EXPONENT")
if sedaExponent == "" {
return 18 // default value
}

value, err := strconv.Atoi(sedaExponent)
if err != nil {
panic(err)
}

return int64(value)
}

func init() {
SedaExponent = getSedaExponent()
SetAddressPrefixes()
RegisterDenoms()
}
Expand Down
4 changes: 2 additions & 2 deletions interchaintest/ibc_transfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types"
)

// TestSedaGaiaIBCTransfer spins up a Seda and Gaia network, initializes an IBC connection between them,
// TestIBCTransfer spins up a Seda and Gaia network, initializes an IBC connection between them,
// and sends an ICS20 token transfer from Seda->Gaia and then back from Gaia->Seda.
func TestSedaGaiaIBCTransfer(t *testing.T) {
func TestIBCTransfer(t *testing.T) {
if testing.Short() {
t.Skip("skipping in short mode")
}
Expand Down

0 comments on commit da31f47

Please sign in to comment.