diff --git a/.github/actions/restore-golang/action.yml b/.github/actions/restore-golang/action.yml index 492c8b902a3..abd26858fc3 100644 --- a/.github/actions/restore-golang/action.yml +++ b/.github/actions/restore-golang/action.yml @@ -5,6 +5,10 @@ inputs: go-version: description: 'The version of Go to use' required: true + path: + description: 'The relative path to the agoric-sdk directory' + required: false + default: '.' runs: using: composite @@ -14,13 +18,14 @@ runs: shell: bash - uses: actions/checkout@v3 with: + path: ${{ inputs.path }} clean: 'false' submodules: 'true' - uses: actions/setup-go@v4 with: - cache-dependency-path: golang/cosmos/go.sum + cache-dependency-path: ${{ inputs.path }}/golang/cosmos/go.sum go-version: ${{ inputs.go-version }} - name: go mod download - working-directory: ./golang/cosmos + working-directory: ${{ inputs.path }}/golang/cosmos run: go mod download shell: bash diff --git a/.github/workflows/deployment-test.yml b/.github/workflows/deployment-test.yml index 888bd18074b..eac662a41f9 100644 --- a/.github/workflows/deployment-test.yml +++ b/.github/workflows/deployment-test.yml @@ -27,13 +27,17 @@ jobs: - uses: actions/checkout@v3 with: submodules: 'true' + path: ./agoric-sdk - run: sudo packages/deployment/scripts/install-deps.sh - - uses: ./.github/actions/restore-golang + working-directory: ./agoric-sdk + - uses: ./agoric-sdk/.github/actions/restore-golang with: go-version: '1.20' - - uses: ./.github/actions/restore-node + path: ./agoric-sdk + - uses: ./agoric-sdk/.github/actions/restore-node with: node-version: 18.x + path: ./agoric-sdk # Forces xsnap to initialize all memory to random data, which increases # the chances the content of snapshots may deviate between validators xsnap-random-init: '1' @@ -63,46 +67,55 @@ jobs: uses: actions/checkout@v3 with: repository: Agoric/testnet-load-generator - path: testnet-load-generator + path: ./testnet-load-generator ref: ${{steps.get-loadgen-branch.outputs.result}} - name: Build cosmic-swingset dependencies + working-directory: ./agoric-sdk run: | set -e cd packages/cosmic-swingset make install - - run: | + - name: Make networks directory + run: | + set -e + mkdir networks + - name: Run integration test + working-directory: ./networks + run: | set -xe - DOCKER_VOLUMES="$PWD:/usr/src/agoric-sdk" \ - packages/deployment/scripts/integration-test.sh + DOCKER_VOLUMES="$PWD/../agoric-sdk:/usr/src/agoric-sdk" \ + LOADGEN=1 \ + ../agoric-sdk/packages/deployment/scripts/integration-test.sh timeout-minutes: 90 env: NETWORK_NAME: chaintest - name: capture results if: always() + working-directory: ./networks run: | NOW=$(date -u +%Y%m%dT%H%M%S) echo "NOW=$NOW" >> "$GITHUB_ENV" # Stop the chain from running. - packages/deployment/scripts/setup.sh play stop || true + ../agoric-sdk/packages/deployment/scripts/setup.sh play stop || true # Get the results. - packages/deployment/scripts/capture-integration-results.sh "${{ job.status == 'failure' }}" + ../agoric-sdk/packages/deployment/scripts/capture-integration-results.sh "${{ job.status == 'failure' }}" # Tear down the nodes. - echo yes | packages/deployment/scripts/setup.sh destroy || true + echo yes | ../agoric-sdk/packages/deployment/scripts/setup.sh destroy || true env: NETWORK_NAME: chaintest - uses: actions/upload-artifact@v3 if: always() with: name: deployment-test-results-${{ env.NOW }} - path: chaintest/results + path: ./networks/chaintest/results - name: notify on failure if: failure() && github.event_name != 'pull_request' - uses: ./.github/actions/notify-status + uses: ./agoric-sdk/.github/actions/notify-status with: webhook: ${{ secrets.SLACK_WEBHOOK_URL }} from: ${{ secrets.NOTIFY_EMAIL_FROM }} diff --git a/packages/deployment/scripts/integration-test.sh b/packages/deployment/scripts/integration-test.sh index 42554f4c177..59025808a07 100755 --- a/packages/deployment/scripts/integration-test.sh +++ b/packages/deployment/scripts/integration-test.sh @@ -9,16 +9,24 @@ export NETWORK_NAME=${NETWORK_NAME-localtest} SDK_SRC=${SDK_SRC-$(cd "$thisdir/../../.." > /dev/null && pwd -P)} -DEFAULT_LOADGEN=/usr/src/testnet-load-generator LOADGEN=${LOADGEN-""} -if [ -n "$LOADGEN" ]; then +if [ -z "$LOADGEN" ] || [ "x$LOADGEN" = "x1" ]; then + for dir in "$SDK_SRC/../testnet-load-generator" /usr/src/testnet-load-generator; do + if [ -d "$dir" ]; then + LOADGEN="$dir" + break + fi + done +fi + +if [ -d "$LOADGEN" ]; then + # Get the absolute path. LOADGEN=$(cd "$LOADGEN" > /dev/null && pwd -P) -elif [ -d "$SDK_SRC/../testnet-load-generator" ]; then - LOADGEN=$(cd "$SDK_SRC/../testnet-load-generator" > /dev/null && pwd -P) -elif [ -d "$DEFAULT_LOADGEN" ]; then - LOADGEN=$(cd "$DEFAULT_LOADGEN" > /dev/null && pwd -P) +elif [ -n "$LOADGEN" ]; then + echo "Cannot find loadgen (\$LOADGEN=$LOADGEN)" >&2 + exit 2 else - LOADGEN= + echo "Running chain without loadgen" >&2 fi SOLO_ADDR= @@ -61,7 +69,7 @@ then cp ag-chain-cosmos/data/genesis.json "$RESULTSDIR/genesis.json" cp "$AG_SETUP_COSMOS_HOME/ag-chain-cosmos/data/genesis.json" "$RESULTSDIR/genesis.json" cd "$LOADGEN" - SOLO_COINS=40000000000uist \ + SOLO_COINS=40000000000uist PATH="$thisdir/../bin:$PATH" \ "$AG_SETUP_COSMOS_HOME/faucet-helper.sh" add-egress loadgen "$SOLO_ADDR" SLOGSENDER=@agoric/telemetry/src/otel-trace.js SOLO_SLOGSENDER="" \ SLOGSENDER_FAIL_ON_ERROR=1 SLOGSENDER_AGENT=process \ diff --git a/scripts/run-deployment-integration.sh b/scripts/run-deployment-integration.sh index 18ced9839ac..eae1ab555c2 100644 --- a/scripts/run-deployment-integration.sh +++ b/scripts/run-deployment-integration.sh @@ -11,8 +11,6 @@ export AGORIC_SDK_PATH="${AGORIC_SDK_PATH-$SDK_SRC}" export NETWORK_NAME=chaintest -sudo ln -sf "$SDK_SRC/packages/deployment/bin/ag-setup-cosmos" /usr/local/bin/ag-setup-cosmos - # Note: the deployment test and the loadgen test in testnet mode modify some # directories in $HOME so provide an empty $HOME for them. export HOME="$(mktemp -d -t deployment-integration-home.XXXXX)" @@ -20,22 +18,28 @@ export HOME="$(mktemp -d -t deployment-integration-home.XXXXX)" # While it'd be great if these [tests were more hermetic](https://github.com/Agoric/agoric-sdk/issues/8059), # this manual runner must currently reset paths relative to the SDK to ensure # reproducible tests. -rm -rf "$SDK_SRC/chaintest" "$SDK_SRC/../testnet-load-generator/_agstate/agoric-servers/testnet-8000" +rm -rf "$SDK_SRC/../testnet-load-generator/_agstate/agoric-servers/testnet-8000" + +export OUTPUT_PATH="$SDK_SRC/../deployment-test-results/networks-$(date +%s)" +mkdir -p "$OUTPUT_PATH" cd "$SDK_SRC" sudo ./packages/deployment/scripts/install-deps.sh yarn install && XSNAP_RANDOM_INIT=1 yarn build && make -C packages/cosmic-swingset/ + +cd "$OUTPUT_PATH" # change to "false" to skip extraction on success like in CI testfailure="unknown" DOCKER_VOLUMES="$AGORIC_SDK_PATH:/usr/src/agoric-sdk" \ -packages/deployment/scripts/integration-test.sh || { +LOADGEN=1 \ +$SDK_SRC/packages/deployment/scripts/integration-test.sh || { echo "Test failed!!!" testfailure="true" } -packages/deployment/scripts/setup.sh play stop || true -packages/deployment/scripts/capture-integration-results.sh $testfailure -echo yes | packages/deployment/scripts/setup.sh destroy || true +$SDK_SRC/packages/deployment/scripts/setup.sh play stop || true +$SDK_SRC/packages/deployment/scripts/capture-integration-results.sh $testfailure +echo yes | $SDK_SRC/packages/deployment/scripts/setup.sh destroy || true # Not part of CI -scripts/process-integration-results.sh $NETWORK_NAME/results +$SDK_SRC/scripts/process-integration-results.sh $NETWORK_NAME/results