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 - main
- ci-test - ci-test
env: env:
# Needed until we can incorporate docker startup into the executor container # Needed until we can incorporate docker startup into the executor container
DOCKER_HOST: unix:///var/run/dind.sock DOCKER_HOST: unix:///var/run/dind.sock
SO_VERSION: v1.1.0-c30c779-202309082138 SO_VERSION: plugeth-ci # contains fixes for plugeth stack
jobs: jobs:
unit-tests: unit-tests:
name: "Run unit tests" name: Run unit tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -27,24 +26,23 @@ jobs:
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
check-latest: true check-latest: true
- name: "Run dockerd" - name: Run dockerd
run: | run: |
dockerd -H $DOCKER_HOST --userland-proxy=false & dockerd -H $DOCKER_HOST --userland-proxy=false &
sleep 5 sleep 5
- name: "Run DB container" - name: Run DB container
run: | run: |
docker compose -f test/compose-db.yml up --wait --quiet-pull docker compose -f test/compose-db.yml up --wait --quiet-pull
- name: "Set Gitea credentials" - name: Set access token
env: env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }} TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: | 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 tests" - name: Run tests
run: | run: go test -p 1 -v ./pkg/...
go test -v ./pkg/...
integration-tests: integration-tests:
name: "Run integration tests" name: Run integration tests
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
@ -52,29 +50,36 @@ jobs:
with: with:
go-version-file: 'go.mod' go-version-file: 'go.mod'
check-latest: true check-latest: true
- name: "Run dockerd" - name: Run dockerd
run: | run: |
dockerd -H $DOCKER_HOST --userland-proxy=false & dockerd -H $DOCKER_HOST --userland-proxy=false &
sleep 5 sleep 5
- name: "Install stack-orchestrator" - name: Set Gitea access token
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"
env: env:
TOKEN: ${{ secrets.CICD_REPO_TOKEN }} TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: | 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: env:
CERC_GO_AUTH_TOKEN: ${{ secrets.CICD_REPO_TOKEN }} CERC_GO_AUTH_TOKEN: ${{ secrets.CICD_REPO_TOKEN }}
run: ./scripts/integration-setup.sh run: ./scripts/integration-setup.sh
- name: "Run contract deployer" - name: Run contract deployer
run: | run: |
docker compose -f test/compose-deployer.yml up --wait --quiet-pull docker compose -f test/compose-deployer.yml up --wait --quiet-pull
- name: "Wait for testnet" - name: Wait for testnet
run: | run: |
# Start validator at current head, but not before Merge (block 1 on test chain) # Start validator at current head, but not before Merge (block 1 on test chain)
echo "Waiting for chain head to progress..." echo "Waiting for chain head to progress..."
@ -84,6 +89,6 @@ jobs:
do sleep 5; done do sleep 5; done
echo "Chain has reached block $height" echo "Chain has reached block $height"
echo VALIDATE_FROM_BLOCK=$height >> "$GITHUB_ENV" echo VALIDATE_FROM_BLOCK=$height >> "$GITHUB_ENV"
- name: "Run tests" - name: Run tests
run: | run: |
go test ./integration/... -v -timeout=20m go test ./integration/... -v -timeout=20m

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/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 set -e
CONFIG_DIR=$(readlink -f "${CONFIG_DIR:-$(mktemp -d)}") 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:-..}" export CERC_REPO_BASE_DIR="${CERC_REPO_BASE_DIR:-..}"
# 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