CI wip
Some checks reported warnings
Test / Run unit tests (pull_request) Has started running
Test / Run integration tests (pull_request) Has been cancelled

This commit is contained in:
Roy Crihfield 2023-07-12 21:15:02 +08:00
parent f846fb610b
commit fd83bb6b3e
3 changed files with 29 additions and 43 deletions

View File

@ -18,26 +18,20 @@ jobs:
with:
go-version-file: 'go.mod'
check-latest: true
- name: "Run DB container"
run: |
docker compose -f test/compose.yml up --wait
sleep 600
- name: "Set up Gitea access token"
env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: |
[[ -n "$TOKEN" ]]
git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/"
- name: "Run DB container"
git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/
- name: "Run tests"
env:
DATABASE_HOSTNAME: ipld-eth-db
DATABASE_PORT: 5432
run: |
set -x
docker compose -f test/compose.yml up --attach ipld-eth-db &
sleep 60
docker ps
apt-get update && apt-get install -y netcat
nc -v $DATABASE_HOSTNAME $DATABASE_PORT
go test -v ./...
# - name: "Run tests"
# run: go test -v ./...
DATABASE_HOSTNAME: gitea.local
DATABASE_PORT: 8077
run: go test -v ./...
integration-tests:
name: "Run integration tests"
@ -54,6 +48,7 @@ jobs:
path: ./plugeth
# These images need access tokens configured
- name: "Build docker image"
if: false
env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: |
@ -66,7 +61,7 @@ jobs:
- name: "Install stack-orchestrator"
uses: actions/checkout@v3
with:
repository: roysc/stack-orchestrator
repository: cerc-io/stack-orchestrator
ref: plugeth-testing
path: ./stack-orchestrator
- run: |
@ -79,10 +74,12 @@ jobs:
uses: actions/checkout@v3
with:
repository: cerc-io/system-tests
ref: roy/dev
path: ./system-tests
- name: "Run tests"
working-directory: ./system-tests
run: |
pytest -v \
--accounts-url="$GETH_BOOTNODE_URL/accounts.csv" \
-k test_basic_db
pip install pytest
pip install -r requirements.txt
pytest -v --host=gitea.local --db-host=gitea.local \
-k test_basic_db

View File

@ -13,28 +13,15 @@ export CERC_REPO_BASE_DIR="${CERC_REPO_BASE_DIR:-$(realpath $(git rev-parse --sh
# v5 migrations only go up to version 18
echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=18 >> $CONFIG_DIR/stack.env
# Build and deploy a cluster with only what we need from the stack
$laconic_so setup-repositories \
--exclude github.com/dboreham/foundry,github.com/cerc-io/tx-spammer,github.com/cerc-io/ipld-eth-server,git.vdb.to/cerc-io/plugeth,git.vdb.to/cerc-io/plugeth-statediff \
--branches-file ./test/stack-refs.txt
# # Build and deploy a cluster with only what we need from the stack
# $laconic_so setup-repositories \
# --exclude github.com/dboreham/foundry,github.com/cerc-io/tx-spammer,github.com/cerc-io/ipld-eth-server,git.vdb.to/cerc-io/plugeth,git.vdb.to/cerc-io/plugeth-statediff \
# --branches-file ./test/stack-refs.txt
$laconic_so build-containers \
--exclude cerc/ipld-eth-server,cerc/keycloak,cerc/tx-spammer,cerc/foundry,cerc/plugeth,cerc/plugeth-statediff
# $laconic_so build-containers \
# --exclude cerc/ipld-eth-server,cerc/keycloak,cerc/tx-spammer,cerc/foundry,cerc/plugeth,cerc/plugeth-statediff
$laconic_so --quiet deploy \
$laconic_so deploy \
--exclude foundry,keycloak,tx-spammer,ipld-eth-server \
--env-file $CONFIG_DIR/stack.env \
--cluster "$cluster" up &
set +x
# Output vars if we are running on Github
if [[ -n "$GITHUB_ENV" ]]; then
bootnode_port=$($laconic_so deploy --cluster $cluster port fixturenet-eth-bootnode-geth 9898 | head -1 | cut -d':' -f2)
geth_port=$($laconic_so deploy --cluster $cluster port fixturenet-eth-geth-1 8545 | cut -d':' -f2)
eis_port=$($laconic_so deploy --cluster $cluster port ipld-eth-server 8081 | cut -d':' -f2)
echo GETH_BOOTNODE_URL="http://localhost:$bootnode_port" >> "$GITHUB_ENV"
echo GETH_URL="http://localhost:$geth_port" >> "$GITHUB_ENV"
echo IPLD_ETH_URL="http://localhost:$eis_port" >> "$GITHUB_ENV"
fi
--cluster "$cluster" up

View File

@ -14,12 +14,14 @@ services:
ipld-eth-db:
image: timescale/timescaledb:latest-pg14
restart: always
command: ["postgres", "-c", "log_statement=all"]
environment:
POSTGRES_USER: "vdbm"
POSTGRES_DB: "cerc_testing"
POSTGRES_PASSWORD: "password"
ports:
- 127.0.0.1:8077:5432
# volumes:
# - ../indexer/database/file:/file_indexer
volumes:
- statediff_file_indexer_data:/file_indexer
volumes:
statediff_file_indexer_data: