eth-blob-indexer/.gitea/workflows/test.yml
2024-08-05 12:36:29 -05:00

108 lines
3.4 KiB
YAML

name: Tests
on:
pull_request:
branches: '*'
push:
branches:
- main
- ci-test
env:
SO_VERSION: latest
SYSTEM_TESTS_REF: roysc/test-blob-tx
FIXTURENET_ETH_STACKS_REF: roysc/add-ipld-eth-server
jobs:
test-beacon-collector:
name: Run Beacon collector tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
progress: false
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
check-latest: true
- name: "Build server image"
run: docker build . -t cerc/eth-blob-indexer:local
- name: "Install Python"
uses: actions/setup-python@v4
with:
python-version: 3.11
- 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
echo PATH="$PATH:$(pwd)" >> $GITHUB_ENV
- name: "Clone system-tests"
uses: actions/checkout@v4
with:
repository: cerc-io/system-tests
ref: ${{ env.SYSTEM_TESTS_REF }}
path: ./system-tests
token: ${{ secrets.CICD_REPO_TOKEN }}
progress: false
- name: "Install pytest"
working-directory: ./system-tests
run: pip3 install pytest
- name: "Clone fixturenet stack repo"
uses: actions/checkout@v4
with:
repository: cerc-io/fixturenet-eth-stacks
ref: ${{ env.FIXTURENET_ETH_STACKS_REF }}
path: ./fixturenet-eth-stacks
progress: false
- name: "Run fixturenet stack"
run: ./scripts/run-test-stack.sh ./fixturenet-eth-stacks/stack-orchestrator/stacks/fixturenet-plugeth
- name: "Run server"
run: docker compose -f test/compose.yml up --wait --quiet-pull
- name: "Run tests"
working-directory: ./system-tests
# Work around dependency conflict in system-tests:
# web3 uses an older eth-account until (unreleased) v7
run: |
pip3 install -r requirements.txt
pip3 install --no-deps 'eth-account>=0.12.3,<0.13'
pip3 install 'pydantic>=2.0.0'
python3 -m pytest -vv -k test_blob_tx
test-blobscan-scraper:
name: Run Blobscan scraper tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
progress: false
- uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
check-latest: true
- name: "Install redis-cli"
env:
DEBIAN_FRONTEND: noninteractive
run: apt-get update && apt-get install -y redis-tools
- name: "Run Blob DB"
working-directory: ./test
run: docker compose up eth-blob-db --wait --quiet-pull
# Check a mainnet blob
- name: "Run tests"
env:
TEST_BLOCK: 20000000
TEST_VHASH: 0x017ba4bd9c166498865a3d08618e333ee84812941b5c3a356971b4a6ffffa574
# First 10 bytes of blob data
EXPECTED_VALUE: 2100000675789c8cd37b0a
run: |
REDIS_PORT=$(docker port test-eth-blob-db-1 6379 | cut -d: -f2)
go run ./cmd/blobscan-scraper \
--redis-addr localhost:$REDIS_PORT --log-level debug \
--from-block $TEST_BLOCK --to-block $((TEST_BLOCK + 1))
VALUE=$(redis-cli -p $REDIS_PORT GETRANGE blob:$TEST_VHASH 0 9 | od -An -tx1 | tr -d ' \n')
[ "$EXPECTED_VALUE" = "$VALUE" ]