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: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
check-latest: true check-latest: true
- name: "Run DB container"
run: |
docker compose -f test/compose.yml up --wait
sleep 600
- name: "Set up Gitea access token" - name: "Set up Gitea access token"
env: env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }} TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: | run: |
[[ -n "$TOKEN" ]] git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/
git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/" - name: "Run tests"
- name: "Run DB container"
env: env:
DATABASE_HOSTNAME: ipld-eth-db DATABASE_HOSTNAME: gitea.local
DATABASE_PORT: 5432 DATABASE_PORT: 8077
run: | run: go test -v ./...
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 ./...
integration-tests: integration-tests:
name: "Run integration tests" name: "Run integration tests"
@ -54,6 +48,7 @@ jobs:
path: ./plugeth path: ./plugeth
# These images need access tokens configured # These images need access tokens configured
- name: "Build docker image" - name: "Build docker image"
if: false
env: env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }} TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: | run: |
@ -66,7 +61,7 @@ jobs:
- name: "Install stack-orchestrator" - name: "Install stack-orchestrator"
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: roysc/stack-orchestrator repository: cerc-io/stack-orchestrator
ref: plugeth-testing ref: plugeth-testing
path: ./stack-orchestrator path: ./stack-orchestrator
- run: | - run: |
@ -79,10 +74,12 @@ jobs:
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: cerc-io/system-tests repository: cerc-io/system-tests
ref: roy/dev
path: ./system-tests path: ./system-tests
- name: "Run tests" - name: "Run tests"
working-directory: ./system-tests working-directory: ./system-tests
run: | run: |
pytest -v \ pip install pytest
--accounts-url="$GETH_BOOTNODE_URL/accounts.csv" \ pip install -r requirements.txt
-k test_basic_db 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 # v5 migrations only go up to version 18
echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=18 >> $CONFIG_DIR/stack.env 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 # # Build and deploy a cluster with only what we need from the stack
$laconic_so setup-repositories \ # $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 \ # --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 # --branches-file ./test/stack-refs.txt
$laconic_so build-containers \ # $laconic_so build-containers \
--exclude cerc/ipld-eth-server,cerc/keycloak,cerc/tx-spammer,cerc/foundry,cerc/plugeth,cerc/plugeth-statediff # --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 \ --exclude foundry,keycloak,tx-spammer,ipld-eth-server \
--env-file $CONFIG_DIR/stack.env \ --env-file $CONFIG_DIR/stack.env \
--cluster "$cluster" up & --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

View File

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