diff --git a/.github/workflows/pytests.yml b/.github/workflows/pytests.yml index db636017..df978f1f 100644 --- a/.github/workflows/pytests.yml +++ b/.github/workflows/pytests.yml @@ -29,12 +29,6 @@ jobs: runs-on: ubuntu-latest env: # https://www.notion.so/nibiru/Resources-and-Repo-Configs-b31aa8074a2b419d80b0c946ed5efab0 - LCD_ENDPOINT: "http://localhost:1317" - GRPC_ENDPOINT: "localhost:9090" - TENDERMINT_RPC_ENDPOINT: "http://localhost:26657" - USE_LOCALNET: true - WEBSOCKET_ENDPOINT: "ws://localhost:26657/websocket" - CHAIN_ID: "nibiru-localnet-0" VALIDATOR_MNEMONIC: "guard cream sadness conduct invite crumble clock pudding hole grit liar hotel maid produce squeeze return argue turtle know drive eight casino maze host" DEVNET_NUMBER: ${{ secrets.DEVNET_NUMBER }} steps: @@ -54,7 +48,7 @@ jobs: # 3.8.16 is the highest 3.8 version available on pyenv # See `grep '3.8' <<< $(pyenv install -l)` to view the available list. - - name: Run python + - name: Run python # sanity check on the installation. run: python --version && python -c "print('hello')" # ---------------------------------------------- @@ -99,13 +93,18 @@ jobs: if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' run: poetry install --no-interaction --no-root - - name: Run chaosnet - uses: NibiruChain/localnet-action@v1.1 - id: chaosnet - with: - services: nibiru pricefeeder - ghtoken: ${{ secrets.GITHUB_TOKEN }} - ghactor: ${{ github.actor }} + - name: Run localnet.sh in the background. + run: | + curl -s https://get.nibiru.fi/@v0.21.5! | bash + bash scrips/localnet.sh --no-build & + + # - name: Run chaosnet + # uses: NibiruChain/localnet-action@v1.1 + # id: chaosnet + # with: + # services: nibiru pricefeeder + # ghtoken: ${{ secrets.GITHUB_TOKEN }} + # ghactor: ${{ github.actor }} - name: sleep 30 seconds run: sleep 30 diff --git a/scripts/localnet.sh b/scripts/localnet.sh index cf686440..0a718efa 100644 --- a/scripts/localnet.sh +++ b/scripts/localnet.sh @@ -34,14 +34,39 @@ echo_success() { echo "${reset}" } -echo_info "Building from source..." -if make install; then - echo_success "Successfully built binary" -else - echo_error "Could not build binary. Failed to make install." - exit 1 +# Flag parsing: --flag-name (BASH_VAR_NAME) +# +# --no-build ($FLAG_NO_BUILD): toggles whether to build from source. The default +# behavior of the script is to run make install. +FLAG_NO_BUILD=false + +build_from_source() { + echo_info "Building from source..." + if make install; then + echo_success "Successfully built binary" + else + echo_error "Could not build binary. Failed to make install." + exit 1 + fi +} + +echo_info "Parsing flags for the script..." + +# Iterate over all arguments to the script +for arg in "$@" +do + if [ "$arg" == "--no-build" ] ; then + FLAG_NO_BUILD=true + fi +done + + +# Check if FLAG_NO_BUILD was set to true +if ! $FLAG_NO_BUILD ; then + build_from_source fi + # Set localnet settings BINARY="nibid" CHAIN_ID="nibiru-localnet-0" @@ -53,11 +78,16 @@ CHAIN_DIR="$HOME/.nibid" echo "CHAIN_DIR: $CHAIN_DIR" echo "CHAIN_ID: $CHAIN_ID" + SEDOPTION="" if [[ "$OSTYPE" == "darwin"* ]]; then SEDOPTION="''" fi +# ------------------------------------------------------------------------ +echo_info "Successfully finished localnet script setup." +# ------------------------------------------------------------------------ + # Stop nibid if it is already running if pgrep -x "$BINARY" >/dev/null; then echo_error "Terminating $BINARY..."