fix CI tests

This commit is contained in:
Roy Crihfield 2023-09-15 15:05:48 +08:00
parent 94ce5e00bc
commit fcd3745d74
2 changed files with 31 additions and 25 deletions

View File

@ -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

View File

@ -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