forked from cerc-io/ipld-eth-server
491939b35f
* Update geth version: 1.10.18 * Upgrade to Go18 and fix broken interfaces * Update Go version in dockerfile * Update make file to download dependencies * Update go version for integration tests. * update file name * install packages. * Update gingko version and secret * Update unit test download package * Update vulcanize dependencies * Update commands for calling unit tests * Use latest version of statediff * Update github variable to work with tags (#164) * Update github variable to work with tags * Update tests.yaml * Use conditional for reference
219 lines
9.8 KiB
YAML
219 lines
9.8 KiB
YAML
name: Test the stack.
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
BUILD_HOSTNAME:
|
|
required: true
|
|
BUILD_USERNAME:
|
|
required: true
|
|
BUILD_KEY:
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Run docker build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
- name: Run docker build
|
|
run: make docker-build
|
|
test:
|
|
name: Run unit tests
|
|
env:
|
|
GOPATH: /tmp/go
|
|
# To run the unit tests you need to add secrets to your repository.
|
|
BUILD_HOSTNAME: ${{ secrets.BUILD_HOSTNAME }}
|
|
BUILD_USERNAME: ${{ secrets.BUILD_USERNAME }}
|
|
BUILD_KEY: ${{ secrets.BUILD_KEY }}
|
|
#strategy:
|
|
# matrix:
|
|
# go-version: [1.16.x, 1.17.x]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
# Passed experience with GHA has taught me to store variables in files instead of passing them as variables.
|
|
- name: Output variables to files
|
|
run: |
|
|
echo $GITHUB_REPOSITORY > /tmp/git_repository
|
|
[ -z "$GITHUB_HEAD_REF" ] && echo $GITHUB_REF_NAME > /tmp/git_head_ref || echo $GITHUB_HEAD_REF > /tmp/git_head_ref
|
|
echo "-----BEGIN OPENSSH PRIVATE KEY-----" >> /tmp/key
|
|
echo ${{ env.BUILD_KEY }} >> /tmp/key
|
|
echo "-----END OPENSSH PRIVATE KEY-----" >> /tmp/key
|
|
chmod 400 /tmp/key
|
|
cat /tmp/git_repository
|
|
cat /tmp/git_head_ref
|
|
|
|
- name: Raw SCP
|
|
run: |
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_repository ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_repository
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key /tmp/git_head_ref ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/git_head_ref
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key .github/workflows/run_unit_test.sh ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/run_unit_test.sh
|
|
|
|
- name: Trigger Unit Test
|
|
run: |
|
|
ssh -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }} go install github.com/onsi/ginkgo/ginkgo@latest
|
|
ssh -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }} /tmp/run_unit_test.sh
|
|
|
|
- name: Get the logs and cat them
|
|
run: |
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/test.log .
|
|
cat ./test.log
|
|
|
|
- name: Check Error Code
|
|
run: |
|
|
scp -o 'StrictHostKeyChecking no' -o UserKnownHostsFile=/dev/null -q -i /tmp/key ${{ env.BUILD_USERNAME }}@${{ env.BUILD_HOSTNAME }}:/tmp/return_test.txt .
|
|
[ $(cat ./return_test.txt) -eq 0 ]
|
|
|
|
integrationtest:
|
|
name: Run integration tests
|
|
env:
|
|
STACK_ORCHESTRATOR_REF: 418957a1f745c921b21286c13bb033f922a91ae9
|
|
GO_ETHEREUM_REF: "v1.10.18-statediff-4.0.2-alpha"
|
|
IPLD_ETH_DB_REF: 91d30b9ea1acecd0a7f4307390a98bf3e289b8d7
|
|
GOPATH: /tmp/go
|
|
DB_WRITE: true
|
|
ETH_FORWARD_ETH_CALLS: false
|
|
ETH_PROXY_ON_ERROR: false
|
|
ETH_HTTP_PATH: "go-ethereum:8545"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create GOPATH
|
|
run: mkdir -p /tmp/go
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ">=1.18.0"
|
|
check-latest: true
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
path: "./ipld-eth-server"
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.STACK_ORCHESTRATOR_REF }}
|
|
path: "./stack-orchestrator/"
|
|
repository: vulcanize/stack-orchestrator
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.GO_ETHEREUM_REF }}
|
|
repository: vulcanize/go-ethereum
|
|
path: "./go-ethereum/"
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.IPLD_ETH_DB_REF }}
|
|
repository: vulcanize/ipld-eth-db
|
|
path: "./ipld-eth-db/"
|
|
- name: Create config file
|
|
run: |
|
|
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh
|
|
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ >> ./config.sh
|
|
echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh
|
|
echo vulcanize_test_contract=$GITHUB_WORKSPACE/ipld-eth-server/test/contract >> ./config.sh
|
|
echo db_write=$DB_WRITE >> ./config.sh
|
|
echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh
|
|
echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh
|
|
echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh
|
|
echo ipld_eth_server_db_dependency=access-node >> ./config.sh
|
|
echo go_ethereum_db_dependency=access-node >> ./config.sh
|
|
echo connecting_db_name=vulcanize_testing_v4 >> ./config.sh
|
|
echo watched_address_gap_filler_enabled=false >> ./config.sh
|
|
echo watched_address_gap_filler_interval=5 >> ./config.sh
|
|
cat ./config.sh
|
|
- name: Build geth
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/stack-orchestrator/helper-scripts
|
|
./compile-geth.sh \
|
|
-p "$GITHUB_WORKSPACE/config.sh" \
|
|
-e docker
|
|
- name: Run docker compose
|
|
run: |
|
|
docker-compose \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-migration.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-contract.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-timescale-db.yml" \
|
|
--env-file "$GITHUB_WORKSPACE/config.sh" \
|
|
up -d --build
|
|
- name: Test
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/ipld-eth-server
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
|
make integrationtest
|
|
|
|
integrationtest_forwardethcalls:
|
|
name: Run integration tests for direct proxy fall-through of eth_calls
|
|
env:
|
|
STACK_ORCHESTRATOR_REF: 418957a1f745c921b21286c13bb033f922a91ae9
|
|
GO_ETHEREUM_REF: "v1.10.18-statediff-4.0.2-alpha"
|
|
IPLD_ETH_DB_REF: 91d30b9ea1acecd0a7f4307390a98bf3e289b8d7
|
|
GOPATH: /tmp/go
|
|
DB_WRITE: false
|
|
ETH_FORWARD_ETH_CALLS: true
|
|
ETH_PROXY_ON_ERROR: false
|
|
ETH_HTTP_PATH: "go-ethereum:8545"
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create GOPATH
|
|
run: mkdir -p /tmp/go
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: ">=1.18.0"
|
|
check-latest: true
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
path: "./ipld-eth-server"
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.STACK_ORCHESTRATOR_REF }}
|
|
path: "./stack-orchestrator/"
|
|
repository: vulcanize/stack-orchestrator
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.GO_ETHEREUM_REF }}
|
|
repository: vulcanize/go-ethereum
|
|
path: "./go-ethereum/"
|
|
- uses: actions/checkout@v2
|
|
with:
|
|
ref: ${{ env.IPLD_ETH_DB_REF }}
|
|
repository: vulcanize/ipld-eth-db
|
|
path: "./ipld-eth-db/"
|
|
- name: Create config file
|
|
run: |
|
|
echo vulcanize_go_ethereum=$GITHUB_WORKSPACE/go-ethereum/ > ./config.sh
|
|
echo vulcanize_ipld_eth_db=$GITHUB_WORKSPACE/ipld-eth-db/ >> ./config.sh
|
|
echo vulcanize_ipld_eth_server=$GITHUB_WORKSPACE/ipld-eth-server/ >> ./config.sh
|
|
echo vulcanize_test_contract=$GITHUB_WORKSPACE/ipld-eth-server/test/contract >>./config.sh
|
|
echo db_write=$DB_WRITE >> ./config.sh
|
|
echo eth_forward_eth_calls=$ETH_FORWARD_ETH_CALLS >> ./config.sh
|
|
echo eth_proxy_on_error=$ETH_PROXY_ON_ERROR >> ./config.sh
|
|
echo eth_http_path=$ETH_HTTP_PATH >> ./config.sh
|
|
echo ipld_eth_server_db_dependency=access-node >> ./config.sh
|
|
echo go_ethereum_db_dependency=access-node >> ./config.sh
|
|
echo connecting_db_name=vulcanize_testing_v4 >> ./config.sh
|
|
echo watched_address_gap_filler_enabled=false >> ./config.sh
|
|
echo watched_address_gap_filler_interval=5 >> ./config.sh
|
|
cat ./config.sh
|
|
- name: Build geth
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/stack-orchestrator/helper-scripts
|
|
./compile-geth.sh \
|
|
-p "$GITHUB_WORKSPACE/config.sh" \
|
|
-e docker
|
|
- name: Run docker compose
|
|
run: |
|
|
docker-compose \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-db-migration.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-go-ethereum.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-ipld-eth-server.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/local/docker-compose-contract.yml" \
|
|
-f "$GITHUB_WORKSPACE/stack-orchestrator/docker/latest/docker-compose-timescale-db.yml" \
|
|
--env-file "$GITHUB_WORKSPACE/config.sh" \
|
|
up -d --build
|
|
- name: Test
|
|
run: |
|
|
cd $GITHUB_WORKSPACE/ipld-eth-server
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8081)" != "200" ]; do echo "waiting for ipld-eth-server..." && sleep 5; done && \
|
|
while [ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:8545)" != "200" ]; do echo "waiting for geth-statediff..." && sleep 5; done && \
|
|
make integrationtest
|