Skip to content

Commit

Permalink
e2e: Add avalanchego e2e job (#305)
Browse files Browse the repository at this point in the history
* e2e: Add avalanchego e2e job

* fixup: Use currently supported golang version

* fixup: Enable configurable avalanchego clone path
  • Loading branch information
marun authored Aug 29, 2023
1 parent 4ef26a0 commit 3f5dc8a
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 0 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,3 +148,26 @@ jobs:
DOCKER_PASS: ${{ secrets.DOCKER_PASS }}
KURTOSIS_CLIENT_ID: ${{ secrets.KURTOSIS_CLIENT_ID }}
KURTOSIS_CLIENT_SECRET: ${{ secrets.KURTOSIS_CLIENT_SECRET }}
avalanchego_e2e:
name: AvalancheGo E2E Tests v${{ matrix.go }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ ubuntu-20.04 ]
steps:
- uses: actions/checkout@v3
- name: check out ${{ github.event.inputs.avalanchegoRepo }} ${{ github.event.inputs.avalanchegoBranch }}
if: ${{ github.event_name == 'workflow_dispatch' }}
uses: actions/checkout@v3
with:
repository: ${{ github.event.inputs.avalanchegoRepo }}
ref: ${{ github.event.inputs.avalanchegoBranch }}
path: avalanchego
token: ${{ secrets.AVALANCHE_PAT }}
- uses: actions/setup-go@v3
with:
go-version: '~1.19.12'
check-latest: true
- name: Run e2e tests
run: E2E_SERIAL=1 ./scripts/tests.e2e.sh
shell: bash
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,6 @@ awscpu

bin/
build/

# Used for e2e testing
avalanchego
52 changes: 52 additions & 0 deletions scripts/tests.e2e.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#!/usr/bin/env bash

set -euo pipefail

# Run AvalancheGo e2e tests from the target version against the current state of coreth.

# e.g.,
# ./scripts/tests.e2e.sh
# AVALANCHE_VERSION=v1.10.x ./scripts/tests.e2e.sh
if ! [[ "$0" =~ scripts/tests.e2e.sh ]]; then
echo "must be run from repository root"
exit 255
fi

# Coreth root directory
CORETH_PATH=$( cd "$( dirname "${BASH_SOURCE[0]}" )"; cd .. && pwd )

# Allow configuring the clone path to point to an existing clone
AVALANCHEGO_CLONE_PATH="${AVALANCHEGO_CLONE_PATH:-avalanchego}"

# Load the version
source "$CORETH_PATH"/scripts/versions.sh

# Always return to the coreth path on exit
function cleanup {
cd "${CORETH_PATH}"
}
trap cleanup EXIT

echo "checking out target AvalancheGo version ${avalanche_version}"
if [[ -d "${AVALANCHEGO_CLONE_PATH}" ]]; then
echo "updating existing clone"
cd "${AVALANCHEGO_CLONE_PATH}"
git fetch
git checkout -B "${avalanche_version}"
else
echo "creating new clone"
git clone -b "${avalanche_version}"\
--single-branch https://github.com/ava-labs/avalanchego.git\
"${AVALANCHEGO_CLONE_PATH}"
cd "${AVALANCHEGO_CLONE_PATH}"
fi

echo "updating coreth dependency to point to ${CORETH_PATH}"
go mod edit -replace "github.com/ava-labs/coreth=${CORETH_PATH}"
go mod tidy

echo "building avalanchego"
./scripts/build.sh -r

echo "running AvalancheGo e2e tests"
./scripts/tests.e2e.sh ./build/avalanchego

0 comments on commit 3f5dc8a

Please sign in to comment.