|
62 | 62 |
|
63 | 63 | - name: Run tests in wasm |
64 | 64 | run: make wasm |
| 65 | + |
| 66 | + |
| 67 | + run_tests_with_network: |
| 68 | + runs-on: ubuntu-latest |
| 69 | + env: |
| 70 | + EPOCH_DURATION_MS: 10000 |
| 71 | + services: |
| 72 | + postgres: # we need this postgres instance for running a local network with indexer and graphql |
| 73 | + image: postgres |
| 74 | + env: |
| 75 | + POSTGRES_USER: postgres |
| 76 | + POSTGRES_PASSWORD: postgrespw |
| 77 | + POSTGRES_DB: sui_indexer_v2 |
| 78 | + POSTGRES_HOST_AUTH_METHOD: trust |
| 79 | + options: >- |
| 80 | + --health-cmd pg_isready |
| 81 | + --health-interval 10s |
| 82 | + --health-timeout 5s |
| 83 | + --health-retries 5 |
| 84 | + ports: |
| 85 | + - 5432:5432 |
| 86 | + steps: |
| 87 | + - name: Checkout repository |
| 88 | + uses: actions/checkout@v4 |
| 89 | + |
| 90 | + - name: rust version |
| 91 | + run: | |
| 92 | + rustc --version |
| 93 | + cargo --version |
| 94 | + |
| 95 | + - uses: taiki-e/install-action@cargo-nextest |
| 96 | + |
| 97 | + - name: Get the Sui testnet binary and start a local network |
| 98 | + shell: bash |
| 99 | + env: |
| 100 | + SUI_BINARY_VERSION: "1.35.1" # used for downloading a specific Sui binary versions that matches the GraphQL schema for local network tests |
| 101 | + SUI_NETWORK_RELEASE: "testnet" # which release to use |
| 102 | + run: | |
| 103 | + ASSET_NAME="sui-$SUI_NETWORK_RELEASE-v$SUI_BINARY_VERSION-ubuntu-x86_64.tgz" |
| 104 | + download_url="https://github.com/mystenlabs/sui/releases/download/$SUI_NETWORK_RELEASE-v$SUI_BINARY_VERSION/$ASSET_NAME" |
| 105 | + |
| 106 | + echo "Downloading testnet binary from $download_url" |
| 107 | + wget -q $download_url -O sui.tgz |
| 108 | + tar -zxvf sui.tgz ./sui |
| 109 | + echo "Starting local network with a faucet, an indexer (port 5432) and GraphQL. Epoch duration is set to $EPOCH_DURATION_MS ms" |
| 110 | + ./sui start --force-regenesis --with-faucet --with-indexer --with-graphql --pg-port 5432 --pg-db-name sui_indexer_v2 --epoch-duration-ms $EPOCH_DURATION_MS & |
| 111 | +
|
| 112 | + - name: Run tests that require local network (GraphQL Client and Tx Builder) |
| 113 | + env: |
| 114 | + NETWORK: "local" # other expected options are mainnet, testnet, or devnet, or an actual URL to a GraphQL server: http://localhost:port |
| 115 | + run: | |
| 116 | + sleep $((EPOCH_DURATION_MS / 1000)) # wait for the network to get to epoch #2 |
| 117 | + make test-with-localnet |
| 118 | + |
0 commit comments