From fcd3745d744c74d122de10c448d1ebcc968ad767 Mon Sep 17 00:00:00 2001 From: Roy Crihfield Date: Fri, 15 Sep 2023 15:05:48 +0800 Subject: [PATCH] fix CI tests --- .github/workflows/test.yml | 51 ++++++++++++++++++++---------------- scripts/integration-setup.sh | 5 ++-- 2 files changed, 31 insertions(+), 25 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 1a9fcc1..79b76f7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,15 +11,14 @@ on: - main - ci-test - env: # Needed until we can incorporate docker startup into the executor container DOCKER_HOST: unix:///var/run/dind.sock - SO_VERSION: v1.1.0-c30c779-202309082138 + SO_VERSION: plugeth-ci # contains fixes for plugeth stack jobs: unit-tests: - name: "Run unit tests" + name: Run unit tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -27,24 +26,23 @@ jobs: with: go-version-file: 'go.mod' check-latest: true - - name: "Run dockerd" + - name: Run dockerd run: | dockerd -H $DOCKER_HOST --userland-proxy=false & sleep 5 - - name: "Run DB container" + - name: Run DB container run: | docker compose -f test/compose-db.yml up --wait --quiet-pull - - name: "Set Gitea credentials" + - name: Set access token env: TOKEN: ${{ secrets.CICD_REPO_TOKEN }} run: | - git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf "https://git.vdb.to/" - - name: "Run tests" - run: | - go test -v ./pkg/... + git config --global url."https://$TOKEN:@git.vdb.to/".insteadOf https://git.vdb.to/ + - name: Run tests + run: go test -p 1 -v ./pkg/... integration-tests: - name: "Run integration tests" + name: Run integration tests runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 @@ -52,29 +50,36 @@ jobs: with: go-version-file: 'go.mod' check-latest: true - - name: "Run dockerd" + - name: Run dockerd run: | dockerd -H $DOCKER_HOST --userland-proxy=false & sleep 5 - - name: "Install stack-orchestrator" - run: | - curl -L -O https://github.com/cerc-io/stack-orchestrator/releases/download/$SO_VERSION/laconic-so - chmod +x laconic-so - - run: pip install ./stack-orchestrator - - name: "Set Gitea credentials" + - name: Set Gitea access token env: TOKEN: ${{ secrets.CICD_REPO_TOKEN }} run: | - 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 testnet stack" + - name: Install jq, python + env: + DEBIAN_FRONTEND: noninteractive + run: apt-get update && apt-get install -y jq python3-pip + - name: Install stack-orchestrator + uses: actions/checkout@v3 + with: + repository: cerc-io/stack-orchestrator + ref: ${{ env.SO_VERSION }} + path: ./stack-orchestrator + - run: pip install ./stack-orchestrator + + - name: Run testnet stack env: CERC_GO_AUTH_TOKEN: ${{ secrets.CICD_REPO_TOKEN }} run: ./scripts/integration-setup.sh - - name: "Run contract deployer" + - name: Run contract deployer run: | docker compose -f test/compose-deployer.yml up --wait --quiet-pull - - name: "Wait for testnet" + - name: Wait for testnet run: | # Start validator at current head, but not before Merge (block 1 on test chain) echo "Waiting for chain head to progress..." @@ -84,6 +89,6 @@ jobs: do sleep 5; done echo "Chain has reached block $height" echo VALIDATE_FROM_BLOCK=$height >> "$GITHUB_ENV" - - name: "Run tests" + - name: Run tests run: | go test ./integration/... -v -timeout=20m diff --git a/scripts/integration-setup.sh b/scripts/integration-setup.sh index 680a833..8894523 100755 --- a/scripts/integration-setup.sh +++ b/scripts/integration-setup.sh @@ -1,11 +1,12 @@ #!/bin/bash -# Build and deploy a cluster with only what we need from the stack +# Builds and deploys a stack with only what we need. +# This script assumes we are running in the project root. set -e CONFIG_DIR=$(readlink -f "${CONFIG_DIR:-$(mktemp -d)}") -# By default assume we are running in the project root +# Point stack-orchestrator to the multi-project root export CERC_REPO_BASE_DIR="${CERC_REPO_BASE_DIR:-..}" # v5 migrations only go up to version 18 echo CERC_STATEDIFF_DB_GOOSE_MIN_VER=18 >> $CONFIG_DIR/stack.env