Skip to content

Commit

Permalink
Merge pull request #8085 from Agoric/mhofman/fix-deployment-ci-loadgen
Browse files Browse the repository at this point in the history
fix(ci): checkout agoric-sdk in sub folder
  • Loading branch information
michaelfig authored Jul 23, 2023
2 parents fb922d3 + 680c01a commit 8bcf6af
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 29 deletions.
9 changes: 7 additions & 2 deletions .github/actions/restore-golang/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
35 changes: 24 additions & 11 deletions .github/workflows/deployment-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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 }}
Expand Down
24 changes: 16 additions & 8 deletions packages/deployment/scripts/integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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 \
Expand Down
20 changes: 12 additions & 8 deletions scripts/run-deployment-integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,31 +11,35 @@ 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)"

# 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

0 comments on commit 8bcf6af

Please sign in to comment.