From fd83bb6b3e30484c033cdefc53180f6b0a3baf27 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Wed, 12 Jul 2023 21:15:02 +0800 Subject: [PATCH] CI wip --- .gitea/workflows/test.yml | 35 ++++++++++++++++------------------- scripts/integration-setup.sh | 29 ++++++++--------------------- test/compose.yml | 8 +++++--- 3 files changed, 29 insertions(+), 43 deletions(-) diff --git a/.gitea/workflows/test.yml b/.gitea/workflows/test.yml index 895b08e..0d90d53 100644 --- a/.gitea/workflows/test.yml +++ b/.gitea/workflows/test.yml @@ -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 diff --git a/scripts/integration-setup.sh b/scripts/integration-setup.sh index 4409a78..08f665f 100755 --- a/scripts/integration-setup.sh +++ b/scripts/integration-setup.sh @@ -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 diff --git a/test/compose.yml b/test/compose.yml index c248855..7b8e34c 100644 --- a/test/compose.yml +++ b/test/compose.yml @@ -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: